PL / SQL alias for DBMS_OUTPUT.PUT_LINE ()?

A simple question: is it possible to give an alias of the output function in the title of the question so that I can name something like trace ('hello'), and not DBMS_OUTPUT.PUT_LINE ('hello')?

I would love it because I use output to help with debugging, and I'm tired of typing all this function name and / or copy and paste it all the time.

Thank you for your time.

+4
source share
2 answers

Just create a procedure to wrap the call:

create or replace procedure trace(v_message in VARCHAR2) as begin dbms_output.put_line(v_message); end; 

Using:

 SQL> begin 2 trace('hello'); 3 end 4 ; 5 / PL/SQL procedure successfully completed. SQL> set serverout on size 1000000 SQL> / hello PL/SQL procedure successfully completed. 
+7
source

Use a macro to enter it for you.

I use PLSQL Developer and whenever I need dbms_output.put_line , I type ctrl-D. Thus, I should not depend on the existence of a function with a shorter name. He just works on what I'm working on.

+2
source

All Articles