Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

create a text file from stored procedure

658086Mar 11 2010 — edited Mar 11 2010
hello,
I need to create a logfile with name YYYYMMDD.log into c:\mydir\MYPARAM\

In my oracle package I've written this (not working) code:



FUNCTION mysf (parm IN VARCHAR2) RETURN INTEGER IS

logfile utl_file.file_type;
myline VARCHAR2(200);
logdir VARCHAR2(200);
v_logfile VARCHAR2(50);

BEGIN

DBMS_OUTPUT.ENABLE;

logdir := 'c:\mydir\' || parm || '\';

sql_txt := 'SELECT TO_CHAR(sysdate, ''yyyymmdd'') FROM DUAL';
EXECUTE IMMEDIATE sql_txt INTO v_logfile;

logfile := utl_file.fopen(logdir, v_logfile || '.log', 'A');

myline := 'bla bla';
utl_file.put_line(logfile, myline);

...


but no file is created...anything....

what is my mistake?

thanks a lot

Edited by: itmick on 11-mar-2010 6.15

Edited by: itmick on 11-mar-2010 6.15

Edited by: itmick on 11-mar-2010 6.15
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2010
Added on Mar 11 2010
9 comments
13,019 views