Skip to content
Advertisement

Use select inside ‘filename’ property of utl_file.fopen

I have a procedure that extracts data from a view and stores it on disc in CSV format. I’d like a name of the file to contain the most recent timestamp from table MY_TIMESTAMPS. For now it looks like this:

The part with (select to_char(max(EVENT_TS)) from MY_TIMESTAMPS) throws an error. How can I set this dynamic filename property? Maybe write it to some variable at beginning of the procedure? I tried to use DEFINE, but this errors as well.

Advertisement

Answer

Yes, you just might declare a variable in order to use within your select statement with an INTO clause added such as

where an exception handling is not needed for that SELECT statement.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement