Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 377
  • Last Modified:

SQL in CSH script

How can incorporate some sql commands in a .csh file.
for example I want to run sqlplus and the desc a table.
thanks,
m3
0
m3
Asked:
m3
  • 2
1 Solution
 
ahoffmannCommented:
#! /bin/csh -f -b

echo "descr table;"  > /tmp/sql.cmd
echo "exit;"            >> /tmp/sql.cmd
sqlplus -s user/passwd @/tmp/sql.cmd
rm  /tmp/sql.cmd
0
 
m3Author Commented:
Could you explain what are the options -f -b for the cshell and -s for sqlplus? Thanks.
0
 
ahoffmannCommented:
man csh sqlplus  ;-)

          [-s[ilent]]
          Suppress all SQL*Plus information and prompt messages.

         [ -f]
         Starts without searching for or running commands from the
        .cshrc file in your home directory.

         [-b]
         End of option passed to csh itself. Allows passing options to
         the shell script itself (like -f or -c).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now