<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Spool Data in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773381#M783207</link>
    <description>If you don't set feeback off - the actual query will return the number of rows selected.  Then you can reformat the&lt;BR /&gt;"1 row selected"&lt;BR /&gt;statement to be whatever you need - just a number.  It will require a little formatting after the query completes, but it will eliminate reading all the data again to get the count.&lt;BR /&gt;&lt;BR /&gt;Patti</description>
    <pubDate>Tue, 18 Apr 2006 14:41:54 GMT</pubDate>
    <dc:creator>Patti Johnson</dc:creator>
    <dc:date>2006-04-18T14:41:54Z</dc:date>
    <item>
      <title>Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773374#M783200</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have to spool 1.5 million records into a flat file.&lt;BR /&gt;&lt;BR /&gt;First line (header record) in the spool file needs to be current date (YYYYMMDD)&lt;BR /&gt;&lt;BR /&gt;starting second line till end of result set&lt;BR /&gt;is whatever returned by my actual query.&lt;BR /&gt;&lt;BR /&gt;Last (Trailer) line should be the total count of records in the flat file. Excluding header and trailer records.&lt;BR /&gt;&lt;BR /&gt;I tried using UNION...but the order getting changed and header record comes somewhere in between of the actual query result and same with trailer record too..i guess its sorting &lt;BR /&gt;implicitly..how to get it in same order?&lt;BR /&gt;&lt;BR /&gt;Select &lt;DATE&gt; from dual&lt;BR /&gt;union&lt;BR /&gt;actual query&lt;BR /&gt;union &lt;BR /&gt;Select count(*) from &lt;ACTUAL query=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/ACTUAL&gt;&lt;/DATE&gt;</description>
      <pubDate>Tue, 18 Apr 2006 11:00:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773374#M783200</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-04-18T11:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773375#M783201</link>
      <description>Just use individual queries.&lt;BR /&gt;&lt;BR /&gt;set feedback off&lt;BR /&gt;set heading off&lt;BR /&gt;set pages 0&lt;BR /&gt;select sysdate from dual;&lt;BR /&gt;select * from dual;&lt;BR /&gt;select count(*) from dual;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;returns these three lines&lt;BR /&gt;&lt;BR /&gt;18-APR-06&lt;BR /&gt;X&lt;BR /&gt;         1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Patti&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 11:39:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773375#M783201</guid>
      <dc:creator>Patti Johnson</dc:creator>
      <dc:date>2006-04-18T11:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773376#M783202</link>
      <description>ok.&lt;BR /&gt;&lt;BR /&gt;This is my problem... this is how the order changes..&lt;BR /&gt;&lt;BR /&gt;select to_char(sysdate,'YYYYMMDD') from dual&lt;BR /&gt;union&lt;BR /&gt;select 'ABCD' from dual&lt;BR /&gt;union&lt;BR /&gt;Select to_char(12345) from dual&lt;BR /&gt;&lt;BR /&gt;my actual query return character type data.</description>
      <pubDate>Tue, 18 Apr 2006 11:50:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773376#M783202</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-04-18T11:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773377#M783203</link>
      <description>Sorry...i got your point...&lt;BR /&gt;&lt;BR /&gt;Just ignore union and run as 3 queries..&lt;BR /&gt;&lt;BR /&gt;OK thanks...let me try it.</description>
      <pubDate>Tue, 18 Apr 2006 11:52:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773377#M783203</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-04-18T11:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773378#M783204</link>
      <description>You'll need to aggregate the result of the union as a sub-query, and add a fake order by column (1,2,3) external to that subquery.  Then that whole thing above is treated once again a subquery, and only the dates themselves are drawn out from the level 2 subquery.&lt;BR /&gt;&lt;BR /&gt;Basically, you need a subquery that is ordered outside of the union, but from stubbed data from inside the union, and then in the outermost query, just don't select the stubbed data as part of the result set.&lt;BR /&gt;&lt;BR /&gt;select a&lt;BR /&gt;from&lt;BR /&gt;(select a,aa&lt;BR /&gt;from&lt;BR /&gt;(select to_char(sysdate,'YYYYMMDD') a , 1  aa from dual&lt;BR /&gt;union&lt;BR /&gt;select 'ABCD' a ,2 aa  from dual&lt;BR /&gt;union&lt;BR /&gt;select to_char(12345) a ,3 aa from dual)&lt;BR /&gt;order by 2)&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;A&lt;BR /&gt;--------&lt;BR /&gt;20060418&lt;BR /&gt;ABCD&lt;BR /&gt;12345&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 12:38:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773378#M783204</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2006-04-18T12:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773379#M783205</link>
      <description>yes...i tried this way first ...but it takes around 1.5 hrs to complete...may be bcos of to_char and then order by..&lt;BR /&gt;&lt;BR /&gt;if i run as 3 seperate queries..it only takes 15-20mins...i dont need to put to_char or order by .. still testing ...will&lt;BR /&gt;update time and performance.</description>
      <pubDate>Tue, 18 Apr 2006 12:47:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773379#M783205</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-04-18T12:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773380#M783206</link>
      <description>it takes around 25 mins to spool the file (1.5 million records).. order is coming as i expect ..so fine.&lt;BR /&gt;&lt;BR /&gt;Select &lt;DATE&gt; from dual&lt;BR /&gt;union&lt;BR /&gt;actual query&lt;BR /&gt;union &lt;BR /&gt;Select count(*) from &lt;ACTUAL query=""&gt;&lt;BR /&gt;&lt;BR /&gt;actual query ==&amp;gt; returns 1.5 million records &lt;BR /&gt;and takes the most part of execution time.&lt;BR /&gt;&lt;BR /&gt;Select count(*) from &lt;ACTUAL query=""&gt;  ==&amp;gt;&lt;BR /&gt;again has to run the same query(almost alike my actual query) again to find the count.&lt;BR /&gt;&lt;BR /&gt;IS there a way i can avoid third query and get the count from / while running my second query ?&lt;BR /&gt;&lt;BR /&gt;Hope i didnt confuse.&lt;BR /&gt;&lt;BR /&gt;&lt;/ACTUAL&gt;&lt;/ACTUAL&gt;&lt;/DATE&gt;</description>
      <pubDate>Tue, 18 Apr 2006 14:17:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773380#M783206</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-04-18T14:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773381#M783207</link>
      <description>If you don't set feeback off - the actual query will return the number of rows selected.  Then you can reformat the&lt;BR /&gt;"1 row selected"&lt;BR /&gt;statement to be whatever you need - just a number.  It will require a little formatting after the query completes, but it will eliminate reading all the data again to get the count.&lt;BR /&gt;&lt;BR /&gt;Patti</description>
      <pubDate>Tue, 18 Apr 2006 14:41:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773381#M783207</guid>
      <dc:creator>Patti Johnson</dc:creator>
      <dc:date>2006-04-18T14:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773382#M783208</link>
      <description>how to capture that "1 Row Selected"&lt;BR /&gt;and add it as last record in the spool file ?&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 14:45:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773382#M783208</guid>
      <dc:creator>intp</dc:creator>
      <dc:date>2006-04-18T14:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Spool Data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773383#M783209</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;One easy way would be to use grep after you have finished spooling the output to your file.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;grep -v "1 row selected" filename.lis &amp;gt; newspoolfile.lis&lt;BR /&gt;echo "1 row selected" &amp;gt;&amp;gt; newspoolfile.lis&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps too!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Tue, 18 Apr 2006 23:39:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spool-data/m-p/3773383#M783209</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2006-04-18T23:39:00Z</dc:date>
    </item>
  </channel>
</rss>

