The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling a shell script from php eltinator Shell Programming and Scripting 1 04-22-2008 01:16 AM
Calling shell functions from another shell script jisha Shell Programming and Scripting 6 04-05-2008 04:29 PM
Calling Shell Script onlyroshni Shell Programming and Scripting 1 10-22-2007 07:29 PM
calling a shell script from perl gurukottur Shell Programming and Scripting 3 10-05-2006 11:48 AM
Calling shell script ? Ravi_Kandula Shell Programming and Scripting 1 10-07-2002 09:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-16-2007
lijju.mathew lijju.mathew is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 10
Calling PL/SQL Script in Shell Programming

Hi all,

In a shell script I need to pass two parameters to a pl/sql script and get the ouput of the pl/sql script and use it in shell script.

For example

Shell script : test.sh

PL/SQL script : get_id.sql parameter1 parameter2

Actually get_id.sql has a select statement something like this

select max(sal) from emp where emp_id in (parameter1,parameter2)



Now I need to get the max(sal) from the sql script back ino the shell script say a variable and echo it .

Would be great if you outline the script at a high level..


Thanks in advance
LM
  #2 (permalink)  
Old 05-16-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Lijju,
See if this would work for you.
Create a shell file named "my_shell.sh" as follows:
Code:
mParm1=$1
mParm2=$2
mSQL="database your_database;"
mSQL=$mSQL"select max(sal) from emp where emp_id in (${mParm1},${mParm2});"
echo $mSQL
echo $mSQL | <sql_pgm_call> 1>mOutFile 2>>mLogFile
<sql_pgm_call> is the name of the program you use to run your
SQL statements, ie, in Informix is either isql or dbaccess.

Then call the above shell as:
Code:
my_shell.sh first_parm second_parm
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0