sql - Print stored procedure message directly to Java console -
sql - Print stored procedure message directly to Java console -
i have stored procedure using
dbms_output.put_line(' output' || outvar);
i want print same output straight in java console (directly stored proc) without using below code outvar
:
callablestatement.registeroutparameter(1, string); system.out.println(callablestatement.getstring());
change procedure function as:
function some_function homecoming varchar2 begin -- processing here.... homecoming 'output:' || ....; end;
back in java land:
callablestatement cs = connection.preparecall("{? = phone call some_function}"); cs.registeroutparameter(1, string); cs.executeupdate(); system.out.println(cs.getstring(1));
there no other way. got oracle, got ide console. there no relationship between two. info database, have utilize function homecoming value, argue returning values out parameters same thing, , while both value back, code much more intuitive others. says, phone call returns something.
that said, can phone call method in sql developer , print follows:
declare result varchar2; begin result := some_function; dbms_output.putline(result); end;
java sql oracle jdbc
Comments
Post a Comment