Looking for "integrating sqlplus/ksh" resources

Can someone direct me to some good resources that have examples of integrating sqlplus execution inside a Korn Shell script.
I need to:
- Pass sqlplus success/fail status back to the ksh.
- Trap sql errors in my ksh application and perform "ksh" conditional logic on these errors.
- Toggle back and forth between ksh execution and sqlplus.
- Run and capture stored procedure results (hopefully same as std SQL query).

I'm a Windows programmer by trade so much of this is "Greek" to me.

Operating system is (I believe...)HP-UX V.5.1 1885 alpha
DB is Oracle 8i

Thanks for your help.
GeekManAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ellesdCommented:
If you are running sqlplus from the script, you will need to test the $? variable for success or failure (0 is success and non-zero is failure:

if [ "$?" -eq 0 ]
then
  SUCCESS CODE
else
  FAILURE CODE
fi

You need a space after the [ and before the ].

If you are trying to execute certain code based on certain errors returned, you will put a case statement in the FAILURE CODE section:

case $?
in
  1)
     cmd1
     cmd2
     ;;
  2)
     cmd3
     cmd4
     ;;
  *)
     default code
     ;;
esac

Obviously you put your desired error codes in place of the 1, 2, and so on (list as many as you are checking).  Replace the cmd1, cmd2, ... with your desired commands.
The two semicolons are required to end execution of that particular set of commands.  The *) case is to catch any value you did not account for and run whatever commands you want for that situation.

Elaborate on the rest and I should be able to assist some more.
0
ellesdCommented:
Oh, forgot to mention that you can get alot of the info you need by reading the man page on ksh:

man ksh

Run from unix prompt obviously.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GeekManAuthor Commented:
Thanks for your help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

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.