Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: UNIX script problem with sqlplus

Re: UNIX script problem with sqlplus

From: <cary_at_nams.net>
Date: Thu, 20 Aug 1998 16:16:31 GMT
Message-ID: <6rhi51$ije$1@nnrp1.dejanews.com>


In article <tics28-2008980831120001_at_tics28.sps.mot.com>,   tics28@"spam-off"email.sps.mot.com (Alan Long) wrote:
> I have a unix file temp1.sql containing:
>
> spool temp1
>
> select part_id
> from product
> ;
>
> spool off
>
> I want to run this automatically using crontab, so I have a unix file
temp1.run
> containing:
>
> . ~/.profile
> sqlplus userid/password < temp1.sql
> mail tics28_at_email.sps.mot.com < temp1.lst
>
> This essentially works but temp1.lst contains:
>
> SQL>
> SQL> select part_id
> 2 from product
> 4 ;
>
> PART_ID
> -----------------------------------
> A/32
> SQL>
> SQL> spool off
>
> How can I suppress the SQL prompts and the sqlplus code from the output,
> so that I only get the data? When I run temp1.sql from within sqlplus, the
> output file temp1.lst just contains:
>
> PART_ID
> -----------------------------------
> A/32
>
> As is probably quite obvious, I don't have a lot of UNIX ability!
>
> --
> Alan Long
> Materials Systems Group
> Motorola, East Kilbride, Scotland
> email tics28@"spam-off"email.sps.mot.com (remove the "spam-off")
>

Hello,

     An easy way to rid yourself of these nuisance prompts is to run the temp1.lst file through the Unix sed (stream editor) utility after it has been generated and before you mail it off:

      . ~/.profile
      sqlplus userid/password < temp1.sql
      mv temp1.lst dummy.lst
      sed '/^SQL/ d' dummy.lst > temp1.lst
      rm dummy.lst
      mail tics28_at_email.sps.mot.com < temp1.lst

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Thu Aug 20 1998 - 11:16:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US