TODAY=$(date)
ORACLE_HOME=/opt/oracle/product/9.2.0
ORACLE_SID=$1
echo "Date is Fridayyyyy: $TODAY"
x=$($ORACLE_HOME/bin/sqlplus -s report/report@$ORACLE_SID <<EOF
set heading off pages 0 feedback off
var n varchar2(100)
exec select mod_cd into :n from report.cube where cube_cd = 'LNR_ALL';
print :n
exit;
EOF )
echo "Count = $x"
error :
cognos@sec-dev-sun04 : ./lr_cube_tst.sh misdev
./lr_cube_tst.sh: !/bin/sh: not found
Date is Fridayyyyy: Wed Mar 24 09:43:22 EDT 2010
Count = BEGIN select mod_cd into :n from report.cube where cube_cd = "LNR_ALL"; END;
*
ERROR at line 1:
ORA-06550: line 1, column 64:
PL/SQL: ORA-00904: "LNR_ALL": invalid identifier
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
output in db
select mod_cd from report.cube where cube_cd = 'LNR_ALL';
...
Count = BEGIN select mod_cd into :n from report.cube where cube_cd = "LNR_ALL"; END;
*
ERROR at line 1:
ORA-06550: line 1, column 64:
PL/SQL: ORA-00904: "LNR_ALL": invalid identifier
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
...
And this is what I see on my database:
We are back to square one !
You will have to start reading my posts completely and understand them thoroughly if you wish you gain something out of this.
I usually get tired saying the same thing again and again and again... ad infinitum...
This is my script ..i tried in two ways as you mentioned.
Also listed is the errors i am getting
it would be really helpful if you could throw some insight here as u seem to be really good at this..
first attempt
error
Date is Fridayyyyy: Wed Mar 24 10:13:39 EDT 2010
Count = ERROR:
ORA-01741: illegal zero-length identifier
Second attempt
error :
Date is Fridayyyyy: Wed Mar 24 10:31:34 EDT 2010
Count = BEGIN select mod_cd into :n from report.cube where cube_cd = "LNR_ALL"; END;
*
ERROR at line 1:
ORA-06550: line 1, column 64:
PL/SQL: ORA-00904: "LNR_ALL": invalid identifier
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
Last edited by monie2717; 03-24-2010 at 12:23 PM..
(1) Use the "code" tags to show the contents of your scripts. Use it to separate your code from the text of your post.
(2) If your script name is "lr_cube_tst.sh" and it is in the current directory, and if you pass the argument "misdev" to it, then show the output of the following 3 commands:
Of course, put the commands as well as their output within "code" tags.
Check the FAQ of this forum to figure out how to use "code" tags, if you don't know it already.
Hi Gurus,
I have a script which send sql query to oracle db and return value to my script.
dummy code like below:
sqlplus -s user/${PASSWD}@${ORACLE_SID} @${DIR}/query.sql > outputfile
using above code, when query has error, it send error to same out put file and exit code is 0, is... (6 Replies)
Hi All,
I need to return value to the main shell script, depending on whether the UPDATE command in the embedded pl/sql is successfu or not.
#!bin/ksh
updateStatus=`sqlplus --conn details-- << EOF
DECLARE
var_rows NUMBER;
BEGIN
update table_name
set column_name =... (7 Replies)
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
Hi Experts:
I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
I've a script of the following form calling a simple sql that counts the no of rows as based on some conditions. I want the count returned by the sql to get assigned to the variable sql_ret_val1. However I'm finding that this var is always getting assigned a value of 0. I have verified by executing... (1 Reply)
How could I call an Oracle PL/SQL procedure from any shell (bash) and catch returning value from that procedure (out param) or get a returning value if it's a function.
also, I got into trouble when I tried to send a number as a param
#!/bin/bash -e
username=$1
pwd=$2
baza=$3... (0 Replies)
hi
i am calling a oracle stored procedure(in the database) from unix shell scripting (a.sh).
the called stored procedure returns some values through OUT variables
i want to assign the return values of stored procedure in to unix shell script variable.
can you provide me the code.
... (1 Reply)
Hi guys,
I am quite new in shell scripting.
I am tring to promote some oracle jobs into control-M. In control-M, I am calling a script which establishes a connection with database and execute some procedures. Now I want if that PL/sql Block got failed script should return failure to... (2 Replies)
Hello,
I need some help from the experts on PL/SQL and Shell scripting. I need a shell script that runs a PL/SQL procedure and gets the values returned from the PL/SQL procedure into the shell variables. The PL/SQL procedure returns multiple values.
I was able to assign a single return value... (1 Reply)
Hi guyz,
Posting a thread after a long time.
I want to pass two variables to unix shell script from sql script.
Note: I am calling sql script from unix script. sql script has 2 variables one is the return code for status of program run and second one email flag. I don't know how to capture... (3 Replies)