开发者

How to print on Oracle SQL Developer console using SQLJ

开发者 https://www.devze.com 2022-12-18 15:02 出处:网络
I created and launch the SQLJ Java procedure (开发者_运维知识库using SQL Developer). I have some bugs and I would like to debug Java source code. What is the best way to do this? Is it possible to pri

I created and launch the SQLJ Java procedure (开发者_运维知识库using SQL Developer). I have some bugs and I would like to debug Java source code. What is the best way to do this? Is it possible to print to the SQL Developer console some information using System.out?


The default standard output device in the Oracle Java virtual machine (JVM) is the current trace file.

If you want to reroute all standard output from a program executing in the server--output from any System.out.println() calls, for example--to a user screen, you can execute the SET_OUTPUT() procedure of the DBMS_JAVA package as in the following example.

Input the buffer size in bytes (10,000 bytes in this case).

sqlplus> execute dbms_java.set_output(10000);

Output exceeding the buffer size will be lost.

If you want your code executing in the server to expressly output to the user screen, you can also use the PL-SQL DBMS_OUTPUT.PUT_LINE() 3 procedure instead of the Java System.out.println() method.


SQL Developer has a built-in PL/SQL debugger. There is a useful guide on how to use it here. Pay special attention to the need for DEBUG CONNECT SESSION and DEBUG ANY PROCEDURE privileges.

I admit I don't know whether this works for SQLJ but it seems like the best place to start.

0

精彩评论

暂无评论...
验证码 换一张
取 消