how to exec a procedure in Unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to exec a procedure in Unix
# 1  
Old 03-30-2004
how to exec a procedure in Unix

I am trying to execute a procedure in Unix:

Here is the deal:

I have created a procedure, which works fine,it runs via a Shell script. Now I want to execute that Procedure to it can update all the rows...

Currently have the following:
shell script:

sqlplus $ES_DB_STRING @$ES_PATH/code/other/Data_patches/T5_Update_corp.sql

Exit;

My procedure creates but its still stuck on SQLPLUS...the 'exit' part does not work

secondly I want to execute this so it updates rows.:

I havce used the following:

spool $ES_LOGS/T5_T5_Update_corp.log
Whenever SQLERROR EXIT 1
Whenever OSERROR EXIT 1

SET SERVEROUTPUT ON

BEGIN

T5_Update_corp;




END;
/
--*****************
--* END OF PL/SQL *
--*****************
--------------------------------------------------------------
-- Check if Exception record was created, if so, set the
-- exit code accordingly
--------------------------------------------------------------
set feedback off


set feedback on

spool off

exit

But returns the following:
' ERROR at line 3
ora -06550 line 3, column 3
pls -00201 idendifier 'T5_Update_corp must be declared
PLSQL STATEMENT IGNORED

hence it did not work, I just want to exec the above script as in

EXEC Update Corp: (all has to be uploaded automatically)
# 2  
Old 03-31-2004
If I understand what you want here is an example that has several lines of SQL in a shell script.

You are better off for long series of SQL commands to create
a sql script file - mycommands.sql and execute it inside sqlplus:
@mycommands

Code:
# ORACLE_HOME should be defined or sqlplus itself cannot run.

UIPW="username/password"
export UIPW

 echo $(date) " Truncating tables "
  {
    echo "set heading off"
    echo "set echo off"
    echo "truncate table rgenl;"    
    echo "truncate table bgenl;"
    echo "truncate table rfeed;"
    echo "truncate table rccnt;"
    echo "commit;"
    echo "exit;"
  } | $ORACLE_HOME/bin/sqlplus -s $UIPW

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recompile PL/SQL Procedure through UNIX

Hi, We have a procedure e.g. prc_synonym created in Oracle 12c Database. I want to do small change in procedure through Unix. I have that changed procedure (prc_synonym) in proc.sql file. Want to recompile that procedure through Unix so that changes should reflect in existing procedure in... (10 Replies)
Discussion started by: Aparna.N
10 Replies

2. Shell Programming and Scripting

How to KIll a Stored procedure invoked by UNIX?

Hi, I am using sql server 2008 version and invoking the stored procedure using unix script. I want to know the procedure of killing the stored procedure in sql server. If I kill -9 the unix script will it also terminate the process at the SQL server. When I executed the kill -9 PID in unix... (2 Replies)
Discussion started by: Rahul Raj
2 Replies

3. Shell Programming and Scripting

run oracle procedure in unix scripts

for j in $(du -h $1| awk '{printf("%100-s \n",$2)}') do for a in $(ls -time $(find $j -name '*.txt') | awk '{printf("\n%s %s %s %s %s",$4,$7,$8,$10,$11)}') do echo "$a">output.txt done done exit 0 echo "Password : xxxxxx " > LOG/BGH_$3.out (0 Replies)
Discussion started by: utoptas
0 Replies

4. UNIX for Dummies Questions & Answers

Calling stored procedure from unix

Hi, My stored procedure returns a value. How to retrieve the value and display in unix. Stored procedure CREATE OR REPLACE PROCEDURE gohan(num INT) IS BEGIN DBMS_OUTPUT.PUT_LINE('My lucky number is ' || num); END; Unix Scripting i used sqlplus -s... (7 Replies)
Discussion started by: gohan3376
7 Replies

5. Shell Programming and Scripting

Calling procedure through Unix Shell

how to 1) invoke batch profile to run sqlplus on XXXXX server. 2) execute truncate table xtra.xtra_card_email_request using procedure dbadmin.truncate_table . 3) Check the count before and after the job run. (1 Reply)
Discussion started by: jakred
1 Replies

6. Programming

Calling procedure through Unix Shell

Hi can anyone help me in how to 1) invoke batch profile to run sqlplus on XXXXX server. 2) execute truncate table xtra.xtra_card_email_request using procedure dbadmin.truncate_table . 3) Check the count before and after the job run. (1 Reply)
Discussion started by: jakred
1 Replies

7. UNIX for Dummies Questions & Answers

Running PL/SQL procedure via unix

All, I have a 10g PL/SQL procedure that needs to be run via a unix script. How could such a script be developed. Thanks Aditya. (1 Reply)
Discussion started by: kingofprussia
1 Replies

8. UNIX for Advanced & Expert Users

How to call SQL procedure from UNIX Shellscript ?

Hi All I would be thankful to you all if you will guide me the steps to call a stored proc. from unix shell script. that stored proc. could be parameterised or parameterless developed in SQL. Any info. in this topic would help me..... Thanks in advance.... (1 Reply)
Discussion started by: varungupta
1 Replies

9. UNIX for Dummies Questions & Answers

Installation Procedure of UNIX on a standalone pc

Hi, I am nil about UNIX and i want to learn about. For this i want to install UNIX 5.0 on my home pc. Anyone please tell me the procedure to install it. The partition and all etc. etc.. My pc configuration is P-IV, 1.7GHz 40 GB HDD With regards, Phani (1 Reply)
Discussion started by: phanikmv
1 Replies

10. UNIX for Dummies Questions & Answers

calling Oracle procedure from Unix

Does anyone know how to call an Oracle stored procedure from a Unix script? (1 Reply)
Discussion started by: ssmiths001
1 Replies
Login or Register to Ask a Question