Is this how ? am confused
eg:
i want to pass something like this after checking for null values
based on this the sql script shlould check for null .
i am using nvl function in sql to handle this.
Not knowing how you were using these variables, I couldn't give any more detail. Now that you've shown how I can help you a little better.
Unfortunately I'm not familiar with how sqlplus assigns things on a commandline. It may need some special syntax to input a real database NULL rather than a string containing the letters "NULL". If you can do so, it may be easier to check inside your sql script for zero-length strings.
You can't assign to $1.
What you can do is
which will cause it to evaluate to the string NULL whenever $1's blank, and its usual content otherwise.
I'm not sure if this will result in a database NULL or the string "NULL". You might have better luck just leaving it as "$1" and seeing if the resulting "" is interpreted as a database NULL.
I have not passed any value for $1 ... so i know $1 is empty.
I passed in values for $2 $3 $4.
whenever $1 $2 $3 $4 are passed from shell to sqlplus they are referred to as &1 &2 &3 &4 .
now we know that I passed no value for $1 ,
but in sql script what is happening is the first non null value that is from shell i.e, $2 in our case now ... is being treated as &1 .
so its not working
---------- Post updated at 04:56 PM ---------- Previous update was at 04:38 PM ----------
Do u know how can I display the values passed from korn shell in the sql script?
for eg in the korn shell i am passing a value like this.
i am getting an error
PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= . ( @ % ;
The symbol ":= was inserted before "=" to continue.
not sure whats going on
Last edited by megha2525; 11-09-2011 at 10:59 AM..
I have written a script which will take input parameter as another script.
However, if the script passed as input parameter has parameters then this script doesn't work.
I have a script b.ksh which has 1 and 2 as parameters
I have a script c.ksh which has 3,4 and 5 as parameters
vi a.ksh... (1 Reply)
Hi All,
I am new to shell script. I am trying to pass value from .sh file to .sql file .
But I am able to run the .sql file from .sh file with values in sql file.
But I am unable to pass the values from .sh file. can some one please help to resolve this.
here is my .sh file
s1.sh
... (4 Replies)
Hi all,
$ echo $SHELL
/bin/bash
Requirement - How to pass oracle sql script as argument to unix shell script?
$ ./output.sh users.sql
Below are the shell scripts and the oracle sql file in the same folder.
Shell Script
$ cat output.sh
#!/bin/bash
.... (7 Replies)
Hi scripting experts.
I have some coding challenges that I'm hoping you can help me out.
I have one file#1 that contains the following sql statement that spans over multiple lines:
sql Select /*+ use_has(a,b) */ *
from customer a,
customer_address b
where a.id = b.id... (1 Reply)
Hi All ,
I am trying to pass a value from sqlplus to korn shell .
There is a table tab1 in Oracle that has a column userdate.
I need to pass the userdate to the korn shell . This is what I am doing .
VALUE=`sqlplus -silent username/password << END
set pagesize 0 feedback off verify off... (14 Replies)
hi,
Could anyone tell me how to pass the output values of the PL/SQL procedure to Shell script and how to store that values in a shell script variable...
Thanks in advance... (5 Replies)
Hi,
I am using SYBASE database. in my script i am connecting to DB via using isql.
isql -U${S_USER} -S${S_SERV} -D${S_DB} -P${S_PWD} -b0 -w3000 -h0 -s"|" -i${MYDIR}/ABC.sql -oXYZ.txt << FINSQL
i am taking a ABC.sql file to use the queries written in it and storing the output in... (3 Replies)
Hello All,
I was just wondering if there is any direct way to access PL/SQL OUT variables from Korn Shell Script.
I could already figure out how to return a single value back from PL/SQL to Shell Script (using bind variable).
But, what if we want to return multiple values?
One option I... (4 Replies)
Hello,
i am using '#!/bin/bash', i want to make a loop in pl/sql, this loop takes values from a table according to some conditions, each time the loop choose 3 different variables. What i am not able to do is that during the loop i want my shell script to read this 3 variables and run a shell... (1 Reply)