Sponsored Content
Top Forums Shell Programming and Scripting how to call oracle stored procedure from unix shell Post 302399179 by SFNYC on Friday 26th of February 2010 02:51:02 PM
Old 02-26-2010
UTL_FILE won't work if his database is running on a different machine than his shell script.

Try this.

Code:
$ cat use_oracle_proc.ksh
#!/bin/ksh

run_sql()
{
  $ORACLE_HOME/bin/sqlplus -S $scott@dbase/tiger <<EOF
  SET PAGESIZE 0;
  SET FEEDBACK OFF;
  SET SERVEROUT ON;
  VAR major NUMBER;
  VAR minor NUMBER;
  EXEC DBMS_PROFILER.GET_VERSION (:major, :minor);
  PRINT major;
  PRINT minor;
EXIT;
EOF
}

set -A ARRAY $(run_sql)
ARRAYCOUNT=${#ARRAY[*]}
ARRAYIDX=0

while (( $ARRAYIDX < $ARRAYCOUNT ))
do
 echo  "ARRAY[$ARRAYIDX]=(${ARRAY[ARRAYIDX]})"
 ARRAYIDX=$(($ARRAYIDX+1))
done

exit 0

$ ./use_oracle_proc.ksh
ARRAY[0]=(2)
ARRAY[1]=(0)

This User Gave Thanks to SFNYC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute an Oracle stored procedure from a shell scrip

Here is a snippet of my code: if then echo "\n Deleting all reports older than 24 hours. \n" >> $logfile ls -l $FileName >> $logfile ... (1 Reply)
Discussion started by: mh53j_fe
1 Replies

2. Shell Programming and Scripting

Shell arrays in oracle stored procedure

Is it possible to pass unix shell arrays in Oracle stored procedure? Is yes, how? Thanks (6 Replies)
Discussion started by: superprogrammer
6 Replies

3. Shell Programming and Scripting

Calling an Oracle Stored Procedure from Unix shell script

hai, can anybody say how to call or to execute an oracle stored procedure in oracle from unix... thanks in advance.... for ur reply.... by, leo (2 Replies)
Discussion started by: Leojhose
2 Replies

4. Shell Programming and Scripting

Invoking Oracle stored procedure in unix shell script

Here's a shell script snippet..... cd $ORACLE_HOME/bin Retval=`sqlplus -s <<eof $TPDB_USER/april@$TPD_DBCONN whenever SQLERROR exit 2 rollback whenever OSERROR exit 3 rollback set serveroutput on set pages 999 var status_desc char(200) var status_code... (1 Reply)
Discussion started by: hidnana
1 Replies

5. Shell Programming and Scripting

Need to call stored procedure from unix script

Hi Guys, I have a stored procedure which has 5 out parameters. I need to call the stored procedure from the script. When i use the following in my script, db2 "CALL FCFM.PART_MASTER_TMP($Return_code,$Message,$Message1,$SQL,$Load_count)" >> $LOG_FILE I am getting an error.. Please... (1 Reply)
Discussion started by: mac4rfree
1 Replies

6. Shell Programming and Scripting

how to pass the values to unix shell from the oracle stored procedure.

Hi i am calling a stored procedure from unix shell like this call test_proc('0002','20100218'); the stored procedure was giving output like this dbms_output.put_line(' processed earlier'); i want to see the output in the unix shell where i called. Thanks barani (6 Replies)
Discussion started by: barani75
6 Replies

7. Shell Programming and Scripting

Call and redirect output of Oracle stored procedure from unix script

Hi, Can you assist me in how to redirect the output of oracle stored procedure from unix script? Something similar to what i did for sybase isql -U$MYDBLOG -D$MYDBNAME -S$MYDBSVR -P$MYDBPWD -o$MYFILE<< %% proc_my_test 8 go %% Thanks in advance - jak (0 Replies)
Discussion started by: jakSun8
0 Replies

8. Shell Programming and Scripting

How to call a stored procedure from shell program?

How to call a stored procedure from shell program (1 Reply)
Discussion started by: noorm
1 Replies

9. Shell Programming and Scripting

How to call stored procedure with CLOB out parameter from shell script?

I have written a stored procedure in oracle database, which is having a CLOB OUT parameter. How can i call this stored procedure from shell script and get the CLOB object in shell script variable? (0 Replies)
Discussion started by: vel4ever
0 Replies

10. Shell Programming and Scripting

Need to run Oracle stored procedure from UNIX env

Hi Everyone, I want to create a script where i need to run the oracle stored procedure from unix script and get the output(sequence number ) into a variable which i will pass in my datastage job. Below is my stored procedure:- DECLARE P_TRANSTYPE VARCHAR2(20); ... (4 Replies)
Discussion started by: prasson_ibm
4 Replies
Ns_Location(3aolserver) 				   AOLserver Library Procedures 				   Ns_Location(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_SetConnLocationProc, Ns_SetLocationProc - Set the location procedure to use SYNOPSIS
#include "ns.h" void Ns_SetConnLocationProc(Ns_LocationProc *procPtr) void Ns_SetLocationProc(char *ignored, Ns_LocationProc *procPtr) _________________________________________________________________ DESCRIPTION
These functions set the procedure to run when a call to Ns_ConnLocation is made. The location is defined in the form METHOD://HOST- NAME:PORT, e.g. http://myhost.com:8443. Setting the location procedure with these functions will cause all calls to Ns_ConnLocation to use the location procedure you define instead of using the location procedure callback in the communication module for the connection. There may be cases where you want to do this. For example, you could create a location procedure that reports on the values returned by communication module location procedure callbacks. At the end of that procedure, you could then return that value after logging the infor- mation making your location procedure is effectively transparent to the server and other modules. Ns_SetConnLocationProc(procPtr) Set the function to use when Ns_ConnLocation is called. This function is deprecated. Use Ns_SetLocationProc instead. Ns_SetLocationProc(ignored, procPtr) Set the function to use when Ns_ConnLocation is called. The ignored argument is reserved for future use. SEE ALSO
nsd(1), info(n), Ns_ConnLocation(3) KEYWORDS
AOLserver 4.0 Ns_Location(3aolserver)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy