My requirement is that i have to write a stored procedure in db2 and that will be executed in a batch file . Any system error or validation error that occurs inside the db2 sp during the execution need to be written in external flat file ( Log file to know the error ) .
Is there anything similar in db2 like UTL_FILE in oracle .
Please find the sample coding in oracle which will write the output to a external flat file .
SAMPLE ORACLE CODE :
Expand|Select|Wrap|Line Numbers
- BEGIN
- -- variable declaration
- log_file UTL_FILE.FILE_TYPE;
- -- external flat file open
- log_file := UTL_FILE.FOPEN( ‘c:/’, 'filename.log', 'w' );
- -- write to the external flat file
- UTL_FILE.put_line(log_file,' write the output to the flat file '));
- -- close the external flat file
- UTL_FILE.FCLOSE(log_file);
- END
Sathiyamurthy