-
Can any one tell me how can I writh to a local file (C:/my_file.txt) from a procedure. I need to create sql statments and store them in a file for later execution.
I need to do this into a LOCAL file so I don't think that I can use UTL_FILE, is there any way to spool from a proc to a file??? or any other way to do this???
Thanks.
-
Have you looked at DBMS_OUTPUT?
Assuming you are running your procedure from SQL*Plus,
you should be able to do what you want.
enter the following in SQL*Plus :
spool c:\my_file.txt
set serveroutput on
-- this is the buffer size for the text
-- you are going to output from your
-- procedure. make it bigger if you need to.
execute dbms_output.enable(100000);
-- call your procedure...
execute my_procedure;
-- turn off dbms_output
set serveroutput off;
spool off;
in your procedure, you can spool text like this :
dbms_output.put_line('whatever');
-
thanks jdorlon, I know about dbms_output but I wanted to have a "cleaner" way of doing it, I want the user to just execute the procedure and a file will be writen.
-
Have u tried "text_io" package?
Take care
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|