Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: recovering data rows from PL/SQL scripts
man_at_sjoki.uta.fi wrote:
> (cut)
>
> However, I was wondering if I could force a PL/SQL procedure to
> print something to STDOUT?? dbms_output.put_line() does not
> work, since I can't give a "Set serveroutput on" -command
> in a perl script (nor in a PL/SQL procedure).
>
> So, simply: how do I force a PL/SQL procedure to print?
You can't ever force a PL/SQL procedure to print. dbms_output is just a big kludge. What the dbms_output.put_line() actually does is save the output in a temporary table and then send it to the SQL client.
However, kludge or not, the same strategy works just fine for debugging scripts that can't use dbms_output.
( forgive my pseudo code )
Create a logging table ahead of time.
CREATE TABLE MY_MESSAGES ( sequential-id-column, text_column ) ;
Add lines such as the following to your PL/SQL script.
INSERT INTO MY_MESSAGES ("This is what I want to print");
After running your script then examine the table
SELECT text_column from MY_MESSAGES order by sequential-id-column;Received on Fri Jul 23 1999 - 12:31:49 CDT
![]() |
![]() |