Home » SQL & PL/SQL » SQL & PL/SQL » SPOOL IN STORED PROCEDURE ORACLE
SPOOL IN STORED PROCEDURE ORACLE [message #112704] Mon, 28 March 2005 19:44 Go to next message
informatica_developer_mn
Messages: 2
Registered: March 2005
Junior Member
Hello every one,

Could any one of you tell me how do I spool the data from a stored procedure to file

My requirement is I have to generate a merge_into script on the fly.
I have to generate a script like. I was able to get the the column names and constraints from the data dictionary. I was able to do that using a shell script. but when it comes to stored proc, I was stuck in how do we spool the data in stored procedure

"MERGE INTO Table A
USING Table B
ON (a.y= b.y)
WHEN MATCHED THEN
UPDATE SET a.x = b.x
WHEN NOT MATCHED THEN
INSERT (a.x)
VALUES (b.x);
"

Thanks,
Re: SPOOL IN STORED PROCEDURE ORACLE [message #112709 is a reply to message #112704] Mon, 28 March 2005 20:23 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
You've tried this?

http://www.orafaq.com/scripts/plsql/utlfile.txt

you can also just use utl_file.put_line and avoid the \n formatting.
Previous Topic: How to calculate the size of table
Next Topic: having hard time writing a procedure
Goto Forum:
  


Current Time: Thu Dec 25 10:51:13 CST 2025