Procedure execution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Procedure execution
# 1  
Old 06-04-2013
Procedure execution

Hi

I have four procedure .I want to execute one by one in unix

Code:
PROCEDURE 1
PROCEDURE 2
PROCEDURE 3
PROCEDURE 4

it should execute in such a way that if PROCEDURE 1 finish successfully only , it should go and execute the procedure 2 , else I need to exit from the script by echo the error

Can some one help me here

Last edited by Scott; 06-04-2013 at 07:11 AM.. Reason: Code tags
# 2  
Old 06-04-2013
Code:
PROCEDURE 1 &&
PROCEDURE 2 &&
PROCEDURE 3 &&
PROCEDURE 4 || echo error

Code:
       A list is a sequence of one or more pipelines separated by one of the operators ;, &, &&, or ||, and optionally
       terminated by one of ;, &, or <newline>.

       Of these list operators, && and || have equal precedence, followed by ; and &, which have equal precedence.

       A sequence of one or more newlines may appear in a list instead of a semicolon to delimit commands.

       If  a  command  is  terminated by the control operator &, the shell executes the command in the background in a
       subshell.  The shell does not wait for the command to finish, and the return status is 0.   Commands  separated
       by  a ; are executed sequentially; the shell waits for each command to terminate in turn.  The return status is
       the exit status of the last command executed.

       The control operators && and || denote AND lists and OR lists, respectively.  An AND list has the form

              command1 && command2

       command2 is executed if, and only if, command1 returns an exit status of zero.

       An OR list has the form

              command1 || command2

Of course, I've made an assumption about what you mean by PROCEDURE - i.e. in what context are you using procedures? Shell? Database? Some other language?
# 3  
Old 06-04-2013
Thanks..

Actually I am using a oracle procedure here
# 4  
Old 06-04-2013
Procedures don't return values. Perhaps you'd need to set something, perhaps a global variable to indicate success or failure of each procedure. Otherwise, use functions.

I'll see if I have a VM handy with Oracle installed, and play around. I'll report back!
# 5  
Old 06-04-2013
You have to use
Code:
WHENEVER SQLERROR EXIT SQL.SQLCODE

this will make sure you will exit from Oracle session if any of your procedure encounter with any SQL error code.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Parallel execution of Oracle procedure in UNIX

i have say x number of procedure to run, ie i have one procedure which accepts variable and i need that to run in parallel and capture the error code if in case if it fails through the unix. sqlplus <EOF> exec test_t (abc,124); </EOF> sqlplus <EOF> exec test_t (abc,125); </EOF> sqlplus <EOF>... (2 Replies)
Discussion started by: ATWC
2 Replies

2. Shell Programming and Scripting

Invoke Procedure Help

Hello unix.com users, I reached a dead end with a procedure. My files: x.pl #!/usr/bin/perl use Net::FTP; my $host = $ARGV; my $user = $ARGV; my $pass = $ARGV || ""; my $port = "21"; $ftp=Net::FTP->new("$host", Port=>"$port", Timeout => 5) or die("couldn't connect to host:" .... (2 Replies)
Discussion started by: galford
2 Replies

3. Solaris

php installation procedure..

hi.. i need to install or enable php on my solaris server.. i have successfully enabled my apache .. guide me to enable php .. (3 Replies)
Discussion started by: senkerth
3 Replies

4. Solaris

Help with Booting procedure

Hello guys, I am a newbie to solaris 10. Recently I was going through booting procedure of solaris 10 on sparc machines, there I was not clear with kernel phase because I read like /etc/system file is read by kernel even before root filesystem is loaded, How is it possible?? Please Help me... (4 Replies)
Discussion started by: praveen12
4 Replies

5. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

6. Programming

help remote procedure call

i am beginig with unix c code for sun remote procedure call to do the following: 1- The clients reads in a variable length array from the command line 2- The client offers a menu for the user to choose what to do with the array: a. Sort the array b. Add the array c. Find max d. Find... (1 Reply)
Discussion started by: auto2000
1 Replies

7. Programming

To take a backup of a procedure

Hi All, Can anyone let me know how to take a backup of a procedure in TOAD? For table backup we can use the following query create table newtablename as select * from originaltablename; But the above query wont works for procedure backup since u need to give IN or OUT parameters... (0 Replies)
Discussion started by: Ashok_oct22
0 Replies

8. Shell Programming and Scripting

calling procedure from script

Hi All, My script will call a storedprocedure #!/bin/bash # # Script for ........... . ../conf/setting.env # Environment file to set the DATABASE #TODAY=`date '+%Y%m%d_%H'` #echo TODAY = $TODAY sqlplus -s $DATABASE <<EOF spool $TRACKING_LOGDIR/CalcFreqPgsVues_H.log exec... (3 Replies)
Discussion started by: scorpio
3 Replies

9. HP-UX

Installation Procedure..

Hi, iam just starting to learn the HP-UX please help me about how to install the unix in HP9000 sever and drivers installation procedure. Thank you, Ramana.s (2 Replies)
Discussion started by: mcseramana
2 Replies

10. Solaris

Back-up Procedure

Hi Friendz, How to backup 40GB of data to a DLT TAPE device? How am i going to configure my backup device? Is it possible to backup more than 40GB of data to a TAPE? regards, daemons_advoc8 (1 Reply)
Discussion started by: daemons_advoc8
1 Replies
Login or Register to Ask a Question