Catching oracle exception in shell script
Hi,
I'm trying to catch an oracle exception in a shell script. Below is my shell script -
#!/bin/sh
var=115326311
logfile=shell_log.txt
sqlplus -s mbl/sop01 <<EOF
WHENEVER SQLERROR EXIT SQL.SQLCODE;
@plsql.sql $var;
EOF
return_type=$?
if [ $return_type != 0 ]
then
echo 'Error with code';
echo "$return_type";
exit 0;
fi
and this is the sql script -
set serveroutput on;
DECLARE
--set serveroutput on;
--v_company_id NUMBER := 'company_id';
v_name VARCHAR2(100);
BEGIN
--set serveroutput on;
dbms_output.ENABLE();
SELECT ename INTO v_name FROM emp WHERE emp_ID = &1;
DBMS_OUTPUT.PUT_LINE('Inside SQL File'||' || '|| v_name);
END;
exit
I'm basically passing an employee number that does not exist and hence the sql file would throw and no_data_found exception, which i'm trying to catch in the shell script. When I try to execute the shell script I get the below error --
DECLARE
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 8
Error with code
123
he sql file is aborting and the error there is just thrown to the command line, which I don't want. I want it to be captured in the shell script and perform my own logic. Also, it says the error code is 123 - I'm not sure from where this is being picked up, shouldn't it actually be the ORA-1403 code ?
Hello,
1403 is out of range for the return value, see https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1342602684748
We can raise errors in a given range but the shell will only keep an
unsigned byte in the status return value (values 0..255). It takes our exit file and
just looks at that last byte.
It also shows how to get around this limitation.
Regards
Marcus
Similar Messages
-
R/3 to other oracle system Unix Shell scripts Execute
Hi,
Here SAP 4.7 version, is it any possibility to run/execute other oracle system Unix shell scripts from sap program?
With Regards,
Anil...yes,
1.define own external command (sm69)
2. run this command from your ABAP code by callig function module SXPG_COMMAND_EXECUTE
regards,darek -
Random SP2 error when starting oracle process through SHELL script
Hi All,
I am trying to process data in n-Number of tables through a package. The package is called through a shell script to create start data processing. All calls to the package are in a sql script which is basically exec calls-
exec package.process ('T1','some param');
exec package.process ('T1','some param');
exec package.process ('T..n','some param');
I have a shell script which I use to execute commands from the sql script. There is a reason behind using shell script. For some strange reason, I keep on getting -
ERROR: logon denied - check for valid user with valid privileges
SP2-0640: Not connected
SP2-0641: "EXECUTE" requires connection to server
SP2-0640: Not connected
for some EXEC calls. Problem is, errors are generated at random. So in one run, I get error for T10,T11 and then in next run I might get for some other tables.
However, when I am running the sql script from the sql prompt, all calls to the package are executed without any problem.
This makes me think, it is something to do with the way database connection being initiated through UNIX.
Has anyone faced similar issue? Your help/gudence is much appreciated.
DB: Oracle 10.2.0.5
OS: SUN Solaris 10
Thanks in advance.Login credentials are provided inside the shell script.
I did put a sleep(10) after EOF but no help. As mentioned if I run script file from sql promt, it runs without any hiccup. So it is the connection through the UNIX that is causing issue.
As pointed out by Sybrand, I agree that it does not make a sense to connect and commit after every sql statement. So decided to change the shell script and so far, the result from my initial tests on a sample data is quite encouraging. Hopefully I will have a solution.
But it will be nice to know why SHELL is doing what it is doing!!
Legacy prog are sometime big time eye-openers..;) -
Advice executing oracle package using shell script.
Hi,
I am writing one shell script that accepts several parameters as an input. These parameters are then passed while executing Oracle package procedure. However this procedure has an OUT parameter and I am not aware of how to receive that parameter in shell script.
Any advice /suggestion is really appreciated.
Below is the part of code I am using ... (P_OUT is suppose to be an out parameter for package)
sqlplus -s apps/apps <<endsql
whenever sqlerror exit failure
set serveroutput on size 10000
execute TEST_PKG.GET_COC_REQ ('$P_FROM_DATE','$P_TO_DATE','$P_MONTH_YY', '$P_OUT');
endsqlThere is more than one way. Here an example :
SQL> select ename,sal from emp where empno=7902;
ENAME SAL
FORD 3000
SQL> create or replace procedure extsal (
2 empnum in number,
3 salout out number)
4 is
5 begin
6 select sal into salout
7 from emp
8 where empno = empnum;
9* end;
SQL> /
Procedure created.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
$ EMP=7902
$ SAL=`sqlplus -s scott/tiger << EOF
set head off
var salout number;
exec extsal ($EMP, :salout);
print salout
exit
EOF
`$ echo $SAL | awk -F. '{print $2}'
3000
$ -
Verifying oracle connection from shell script
Hi,
Oracle 9.2
Solaris 10
From the shell script ........How can we verify whether oracle connection is successful or not ?
Shell script will prompt the user to enter the oracle schema username, password and tns name.
So, how to verify whether oracle connection has been established or not ??
If user entered schema name & password is correct then proceed further else script will again prompt for schema user name & password.
With RegardsI would not provide the username/password at the command line because everyone could see it when listing processes with standard unix 'ps' command.
Below is an example. I'm sure you can modify it to suit your purpose.
export ORACLE_SID=orcl
oradate=`sqlplus -s <<-EOI
system/oracl
set echo off feedback off timing off pause off heading off verify off
whenever oserror exit failure
whenever sqlerror exit failure
select sysdate from dual;
exit
EOI
`
sqlerr=$?
if [ $sqlerr -ne 0 ]; then
echo "Unable to connect to Oracle"
else
if ! [ "$oradate" ]; then
echo "SQL returns so result."
else
echo $oradate
fi
fiEdited by: waldorfm on Oct 13, 2010 2:58 PM
I just noticed...
c:/tmp/check_conn.txtWhat is c: supposed to do? If you want to output the result you can use >> /$HOME/result.log -
How I run a shell script from the scheduler on 10.2.0.2.0 ?
Hello Oracle People,
I'd like to run a shell script from the Scheduler in my 10g database.
Right now it is a simple shell script.
Eventually it will wrap RMAN commands to back up my DB.
I wrote a simple pl/sql script to create a job:
-- cr_job10.sql
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'my_backup_job',
job_type => 'EXECUTABLE',
job_action => '/h/oracle/scripts/tst.sh',
start_date => '06-SEP-07 5.33.00PM US/Pacific',
repeat_interval => 'FREQ=DAILY',
end_date => '08-SEP-07 4.00.00PM US/Pacific',
enabled => TRUE,
comments => 'My Backup Job');
END;
I see no errors when I run the above procedure.
I checked DBA_SCHEDULER_JOBS and the job is in there.
The scheduler, though, errors out with an error which I see in a trace file:
/h/oracle/admin/orcl/bdump/orcl_j000_22396.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /h/oracle/product/10r2
System name: SunOS
Node name: sol
Release: 5.10
Version: Generic_118855-14
Machine: i86pc
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 15
Unix process pid: 22396, image: oracle@sol (J000)
*** ACTION NAME:(MY_BACKUP_JOB) 2007-09-06 17:33:00.175
*** MODULE NAME:(DBMS_SCHEDULER) 2007-09-06 17:33:00.175
*** SERVICE NAME:(SYS$USERS) 2007-09-06 17:33:00.175
*** CLIENT ID:() 2007-09-06 17:33:00.175
*** SESSION ID:(140.13520) 2007-09-06 17:33:00.175
*** 2007-09-06 17:33:00.175
ORA-12012: error on auto execute of job 53267
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
I googled on this:
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
Google returned only 1 hit.
There, I see some evidence that I need to configure something inside
of Oracle to run shell scripts from the scheduler, but possibly just
for machines running windows. I'm running Solaris.
Do any of you know what I need to configure inside of Oracle to
run shell scripts from the scheduler?
-OwenHello people,
I should have added this bit of information:
"The script runs fine from oracle's crontab."
"The script runs fine from a shell owned by oracle."
I'm getting responses telling me to check my env variables and permissions
which would be helpful to a UNIX novice.
I have a feeling that no one is using the scheduler to run RMAN scripts.
Tim Hall suggested I take a close look at these files:
$ORACLE_HOME/rdbms/admin/externaljob.ora
$ORACLE_HOME/bin/extJob
Currently I'm setup like this:
bash sol root /h/oracle/product/10r2/bin 31 #
bash sol root /h/oracle/product/10r2/bin 31 # ll $ORACLE_HOME/rdbms/admin/externaljob.ora
-rw-r--r-- 1 root dba 52 Sep 7 15:29 /h/oracle/product/10r2/rdbms/admin/externaljob.ora
bash sol root /h/oracle/product/10r2/bin 32 #
bash sol root /h/oracle/product/10r2/bin 32 # cat $ORACLE_HOME/rdbms/admin/externaljob.ora
# externaljob.ora
run_user = rman
run_group = rman
bash sol root /h/oracle/product/10r2/bin 33 #
bash sol root /h/oracle/product/10r2/bin 33 #
bash sol root /h/oracle/product/10r2/bin 33 #
bash sol root /h/oracle/product/10r2/bin 33 # ll $ORACLE_HOME/bin/ext*
-rwsr-x--- 1 rman dba 30388 Sep 21 2006 /h/oracle/product/10r2/bin/extjob*
-rwsr-x--- 1 rman dba 30392 Sep 21 2006 /h/oracle/product/10r2/bin/extjobo*
-rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc*
-rwxr-xr-x 1 oracle dba 300 Sep 21 2006 /h/oracle/product/10r2/bin/extusrupgrade*
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 #
On my system, the user 'nobody' has no shell so I cannot use nobody.
I created a user named rman:
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 #
bash sol root /h/oracle/product/10r2/bin 34 # su - rman
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
$
$ id
uid=220(rman) gid=220(rman)
$
$
$ date
Fri Sep 7 16:30:03 PDT 2007
$
$
Jared points out that rman needs access to extproc:
$ ls -la /h/oracle/product/10r2/bin/extproc
-rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc
$
$
Here is a demo of rman running his script:
bash sol root /h/oracle/product/10r2/bin 35 # su - rman
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
$
$
$ ls
scripts
$
$
$ scripts/tst.sh
$
$
$ cat scripts/tst.sh
#! /bin/sh
/usr/bin/date > /tmp/tst.sh.out.txt 2>&1 &
exit 0
$
$
$ cat /tmp/tst.sh.out.txt
Fri Sep 7 16:31:23 PDT 2007
$
$ rm /tmp/tst.sh.out.txt
$
I am focused on this error:
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
And I am focused on this exit code: 274662
What does 274662 mean?
If the Scheduler gives me an error like "274662" rather than some English,
it's obvious to me the Scheduler is a POS and I should not use it.
And of course,
If I cannot run RMAN from Oracle Scheduler, I'll use cron.
-Owen -
Catch a value from a pl*sql function in a shell script
Hi all,
I have a shell script that simply calls the following pl*sql function.
echo "execute scott.my_pkg.test('FDLmaster');\n exit;" >./pippo.sql
sqlplus scott/tiger @/fidcap_ftp/FDL/SCRIPTS/pippo.sql
What I have to do to catch the value returned from the function test?
Thanks in advance
best regards
MarioSQL> create or replace function do_something return varchar2 is
2 begin
3 return ('Something');
4* end;
SQL> /
Function created.
SQL> select do_something from dual;
DO_SOMETHING
Something
SQL> save pippo
Created file pippo.sql
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
[linuxas tmp test10]$ echo exit >>pippo.sql
[linuxas tmp test10]$ VAR=`sqlplus -s scott/tiger @pippo`
[linuxas tmp test10]$ echo $VAR | cut -f3 -d" "
Something
[linuxas tmp test10]$ -
Hi,
i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
new.sh - my shell script - lctfile (LCTFILE) is the input pa
v_config_file=`find $FND_TOP -name LCTFILE
FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
if [ $? != 0 ];then
echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
else
echo "SUCCESS" | tee -a $LOG_FILE
fi
CREATE OR REPLACE PROCEDURE test_dbms_scheduler
AS
v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
BEGIN
DBMS_OUTPUT.put_line ('I am in Procedure');
DBMS_SCHEDULER.create_job (
job_name => 'test_dbms_scheduler',
job_action => '/home/bir4163/RPT33/bin/new.sh',
number_of_arguments => 1,
job_type => 'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run shell script'
DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
argument_position => 1,
argument_value => v_text);
DBMS_SCHEDULER.enable ('test_dbms_scheduler');
DBMS_OUTPUT.put_line ('I am back in Procedure');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
END;
But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
please do help its very urgent
thanks
ramyaHi,
Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
Regards,
Andries -
Please help to call oracle procedure with out paramter from shell script
Hi
I want to call a process with out parameter from shell script. I am calling process in shell script in below way
function Process_loads {
( echo 'set serveroutput on size 1000000 arraysize 1'
echo "set pagesize 0 term on verify off feedback off echo off"
echo "BEGIN"
echo " dbms_output.put_line('Before Calling The package'); "
echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
echo " dbms_output.put_line('After Calling The package'); "
echo "EXCEPTION "
echo " WHEN OTHERS THEN "
echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
echo " ROLLBACK;"
echo "END;"
echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
Here $error_code is out paramter. All varaibles passed in process are declared with export command.
When executing .sh it gives below error
"sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
Thanks in advanceYou can try this:
From sql*plus
SQL> ed
1 create or replace procedure my_proc(p_id in int, p_result out int)
2 as
3 begin
4 select 10 * p_id
5 into p_result
6 from dual;
7* end my_proc;
SQL> /
Procedure created.
SQL> set serveroutput on
SQL> declare
2 v_r int;
3 begin
4 my_proc(10,v_r);
5 dbms_output.put_line(v_r);
6 end;
7 /
100
PL/SQL procedure successfully completed.
from bash:
testproc.sh:
#!/bin/bash
(echo 'set serveroutput on';
echo 'declare';
echo 'v_r int;';
echo 'begin';
echo 'my_proc(10,v_r);';
echo 'dbms_output.put_line(v_r);'
echo 'end;';
echo '/';) | sqlplus -s u1/u1
Console:
oracle@mob-ubuntu:~$ chmod u+x testproc.sh
oracle@mob-ubuntu:~$ ./testproc.sh
100
PL/SQL procedure successfully completed.With kind regards
Krystian Zieja -
Bash shell script to exception when database has been shutdown
Hi, I'm quite new in shell scripting. I created the below simple script to do a check on the database, it's a count so it works fine... if the database is there. Now I want to be able to catch if the database is or is not there, what I tried so far didn't work, can anybody please give me a hand with this?
The shell script file "start_check.sh":
#!/bin/bash
# Set environmental variables
. /home/oracle/env/usrdwh1.env
TEMP_FILE=rwcnt
runCheckQuery()
# Run query and dump result into the TEMP_FILE
sqlplus -s "/as sysdba" > /tmp/${TEMP_FILE} << EOF
@/u02/reports/sql/start_check.sql
EOF
if [ $? -eq 0 ]
then err_num=0
else err_num=1
fi
################ MAIN ####################
runCheckQuery
row_count=`cat /tmp/${TEMP_FILE}`
if [ $err_num -eq 0 ]
then
# If no rows were found then send an email alert
if [ $row_count -eq 0 ]; then
echo 'No process found - Please investigate' | mailx -s "Daily check ALERT" [email protected]
fi
else
# There was an error when trying to connect to the db. Need to report it
echo 'Database connection error - Please investigate - Error Message: (' $row_count ')' | mailx -s "Daily check ALERT (Database connection error)" [email protected]
fi
# Remove the tmp file
rm /tmp/${TEMP_FILE}
The sql script file "start_check.sql":
SET SERVEROUTPUT ON
SET FEEDBACK OFF
WHENEVER SQLERROR EXIT;
DECLARE
row_count NUMBER;
BEGIN
SELECT COUNT(*)
INTO row_count
FROM dw_ml_ba ml_ba
WHERE sys_id = 'CCX'
AND ml_ex_start_datetime > TRUNC(sysdate);
DBMS_OUTPUT.PUT_LINE(row_count);
END;
EXIT
Edited by: leocoppens on Jan 4, 2013 4:05 PMThere may be a better, but here is a shell script that works:
#!/bin/ksh
# db_check.sh
# Script used to check if one or all of the databases on
# one server are available.
# Parameter Description
sid=$1 # Database SID or Keyword 'all'
function check1db
sid=$1 # Database SID
ORAENV_ASK=NO
. /usr/local/bin/oraenv "$sid"
ORAENV_ASK=YES
if [ $(ps -ef|grep "ora_smon_$sid"|grep -v grep|wc -l) -eq 0 ]
then
echo "%-Error, Database $sid is NOT available - Not started\n" >>${CHKLOG}
return 1
fi
dbok=$(\
sqlplus -s / <<!
if [[ $(echo $dbok|cut -d' ' -f1 ) == 'ERROR:' ]]
then
echo "%-Error, Database $sid is NOT available - Started with errors\n" >>${CHKLOG}
return 1
else
echo "%-Info, Database $sid is available\n" >>${CHKLOG}
fi
return 0
} # end function check1db
# Set some environment variables:
ORACFG=/etc # Location of oratab
ORALOG=$HOME/logs # Location for result log
EMAIL='[email protected]' # E-mail to send alert
sid=${sid:-'all'}
echo "$0 Job started at: `date` "
BDATE=$(date +%y%m%d)
export CHKLOG=$ORALOG/db_check_${sid}_${BDATE}.log
echo "$0 on `date`" >$CHKLOG
if [ "$sid" = "all" ]
then
i=0
stat=0
cat $ORACFG/oratab | while read LINE
do
case $LINE in
\#*) ;; #comment-line in oratab
sid=`echo $LINE | awk -F: '{print $1}'`
check1db "$sid"
stat1=$?
((stat += $stat1)) # Combine the Status of All Calls
((i = $i + 1)) # Count Number of Databases Checked
esac
done
((j = $i - $stat)) # Count Number of Databases Available
echo "\n%-Info, `date +%c`,\n\tTotal databases checked = $i,\n\tAvailable = $j, Not available = $stat\n" >>${CHKLOG}
else
check1db $sid
stat=$?
fi
# Beep operator if database down.
if [ ${stat} -ne 0 ]
then
SUBJ="Database(s) alert."
mailx -s"$SUBJ" $EMAIL <$CHKLOG
fi
echo "$0 Job stoped at: `date` "
exit $stat:p -
Oracle 10g and Korn Shell Scripting
I have a table,SALES_STAGING, with 3 main columns.
Sales_Date, Sales_type,Sales_Code.
A sale is added to the table then waits until approved to be processed. The Sales_Code is 1(waiting approval). Then manually changed to 2 every 30 minutes by sales staff except on weekends. By Monday,a large queue develops. This must be changed because the queue is slowing the system. Can someone help create a Unix Korn shell script to
1) Run every 30 minutes via Crontab
2)login to the Oracle DB.
3)Count the number of records to be processed, if any.
4)Update another 'log' table with the time it ran and the records to be processed
5)if there are less than 20 add another 50 to be processed by changing the Sales_Code from 1 to 2.
This would really help out tremendously! Thank you.Wait... Isn't this forum designed for the sharing of information? The experts here shouldn't be concerned whether the request is from a Student, Oracle newbie or Developer and should focus on the request. If you are capable of assisting then I am hoping you will out of the core respect for professionalism and the motivation to provide something of value to others. If not, don't waste my time or any one else by responding with preconceived judgments and insulting remarks as these will be reported.
Sales transactions can peak at 20,000 per hour with an average of several million thru the week. Those sales by VIP customers are immediately identified and have a priority for approvals because their balances can easily exceed $1,000,000.00. There is a pre-approval process to be introduced but until programs can be modified/tested and deployed we need a quick fix. The programming system isn't slow, it's the limited human resources approving VIP customers. My request was to keep it simple and expand on it myself to include the entire scope of our project. dbms_scheduler, although a good idea will require DBA assistance and there is no resource available. I need a simple working model to give me some direction/ideas... -
Shell script for export backup in oracle 11g
Hi,
Oracle version 11.2.0..
O/S-AIX
How to write shell script for export full backup in oracle 11g and also need to remove 2 days of old backup.
Regards,
RajuHow to write shell script for export full backup in oracle 11g
Do you mean that export is your backup strategy ? is your database running in noarchivelog mode ? if so, then why ? if not so, then why not RMAN ?
need to remove 2 days of old backup.
If that mean remove files older than 2 days, you can use something like this :
$ find <absolute directory path> -mtime +2 -exec rm {} \; -
Unable to pass parameter in oracle procedure through unix shell script
Hi Experts,
I have oracle procedure where in I have to pass the value of procedure parameter through unix script.
Follwoing is the sample procedure which i tried to exceute from the unix.
Procedure:
create or replace procedure OWNER.PRC_TESTING_OWNER(OWNER IN VARCHAR2) AS
sql_stmt varchar2(1000) := NULL;
v_count number := 0;
v_owner varchar2(100) := owner;
begin
sql_stmt:='select count(1) from '||v_owner||'.EMP@infodb where rownum<=10';
execute immediate sql_stmt into v_count;
DBMS_OUTPUT.PUT_LINE(sql_stmt);
DBMS_OUTPUT.PUT_LINE(v_count);
END;The script which I used is:
Unix
#!/bin/ksh
parm=$1
echo start
sqlplus -s scott@DEV/tiger <<EOF >>result_1.txt
set serveroutput on;
select '$parm' from dual;
exec owner.PRC_TESTING_OWNER('$parm');
EOFThe script is working fine that is i am able to pass to parameter value through unix shell script. :)
But if I want to pass the value of the owner in cursor , I am unable to pass this value through unix.
Following the procedure which i am trying to implement.
create or replace procedure OWNER.PRC_TESTING_OWNER(OWNER IN VARCHAR2) IS
v_owner varchar2(100) := owner;
CURSOR main_cur IS
select
i.ROWID rid ,
emp_name,
deptid
from v_owner.employee;
CURSOR subset_cur(c_deptid NUMBER ) IS
SELECT *
FROM v_owner.DEPT d
where d.dept_id=c_deptid;
--##main loop
FOR i IN main_cur LOOP
FOR j IN subset_cur(i.deptid) LOOP
BEGIN
insert into v_owner.RESULT_TABLE
END;
END LOOP;
END LOOP;How can i pass parameter value of the stored procedure through unix script(that is "owner" in this case), when these parameter value is
used in cursor? :(
Can anybody help me regarding the same?
Thanks in Advance !! :DIt's not the parameter in the cursor that is the problem, it's that you are trying to use static SQL for something that won't be known until run time (the owner of the table).
You would need to use something like ...
declare
l_owner varchar2(30) := 'SCOTT';
l_ref_cursor sys_refcursor;
type l_ename_tab is table of scott.emp.ename%type;
l_ename_array l_ename_tab;
begin
open l_ref_cursor for
'select ename
from ' || l_owner || '.emp';
loop
fetch l_ref_cursor bulk collect into l_ename_array limit 10;
exit when l_ename_array.COUNT = 0;
for x in 1 .. l_ename_array.count
loop
dbms_output.put_line(l_ename_array(x));
end loop;
end loop;
close l_ref_cursor;
end;
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01 -
Do the shell script have to login into Oracle Apps
I am calling the Document Processor Java API from a shell script. The problem I have that its unable to find the
xdo://PO.POXPRPOLXMLRTF.en.US/?getSource=true
file within the control file.
Is this because somewhere a shell variable needs to be set, or a login need to be made into the Oracle Apps, so this template stored in XML Publisher is accessible.
Please advise!Another things you can do is
begin
tmp_res := apps.fnd_web_sec.CHANGE_PASSWORD('TESTUSER','changeme',false);
update fnd_user set password_date = null where user_name = 'TESTUSER'';
end;
Once you do this, when the TESTUSER logs in with the password=changeme, he/she will be redirected to the change password page.
Hope this helps,
Sandeep Gandhi -
Oracle 11g R1 Automatic Installation shell scripts
Hy Guys,
Please can someone help me with: Oracle 11g R1 Automatic Installation shell scripts. A guide, how to or a link will be wellcome
Kind Regards
Easyman
Edited by: Easyman on Feb 2, 2010 3:58 AMHi Easyman,
sure, just have a look in $INSTALL_CONF directory. Files starting with swInst* are referencing a response file from $INSTALL_CONF/response directory. Either use a sample configuration file or add your own response file to install Oracle.
Cheers,
David
OCP 9i / 10g / 11g
http://www.oratoolkit.ch/knowledge/howto/installation/otn.php
P.S.: If you have more questions about oraToolKit please contact me at: http://www.oratoolkit.ch/faq.php
Maybe you are looking for
-
Exception when useing imporrt jxl.*
Hi it is my class i have written import java.io.*; import jxl.*; import java.util.*; import jxl.Workbook; import jxl.write.DateFormat; import jxl.write.Number; import jxl.write.*; import java.text.SimpleDateFormat; class create public static void mai
-
Mac OS 10.8.3, Flash Player 11: Abort after download
Dear Adobe Support Team, unfortunately we (several people running MacBookPros w/Mac OS X 10.8.3) are unable to install Flashplayer 11. On a reference machine I deinstalled FlashPlayer 10 and tried to follow the troubleshooting steps - unfortunately I
-
Iphone4 out memory since photo stream "showed up"?
Ive recently had performance probs on my iphone4. could photo stream cause this? How do I troubleshoot and fix?
-
How can I set my iPhone to show email messages sent from my desktop?
Using iPhone 5, are there setting that I'm missing to allow me to see sent messages from my desktop Mac on my iPhone?
-
Help in selecting required columns from duplicates records
HI, I have a table like below empid,ename,sal,Jdate,Rdate,deptid,designation,Terminated_Emp 1,a,100,15-May-2014,11,SE,NO 1,null,null,15-OCT-14,null,null,YES I want output like below 1,a,100,15-May-2014,15-OCT-2014,11,SE,YES Please help me in writing