Reading data from DataBase and Writing to a file

Hi All,

Please help me in writing data to a file in one row.

In database there is a column which contains large data which does not fit in the file in one row. The column contains list of paths. I want to write these paths to a file in one row.

Please find the code below writes :

sqlplus -s $DBCredentials  1> $myJobTaskAttribListFile   <<-EndOFSQL
 SET DEFINE OFF;
 SET SERVEROUT ON
 SET LINESIZE 3400;
 DECLARE
  i_job_id      NUMBER := $myJobId ;
  o_run_status_id    NUMBER := 0 ;
  i_end_time          VARCHAR2(1000) ;
  i_total_errors      NUMBER := 0 ;
  i_total_warnings    VARCHAR2(1000) ;
  i_total_inserted    NUMBER := 0 ;
  i_total_updated     NUMBER := 0 ;
  i_total_rejected    NUMBER := 0 ;
  i_log_file          VARCHAR2(1000) ;
  i_job_run_message   VARCHAR2(512) ;
  i_modlast_by        VARCHAR2(1000) ;
  o_sqlcode          NUMBER := 0 ;
  o_sqlmsg       VARCHAR2(1000) ;
 BEGIN
  $myUSPLoadJobTaskAttribs
  (
   i_job_id,
   o_run_status_id,
   o_sqlcode,
   o_sqlmsg 
  );
  
 END; 
 /
 EndOFSQL

I am getting Output as fallows..

1=XP|classpath|/usr/home/dfusr/lib/xalan.jar:
/usr/home/dfusr/lib/xerces.jar:
/usr/home/dfusr/lib/xml.jar:
/usr/home/dfusr/lib/classes12.zip:
/usr/home/dfusr/lib/DataFeed.jar:
/usr/home/dfusr/lib/pedf/MeetingAlertEmail.jar:
/usr/home/dfusr/lib/mailapi.jar:
/usr/home/dfusr/lib/pop3.jar:
/usr/home/dfusr/lib/activation.jar:
/usr/home/dfusr/lib/smtp.jar:
/usr/home/dfusr/lib/ADPModel.jar:
/usr/home/dfusr/lib/ADPUtil.jar:
/usr/home/dfusr/lib/ServiceLocator.jar:
/usr/home/dfusr/lib/log4j-1.2.8.jar:
/usr/home/dfusr/lib/toplink.jar:
/usr/home/dfusr/lib/xmlparserv2.jar

I want to write all the paths (at max 20) in one row as fallows.

1=Java|classpath|/usr/home/dfusr/lib/xalan.jar:/usr/home/dfusr/lib/xerces.jar:/usr/home/dfusr/lib/xmlparserv2.jar

Please help me in this regards

I set the LINESIZE of 3400 as above under sql but it not working

Thanks-
Rajesh

after you got the output , pipe line this to

cat file_name | tr '\n' ' '

Alternatively, you could tweak your SQL query to print all those values as a delimited string.

tyler_durden