Java’da PL/SQL Fonksiyon Çağırma

6 November 2008 Thursday

Aşağıdaki fonksiyon ile bir PL/SQL fonksiyonu Java’dan çağırılabilir;


public static String gorusmeleriAktar() throws Exception{
int ret_code;
String sonuc = null;
CallableStatement pstmt = null;
Connection Baglan = new com.example.dao.Connection().baglan();


try {
pstmt = Baglan.prepareCall("{? = call SCHEME.F_FONK_NAME()}");
pstmt.registerOutParameter(1, Types.VARCHAR);
pstmt.execute();
sonuc = pstmt.getString(1);
} catch (SQLException e) {
ret_code = e.getErrorCode();
System.out.println("HATA:"+ret_code + e.getMessage());
}


if(pstmt!=null) pstmt.close();
if(Baglan!=null) Baglan.close();
return sonuc;
}

Veli Akçakaya
Bilgisayar Öğretmeni
Yazılım Uzmanı
Bu yazıya yorum ekleyebilirsiniz veya kendi web sitenize geri izleme olarak ekleyebilirsiniz.
Etiketler: , ,

Yorum Ekleyin

Security Code: