Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> utl_file and newline?
Today I discovered something about utl_file and I just wanted to check with others to verify I'm right - my conclusion seems correct, but I find it difficult to believe this is the real behavior.
I had a job where I need to create a file from data in the database which has a specific format - lines must be EXACTLY 120 characters long and the last line must NOT have a newline at the end.
I initially thought utl_file would be fine for this as it has both put, put_line and new_line procedures. However, it seems for some difficult to understand logic that the fclose procedure will always append a newline if one does not exist. I find this strange - why give you control over the adding of newlines if the bloody package will just go and stick one on the end wether you want ti or not!
Has anyone else found this or is there something I'm missing? I've tried some experiments and from what I can work out, fclose will always add a newline at the end if one does not exist.
I've now come to the conclusion the only way I will be able to create this file is to write my data to a temporary table and then try creating the file as I want it via spool from within sqlplus. Anyone with a better solution?
Tim
-- Tim Cross The e-mail address on this message is FALSE (obviously!). My real e-mail is to a company in Australia called rapttech and my login is tcross - if you really need to send mail, you should be able to work it out!Received on Tue Feb 11 2003 - 02:48:35 CST