Click to See Complete Forum and Search --> : Oracle PLSQL formating Question..


JMS
May 12th, 2004, 01:27 PM
I have a questoin about formating data in sqlplus. I'm dumping the ouput of the sqlpus to a file. If I can get the data formated correctly to the file then I can read the entire record set off of the hard drive and into my array with one C++ fread statement which will be very fast and which I know how to do.... What I don't know how to do is formate the sql output correctly..

example Oracle Querry....

select object_type, status, generated from user_objects;

-----Problem----
I need to be able to be able to return the three fields of data
1) each field is NULL terminated instead of space terminated
2) each field is padded with NULL for the rest of the string's length instead of padded with spaces.


here is what I have so far ......which doesn't work doesn't recognize the CHR(0) as a NULL because it doesn't show up at all..


SELECT RPAD( OBJECT_TYPE, 19, CHR(0)),
RPAD( STATUS, 8, CHR(0)),
RPAD(GENERATED,2,CHR(0)) FROM USER_OBJECTS;


Any help would be greately appreciated..