Passing value from shell script to .pls file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing value from shell script to .pls file
# 1  
Old 11-27-2004
CPU & Memory Exporting variable ## !!!!!! ####

I have a shell script which takes at the command prompt options like
ss1.sh -F SCOTT -T JOHN

F- From User
T- To User

I want to pass the From User(SCOTT) Value to another script
ss2.pls (This script runs a PL/SQL Program). Depending on the FromUser value in the ss1.sh script i have to code accordingly in the ss2.pls script.
How can i pass the FromUser Value in the ss1.sh to ss2.pls script.

Exec Sequence: First ss1.sh script is run then ss2.pls is run.

Thanks !

Last edited by dreams5617; 11-29-2004 at 12:36 PM..
# 2  
Old 11-27-2004
ssh1.sh cannot affect the environment of its parent. Maybe ssh1.sh can write a temporary file which ssh2.sh can then read.
# 3  
Old 11-28-2004
Why not call the stored procedure from within ssh1 script rather than write 2 seperate scripts? Wouldn't this solve your problem?
# 4  
Old 11-30-2004
CPU & Memory Passing value from shell script to .pls file

I have a shell script which takes at the command prompt options like
ss1.sh -F SCOTT -T JOHN

F- From User
T- To User

Inside the ss1.sh there is a call to ss2.sh(inside this shell script there is a call to proced.pls, in this program(proced.pls) i have to pass the T -Touser value from the ss1.sh shell script).
Ex:
vi ss1.sh
{
Function()
{
/db2/home/ss2.sh $ORACLE_SID
}
}

vi ss2.sh
{
sqlplus -s / as sysdba << !
set verify off
@/db2/home/proced.pls
}

vi proced.pls
{
declare
cursor sym_owner is select owner from all_synonyms where owner=UPPER('$ToUser'); -- I want the value of ToUser taken
-- from ss1.sh script here in the SQL
-- statement.
..........................................................................etc

}
ss2.pls (This script runs a PL/SQL Program). Depending on the ToUser value in the ss1.sh script i have to code accordingly in the ss2.pls script.
How can i pass the ToUser Value in the ss1.sh to ss2.pls script.



Thanks !

red red red
# 5  
Old 11-30-2004
I have merged this with the thread you started when you asked the same question several days ago. Please read the rules particularly the ones regarding bumping posts and cross/duplicate posting.

Why can't you just do something along the lines of
Code:
$ cat > ss1.sh
#!/bin/sh
touser=$1
ss2.sh $touser
^D
$ cat > ss2.sh
#!/bin/sh
echo "Inside ss2.sh> $1"
^D
$ chmod +x ss1.sh
$ chmod +x ss2.sh
$ ./ss1.sh foouser
Inside ss2.sh> foouser

You get the idea - or do what google suggested and just write the whole thing as one single script - why pass variables around anyway?!

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Passing Arguments to shell script from file is not working as expected.

Hi All, I have below simple shell script in cloudera quick start vm cenos 6 which copy file from source to destination. # file_copy.sh source_dir = ${source_dir} target = ${target_dir} cp source_dir target and my parameter file is like below #parameter_file.txt source_dir =... (4 Replies)
Discussion started by: Narasimhasss
4 Replies

2. Shell Programming and Scripting

Passing values to an XML file from shell script

:wall: Hi, I have an XML file with 5 tags. I need to pass values to the XML file from a shell script that will replace values in 2 of the tags. I cannot hardcode the tag values in XML and use replace command in script as the values are likely to change. Please help !!!!!!!!!!! (2 Replies)
Discussion started by: Monalisaa
2 Replies

3. Shell Programming and Scripting

Need help with first shell script pls.

Hi, I'm trying to extract information from one file to update another one and am a bit stuck. the first file is made up of tags e.g. <item>a@b.com</item> jksdhfjkdsh sldkjfds l klsjdf <item> c@d.com </item> what i'd like to do is extract the email addresses between these tags,... (6 Replies)
Discussion started by: newb1000
6 Replies

4. Shell Programming and Scripting

Passing a file handler and an array from Perl to Shell Script

Hi there, I am trying to call a shell script from a Perl script. here is the code: @args = ("sh", "someshellprg.sh", "a file handler", "an array"); system(@args) == 0 or die "system @args failed: $?"; in the shell program, I examine if the arguments exits using: if then echo... (5 Replies)
Discussion started by: pinkgladiator
5 Replies

5. Shell Programming and Scripting

Passing parameter from one file to shell script

Hi All, I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date. everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file. ... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

6. Shell Programming and Scripting

shell script, pls help

# for i in `cat oo`;do ls -ld $i;done ls: /var/tmp/i: No such file or directory ls: i: No such file or directory ls: /var/tmp/ii: No such file or directory ls: i: No such file or directory ls: /var/tmp/iii: No such file or directory ls: i: No such file or directory ls: /var/tmp/iiii: No such... (2 Replies)
Discussion started by: cpttak
2 Replies

7. Shell Programming and Scripting

Shell Script Required? Pls. help me

Hi All, I have Information in the file like, ============ Interface Information ==================== +++++++++++++++++ NMInterface ++++++++++++++ ObjID:251c55a2-2257-71dd-0f68-9887a1f10000 NNMObjID:82857 EntityName:aust00m1.mis.amat.com ] Description:ATM9/0/0-atm layer Discovered in... (22 Replies)
Discussion started by: ntgobinath
22 Replies

8. Solaris

Passing arguments to a shell script from file while scheduling in cron

Hi, I have a shell script Scp_1.sh for which I have to pass 2 arguments to run. I have another script Scp_2.sh which in turns calls script Scp_1.sh inside. How do I make Scp_1.sh script to read arguments automatically from a file, while running Scp_2.sh? -- Weblogic Support (4 Replies)
Discussion started by: weblogicsupport
4 Replies
Login or Register to Ask a Question