0

I have a select query in Oracle. I want to write query results in a txt file with CRLF (end of line) char. How can I do this?

2 Answers 2

2

You have multiple solutions:

Sign up to request clarification or add additional context in comments.

Comments

0

You can use the utl_file package. Code fragment:

l_output        utl_file.file_type;
l_output := utl_file.fopen( p_dir, p_filename, 'w' );
utl_file.put(l_output, 'Hello' );
...
utl_file.new_line( l_output );
utl_file.fflush( l_output );
utl_file.fclose( l_output );

First of all create a directory object (the p_dir parameter of the fopen) and grant it read and write privileges. See also at http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.