| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: convert PL/SQL into Java
On Mon, 03 Apr 2000 08:47:57 GMT, effler_at_yahoo.com wrote:
>Hi,
>i ve no experience with java at all.
>What advantages comes with java in ORAACLE DB.
>Is it possible to replace a existing PL/SQL function with a "Java
>function"?
>
>Do you have short examples?
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
One possibility is to wrap existing PL/SQL stored program units in Java methods
For example, you can warp the following function
function Node_Tag( P_Ref_Node_Type in number,
P_Ref_Node_Id in number ) return varchar2;
with :
//////////////////////////////////////////////////////////////////////////////////////////////// Method to get object tag
//////////////////////////////////////////////////////////////////////////////////////////////
String node_tag(int p_obj_id) {
int member_parent = -1;
CallableStatement cstmt = null;
String l_node_tag = "";
try {
cstmt = conn.prepareCall("{?=call lib.node_tag(d.c_object, ?)}");
cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
cstmt.setInt(2, p_obj_id);
cstmt.execute();
l_node_tag=cstmt.getString(1);
cstmt.close();
} catch (Exception e) {
System.out.println("Error while trying to find node
tag:"+e.toString());
}
return l_node_tag;
}
Thus the JDBC call to node tag is wrapped, and the function can be used in Java programs.
Hope this helps
Regards
Herman Scheepers
Received on Tue Apr 04 2000 - 10:58:58 CDT
![]() |
![]() |