Spool/Write SELECT results to a file in PL/SQL?
705974Jul 23 2009 — edited Jul 28 2009I am trying to write out the results of a SELECT statement to a file. I was told that SPOOL is not a PL/SQL command so I guess I can't use it. How can I write out the results of a SELECT statement to a file, while in PL/SQL. The reason why I'm using PL/SQL is because I have multiple functions. I also need to perform and UPDATE as a separate function. Here is a simplified example of what I am trying to do
BEGIN
SELECT user_id, username, description
from fnd_users;
END;
BEGIN
UPDATE fnd_users
SET enabled_flag = "Y"
WHERE user_id = "1234";
END;
COMMIT;
If I'm trying to spool/write the SELECT statement to a file, how can I accomplish this. I do not want to break up these 2 functions because I want to register the pl/sql file as one concurrent program to complete both tasks when run. (Note: This is a simplified version of what I'm doing in reality, so I'm not trying to update the fnd_users table.)
Your guidance/advice is very much appreciated.