Simple question, is it possible to give an alias to the output function in the question title so that I can call something like trace('hello') rather than DBMS_OUTPUT.PUT_LINE('hello')?
I would like this because I use output to help with debugging and I am tired of typing that whole function name out and/or copy and pasting it all the time.
Thanks for your time.
The Oracle dbms_output. put_line procedure allows you to write data to flat file or to direct your PL/SQL output to a screen.
put_line doesn't work inside function.
BEGIN dbms_output. put_line('Hello world! '); END; You can run this by pressing F5, or clicking Run Script.
The DBMS_OUTPUT package enables you to send messages from stored procedures, packages, and triggers. The PUT and PUT_LINE procedures in this package enable you to place information in a buffer that can be read by another trigger, procedure, or package.
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;
Usage:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With