Re: SQLPLUS script

From: Kim Ng <kimmng_at_uswnvg.com>
Date: 10 Aug 94 15:59:29 GMT
Message-ID: <33402_at_uswnvg.uswnvg.com>


David E. Farrell (defarre_at_somnet.sandia.gov) wrote:
: Is there a way to setup an automatic sqlplus script. What we want to do is
: to just run a script that logs in does an alter then gets back out and
: runs another caommand and then logs back in to do another alter. We tried
: to do simple redirection of a file with our user-name and password
: followed by the commands, but this did not work. (sqlplus < commandfile)
: We can of course run this by hand but it needs to run once a week in the
: early A.M. and we would like to automate it using cron.
: Any help would be appreciated. Please respond to defarre_at_envc.sandia.gov
: Thanks,
: Later...Dave

If you're running it in Unix, you can always write a shell script with input redirection such as:

   .
   . (Unix script, if any)
   .

   sqlplus -s / <<EOF
   .
   . (your sql script here)
   .

   exit
   EOF
   .
   . (Unix script, if any)
   .

Note: the line "sqlplus ...." can have other stuff such as redirect error, etc.
      Don't put any blank line within your sql script lines. ORACLE will
      interpret that as a break in the input mode and stops (just like when
      you type in your script in SQLPLUS).
      The shell will stops your input line when it encounter EOF. You can
      change this to any character combination you want. Just make sure
      you change it at both spots.

Have fun.



 Kim Ng
 (Just a low life contract programmer. Thus, my clients won't adopt my views.) Received on Wed Aug 10 1994 - 17:59:29 CEST

Original text of this message