SQL Developer has a DBMS Output panel you can open and add to your desktop. You then add a connection you want to poll, and then you enable polling. It’s about 4 clicks. If you want to increase the default buffer size from 20,000 characters, then that’s a few more clicks and keystrokes.

A friend of the blog (Thanks Koen!)…


… suggested I share his favorite trick: using a code template to automatically enable serveroutput – which will show you anything your sessions puts to DBMS_OUTPUT.

SET SERVEROUT[PUT] {ON | OFF} [SIZE {n | UNL[IMITED]}] [FOR[MAT] {WRA[PPED] | WOR[D_WRAPPED] | TRU[NCATED]}]
Controls whether to display the output (that is, DBMS_OUTPUT PUT_LINE) of stored procedures or PL/SQL blocks in SQL*Plus.

To save typing that in, use a SQL Editor CODE TEMPLATE.

You could use a code snippet, but then you’ll have to open the snippets panel, find it, and then drag and drop it to your desktop.

note the name I use in the first column, that's how we get to it later
note the name I use in the first column, that’s how we get to it later

Ok, I want me some serveroutput, and I want to clear the script output ‘screen.’

start typing the name of the template, and then use ctrl+spacebar to activate
start typing the name of the template, and then use ctrl+spacebar to activate

Run the script/F5…and then you’ll see your output.

EZ PZ
EZ PZ

There’s an Easier Way

Now this method is a wee bit more like brute force. I’ve talked about this before. You enable SERVEROUTPUT by default for every session you open in SQL Developer.

And I’ve talked more in depth about code templates before as well – besides Reports, maybe the least-utilized/most-powerful features in all of SQL Developer in terms of saving you time and making your life easier.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment