12-3. Enabling Output to Be Displayed

Problem

You want to display the results of DBMS_OUTPUT within Oracle SQL Developer.

Solution

Enable DBMS_OUTPUT for your connection via the Dbms Output pane. This pane resides on the lower-right side of the IDE. Do so by selecting the green plus icon within the pane and then choosing the desired connection from the resulting dialog box. Figure 12-6 shows the connection dialog box. After selecting the desired connection and then clicking the OK button, you will be prompted for a password for the connection if you are not already connected. Once a successful password has been entered, then DBMS_OUTPUT will be enabled for the specified connection.

Image

Figure 12-6. Select Connection dialog box

After enabling the DBMS_OUTPUT option, you will be able to see the output from DBMS_OUTPUT within Oracle SQL Developer. This can be very useful, especially for testing purposes.

How It Works

The easiest way to enable SERVEROUTPUT for a particular database connection is to enable DBMS_OUTPUT from within the Dbms Output window. Doing so will enable output to be displayed within the pane when the code is executed.

Image Note For more information on the DBMS_OUTPUT package, please see Recipe 1-6.

Selecting the Dbms Output option from the View menu will open the DBMS_OUTPUT pane. This pane gives you several options that include the ability to save the script output, change the buffer size, and even print the output. To enable SERVEROUTPUT via the pane, you must select the green plus symbol and choose a database connection. You will see the correct script output if you run the script again after enabling DBMS_OUTPUT via one of the two options we have discussed. Figure 12-7 shows the Dbms Output pane.

Image

Figure 12-7. Dbms Output pane

Once a connection has been established using the Dbms Output pane, all DBMS_OUTPUT code that is executed against that connection will be displayed within the pane. It is possible to have more than one connection established within the pane, and in this case different tabs can be used to select the connection of your choice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.214.178