<?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: SQL query in CRONTAB in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875536#M937487</link>
    <description>Oracle example.&lt;BR /&gt;Put an entry in crontab similar to: &lt;BR /&gt; 00 15 * * 1-5 su - oracle -c "/path/script" &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;The script should be something like:&lt;BR /&gt;sqlplus /nolog &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;select * from ....&lt;BR /&gt;select ...&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Raimo</description>
    <pubDate>Tue, 07 Jan 2003 09:55:27 GMT</pubDate>
    <dc:creator>Raimo Lesonen_1</dc:creator>
    <dc:date>2003-01-07T09:55:27Z</dc:date>
    <item>
      <title>SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875529#M937480</link>
      <description>Hi,&lt;BR /&gt;I want to get the data from a table and put them into a file (in the Operating System). I have a database over a Unix System. What's the command that do I have to ejecute?&lt;BR /&gt;&lt;BR /&gt;Then, this command I want to program it in the crontab.&lt;BR /&gt;&lt;BR /&gt;Thank you very much!!!&lt;BR /&gt;&lt;BR /&gt;Programming a command SQL in the crontab</description>
      <pubDate>Mon, 06 Jan 2003 21:00:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875529#M937480</guid>
      <dc:creator>Christian Aguilar Varga</dc:creator>
      <dc:date>2003-01-06T21:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875530#M937481</link>
      <description>Look into writing a perl script:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.princeton.edu/~storacle/perldbi.shtml" target="_blank"&gt;http://www.princeton.edu/~storacle/perldbi.shtml&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 06 Jan 2003 21:03:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875530#M937481</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2003-01-06T21:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875531#M937482</link>
      <description>Perl or shell scripting is the way to go.  I am posting an example.&lt;BR /&gt;&lt;BR /&gt;oracle/oracle@jufprod&lt;BR /&gt;&lt;BR /&gt;Thats your oracle user id, oracle password and instance name.&lt;BR /&gt;&lt;BR /&gt;Obviously, this is not a great thing to have in a script.&lt;BR /&gt;&lt;BR /&gt;The book Perl Cookbook has methodology for dealing with the security issues in a better way.&lt;BR /&gt;&lt;BR /&gt;And no, our oracle password is not oracle, just in case anyone wants to point out the obvious.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Mon, 06 Jan 2003 22:09:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875531#M937482</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-01-06T22:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875532#M937483</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;I have a script that convert a Oracle table into a flat file.&lt;BR /&gt;E.g.&lt;BR /&gt;============================================================&lt;BR /&gt;L-oracle8i: home/yd/flat&amp;gt;flat.sh scott/tiger emp&lt;BR /&gt;7369    SMITH   CLERK   7902    17/12/1980      968             20&lt;BR /&gt;7499    ALLEN   SALESMAN        7698    20/02/1981      1600    300     30&lt;BR /&gt;7521    WARD    SALESMAN        7698    22/02/1981      1250    500     30&lt;BR /&gt;7566    JONES   MANAGER 7839    02/04/1981      2975            20&lt;BR /&gt;7654    MARTIN  SALESMAN        7698    28/09/1981      1250    1400    30&lt;BR /&gt;7698    BLAKE   MANAGER 7839    01/05/1981      2850            30&lt;BR /&gt;7782    CLARK   MANAGER 7839    09/06/1981      2450            10&lt;BR /&gt;7788    SCOTT   ANALYST 7566    09/12/1982      3000            20&lt;BR /&gt;7839    KING    PRESIDENT               17/11/1981      5000            10&lt;BR /&gt;7844    TURNER  SALESMAN        7698    08/09/1981      1500    0       30&lt;BR /&gt;7876    ADAMS   CLERK   7788    12/01/1983      1100            20&lt;BR /&gt;7900    JAMES   CLERK   7698    03/12/1981      950             30&lt;BR /&gt;7902    FORD    ANALYST 7566    03/12/1981      3000            20&lt;BR /&gt;7934    MILLER  CLERK   7782    23/01/1982      1300            10&lt;BR /&gt;9876    REEVES  ANALYST 7839    12/01/2085      3000    200     60&lt;BR /&gt;7999    PIERO   CLERK   7839    20/02/1999      2000            30&lt;BR /&gt;7991    RAUL    CLERK   7839    12/05/1991      1200            61&lt;BR /&gt;7989    HESKEY                          1000            20&lt;BR /&gt;&lt;BR /&gt;============================================================&lt;BR /&gt;Scripts are attached.&lt;BR /&gt;&lt;BR /&gt;Now, if you want to "cron" it:&lt;BR /&gt;(the easiest way will be to use root account and switch user to run this script)&lt;BR /&gt;============================================================&lt;BR /&gt;# crontab -l    &lt;BR /&gt;#*******************************************************************************&lt;BR /&gt;# min|hour |day  |month|day  |script&lt;BR /&gt;#    |     |of mo|     |of wk|&lt;BR /&gt;#----|-----|-----|-----|-----|--------------------------------------------------&lt;BR /&gt;00,30 08,09  *     *     *    echo "/home/yd/flat/flat.sh scott/tiger emp dept &amp;gt; /home/yd/flat/myflatfile.txt"|su - oracle8i 1&amp;gt;/home/yd/flat/logfiles/output-flat.crn 2&amp;gt;/home/yd/flat/logfiles/error-flat.crn&lt;BR /&gt;#*******************************************************************************&lt;BR /&gt;# END OF TABLE           day0-&amp;gt;Sunday  day6-&amp;gt;Saturday&lt;BR /&gt;#*******************************************************************************&lt;BR /&gt;============================================================&lt;BR /&gt;(NB. this cronjob "exports" 2 tables emp and dept)&lt;BR /&gt;&lt;BR /&gt;The output can also be formatted for Excel or any spreadsheet that understands the industry standard SYLK file format or even in SQLLOADER format that can be used to import in another database.&lt;BR /&gt;&lt;BR /&gt;If you need any further help, please let use know.&lt;BR /&gt;&lt;BR /&gt;Hope this helps!&lt;BR /&gt;Best Regards&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Tue, 07 Jan 2003 05:08:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875532#M937483</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-01-07T05:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875533#M937484</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;forgot the attachments and sorry for the formatting of the output ;)&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Tue, 07 Jan 2003 05:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875533#M937484</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-01-07T05:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875534#M937485</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;the second file&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Tue, 07 Jan 2003 05:14:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875534#M937485</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-01-07T05:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875535#M937486</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;the second file&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Tue, 07 Jan 2003 05:14:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875535#M937486</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-01-07T05:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875536#M937487</link>
      <description>Oracle example.&lt;BR /&gt;Put an entry in crontab similar to: &lt;BR /&gt; 00 15 * * 1-5 su - oracle -c "/path/script" &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;The script should be something like:&lt;BR /&gt;sqlplus /nolog &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;select * from ....&lt;BR /&gt;select ...&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Raimo</description>
      <pubDate>Tue, 07 Jan 2003 09:55:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875536#M937487</guid>
      <dc:creator>Raimo Lesonen_1</dc:creator>
      <dc:date>2003-01-07T09:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875537#M937488</link>
      <description>Hi, yogeeraj:&lt;BR /&gt;Thank you by your suggestions.&lt;BR /&gt;I send a report about the table that I want to analize.&lt;BR /&gt;How Can I adapt it in your script flat.sh, Please?&lt;BR /&gt;&lt;BR /&gt;I'd like that you send me the script with these parameters.&lt;BR /&gt;&lt;BR /&gt;Thank you very much!!!</description>
      <pubDate>Tue, 07 Jan 2003 14:43:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875537#M937488</guid>
      <dc:creator>Christian Aguilar Varga</dc:creator>
      <dc:date>2003-01-07T14:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875538#M937489</link>
      <description>Hi Christian,&lt;BR /&gt;&lt;BR /&gt;You can spool the output of the select statements into a text file in the file system.&lt;BR /&gt;Eg:- Logon to SQLPLUS and the at the SQL prompt type this.&lt;BR /&gt;&lt;BR /&gt;Spool test_report.txt&lt;BR /&gt;select &lt;FIELD_NAME&gt;&lt;/FIELD_NAME&gt;from table_name&lt;BR /&gt;where &lt;CONDITON&gt;;&lt;BR /&gt;spool off&lt;BR /&gt;When you exit from SQLPLUS you list for  test_report.txt file, you will see az text file and this will have the selected field name. You can format them as well.&lt;BR /&gt;&lt;BR /&gt;Then cron job this script with the complete path to be executed daily / weekly.... depending on your requirements.&lt;/CONDITON&gt;</description>
      <pubDate>Wed, 08 Jan 2003 06:54:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875538#M937489</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2003-01-08T06:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875539#M937490</link>
      <description>I am sending an attachment as an example. Hope this helps.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Indira</description>
      <pubDate>Wed, 08 Jan 2003 07:07:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875539#M937490</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2003-01-08T07:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query in CRONTAB</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875540#M937491</link>
      <description>hi Christian,&lt;BR /&gt;&lt;BR /&gt;For the changes you are requesting, i think it will be preferable to create a view and use the script i sent you - This will not incur any changes in the scripts!&lt;BR /&gt;&lt;BR /&gt;E.g.&lt;BR /&gt;create or replace view v_equipoid_101 as&lt;BR /&gt;select nombreequipo from equipo where idtipoequipo=101;&lt;BR /&gt;&lt;BR /&gt;then use argument "v_equipoid_101" to the "flat" script!&lt;BR /&gt;&lt;BR /&gt;Let me know if ok.&lt;BR /&gt;&lt;BR /&gt;Also, if you post additional information on what you are planning to with the file, maybe i can suggest other alternatives.&lt;BR /&gt;&lt;BR /&gt;Hope this help!&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Yogeeraj &lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jan 2003 07:26:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sql-query-in-crontab/m-p/2875540#M937491</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-01-08T07:26:23Z</dc:date>
    </item>
  </channel>
</rss>

