Calling sql script from shell script
Hi,
I know this question has been asked many time in various forums, but I tried many combinations and not able to figure out what I'm missing.
Basically - I'm trying to call a sql script from a shell script.
This is my sql script (plsql.sql) -
DELCARE
v_empno NUMBER := '&empno';
BEGIN
select ename,sal from emp where empno = v_empno;
dbms_output.put_line('Inside the plsql file');
END;
This is my unix shell script - I'm caling the plsql.sql file with the parameter passed(97882). I don't get any output. at least I should be able to view the dbms output if not for the sql query inside the sql script.
#!/usr/bin/ksh
sqlplus -s sam/olo01 << HERE
@plsql.sql 97882;
HERE
What is it I am missing ?
Using your scripts (and having to create and populate a table myself, that would have what your select statement implies),
oracle:oklacity$ cat plsql.sql
DELCARE
v_empno NUMBER := '&empno';
BEGIN
select ename,sal from emp where empno = v_empno;
dbms_output.put_line('Inside the plsql file');
END;
oracle:oklacity$ cat doit.sh
#!/usr/bin/ksh
sqlplus -s sam/olo01 << HERE
@plsql.sql 97882;
HERE
oracle:oklacity$ ./doit.sh
SP2-0042: unknown command "DELCARE" - rest of line ignored.
SP2-0734: unknown command beginning "v_empno NU..." - rest of line ignored.
oracle:oklacity$
This is the kind of information you should have put in your opening post.
Similar Messages
-
Calling SQL statements from Shell scripts
Hi,
I want to call external package procedures, declare some variables & do some oracle validations in the shell script.
How SQL environment is set in shell script & is this one time process or I have to write few statements before every SQL statement.
Please explain with an example.
Thanks..is this one time process Yes. Example :
$ cat script.sh
export ORACLE_HOME=/home/oracle/base/OraHome10
export ORACLE_SID=db102
export PATH=$ORACLE_HOME/bin:$PATH
sqlplus -s / as sysdba << EOF
select to_char(sysdate,'dd/mm/yyyy hh24:mi:ss') date_time
from dual;
exit
EOF
sqlplus -s / as sysdba << EOF
col global_name for a60
select * from global_name;
exit
EOF
$ ./script.sh
DATE_TIME
27/02/2008 11:11:27
GLOBAL_NAME
DB102
$ -
Error while calling sql loader from shell script.
In the table DBMS_SCHEDULER_JOB_RUN_DETAILS im getting the error as ""SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon denied""....do we need previliges for creating session of the db user????.....or wht other settings we require to do.....if the username and password used is right.
user1122577 wrote:
SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon deniedI don't know, but somehow the error you recived looks like ORA-01017 : )
[oracle@dell ~]$ sqlplus ring/ring
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 22 11:50:58 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/ring
control = i don't have it
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:08 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-500: Unable to open file (i don't have it.ctl)
SQL*Loader-553: file not found
SQL*Loader-509: System error: No such file or directory
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/wrongpassword
control = i don't have it again
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:38 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied
[oracle@dell ~]$ -
Urgent Problem in Executing perl script from shell script
Hello,
I've a shell script on one server (source) and a perl script on another (target).
My perl script will check whether the directoryname, filename provided by shell script exists on the target server or not.
My shell script is as follows:
#! bin/bash
cmd=`ssh user@target "perl /home/user/test_dir/validate_file.pl"`
echo $cmd
And my perl script uses a package CU_Functions.pm, which is in the same directory as the perl script on the target server.
But when I invoke the perl script from shell script, I get the following error:
Source:user> (db:ias10g12_mid_db) /home/user/perl
$ sh /home/user/arcs/arcs_conn.sh
user@target's password:
Can't locate CU_Functions.pm in @INC (@INC contains: /local/perl-5.6.1/lib/5.6.1/i686-linux /local/perl-5.6.1/lib/5.6.1 /local/perl-5.6.1/lib/site_perl/5.6.1/i686-linux /local/perl-5.6.1/lib/site_perl/5.6.1 /local/perl-5.6.1/lib/site_perl .) at /home/user/test_dir/validate_file.pl line 13.
BEGIN failed--compilation aborted at /home/user/test_dir/validate_file.pl line 13.
Please let me know if I need to do any configurations prior to call the perl script.As for the Perl INC, I cannot recall the environment variable that sets that but the following example should work:
ssh user@host "export ENV_VAR=/path/to/include/files:$ENV_VAR ; /full/path/to/script" -
Calling SQL statement from a script problem
Hello,
I have a script e.g query.sh:
#!/bin/sh
sqlplus -s ${ORACLE_USER} << HIC
set heading off
set newpage none
SELECT 'ALTER TABLE '||'TEST_TABLE'||' ADD PARTITION '||' P'|| TO_CHAR(TRUNC(sysdate+7), 'IYYY')||'W'|| TO_CHAR(TRUNC(sysdate+7), 'IW')||' VALUES LESS THAN(TO_DATE('''|| TO_CHAR(sysdate + 14, 'YYYYMMDD')||''',''YYYYMMDD''));' FROM DUAL;
exit
HIC
This will actually give me: ALTER TABLE TEST_TABLE ADD PARTITION P2010W46 VALUES LESS THAN(TO_DATE('20101122','yyyymmdd'));
I am executing this output from the second script. e.g create_part.sh
#!/bin/sh
SQL=`/home/bill/scripts/query.sh`
sqlplus ${ORACLE_USER} << EOF
set serveroutput on size 1000000
set heading off
$SQL
exit
EOF
When I am running the 2nd script I am getting:
SQL> SQL> SQL> SQL> 2 ALTER TABLE test_table ADD PARTITION P2010W46 VALUES LESS THAN(TO_DATE('20101122','yyy
ERROR at line 1:
ORA-01861: literal does not match format string
I suspect that the output from the 1st script wraps to a second line, and it failes to execute properly.
Oracle is 9i
Please suggest a way to overcome this problem.
Thank you in advance.If you are not passing in any variable values that you need the shell to substitute intot he source then placing the SQL into a separate .sql file and then just using start scriptname from the shell can simplify the code especially if any shell script meta-characters like '$' appear in the SQL. Otherwise you have to escape the meta-characters.
sqlplus /nolog <<EOF
start script_name
exit
EOF
It is also possible to write the sqlplus script to accept substitution variable from the caller so the line above would look like start script_name $var1 $var2
HTH -- Mark D Powell -- -
Unable to see the sql serveroutput from shell script
Hello experts,
I have a shell script which I am using to call a pl/sql proc.
This proc writes to dbms_output.
I would like to capture the dbms_output to a file when calling sqlplus from my shell script.
Here is the code:
===============================
echo "
sqlplus apps/$APPS_PWD << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('$i');
end;
exit
ENDOFSQL
" >> new.log
===============================
What I get in the 'new.log' is given below:
===============================
sqlplus apps/prj08app << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('/oracle/apps/irc/candidateSelfService/webui/VisVacDispPG');
end;
exit
===============================
ENDOFSQL
What I would like to get is the dbms_output given by the procedure.
Please suggest.
Thanks,
VinodVinod wrote:
Hello experts,
I have a shell script which I am using to call a pl/sql proc.
This proc writes to dbms_output.
I would like to capture the dbms_output to a file when calling sqlplus from my shell script.
Here is the code:
===============================
echo "
sqlplus apps/$APPS_PWD << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('$i');
end;
exit
ENDOFSQL
" >> new.log
===============================
What I get in the 'new.log' is given below:
===============================
sqlplus apps/prj08app << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('/oracle/apps/irc/candidateSelfService/webui/VisVacDispPG');
end;
exit
===============================
ENDOFSQL
What I would like to get is the dbms_output given by the procedure.
Please suggest.
Thanks,
VinodYou need to realize & understand that EVERY command line command runs in its own separate OS process.
So the results from DBMS_OUTPUT get sent to Standard Out for the sqlplus process; which is NOT attached to your terminal.
The bottom line is you can't get there from here. -
How to call a procedure from Shell Script
Friends,
How can i call a procedure from a shell script ? If any one know the answer , let me know immediately .
Thanks in advance .
ChakksWe connect using SQLPlus commands on the Unix server:-
Our code block is below:- We've got DBMS_OUTPUT in the procedure, hence the spooling. You don't need all this, but you do need the sqlplus directory, etc... in your profile.
sqlplus -s <<EOF > ${CREATE_LOG_FLE}
$UserName/$Password@$SID
SET SERVEROUTPUT ON SIZE 1000000;
spool ${CREATE_LOG_FLE}
EXECUTE $STORED_PROC(${Months}, ${DeleteRecords});
EOF
Hope that helps -
How To Execute SQL Statements From Shell Scripts?
I need to extecute some SELECT statements from a shell scripts. Could anybody kindly tell me how to do that, or which document i should refer to ? Thank you very much!
You can execute SQLPlus with the SQL in a file (sqlplus -s @<sql-script>).
-
How to Call pl/sql procedure from shell script
Hi,
I've one procedure which takes the xml file name as input from one of the remote location. Every day users keep one file in that location.
For eg:
ACS_RPO00020110316_20110316220956.xml
ACS_RPO00020110319_20110319220956.xml
I need to read the latest file in this case. In this case second one is the latest file.
Can some body please help me how to write script to pass parameter to that procedure that via shell program and execute that.
Thanks in advance.
Regards
Nagendrahi
I executed the below mentioned steps, but I did not get any result:
I am pasting all the steps which I did
-bash-3.2$ ls -lrt
total 316
-rw-r--r-- 1 oratest dba 4884 Mar 16 03:56 XXGEBIZ_EPO160320110356.xml
-rw-r--r-- 1 oratest dba 4884 Mar 16 03:57 XXGEBIZ_EPO160320110357.xml
-rw-r--r-- 1 oratest dba 4884 Mar 16 17:52 GEBIZ_ACS_RPO00020110316_20110316175216.xml
-rw-r--r-- 1 oratest dba 38 Mar 16 18:18 GEBIZ_ACS_RPO00020110316_20110316181858.NODATA
-rw-r--r-- 1 oratest dba 63 Mar 16 22:09 GEBIZ_ACS_RPO00020110316_20110316220956.xml
-rw-r--r-- 1 oratest dba 9716 Mar 16 22:14 GEBIZ_ACS_RPO00020110316_20110316221429.xml
-rw-r--r-- 1 oratest dba 12988 Mar 17 01:42 GEBIZ_POC_RPO000EPO20110317_20110317014247.xml
-rw-r--r-- 1 oratest dba 13103 Mar 17 01:53 GEBIZ_POC_RPO000EPO20110317_20110317015356.xml
-rw-r--r-- 1 oratest dba 38 Mar 17 01:57 GEBIZ_POC_RPO00020110317_20110317015712.NODATA
-rw-r--r-- 1 oratest dba 38 Mar 17 18:44 GEBIZ_ACS_RPO00020110317_20110317184423.NODATA
-rw-r--r-- 1 oratest dba 12326 Mar 17 18:46 GEBIZ_ACS_RPO00020110317_20110317184603.xml
-rw-r--r-- 1 oratest dba 67578 Mar 18 01:32 GEBIZ_POF_RPO000EPO20110318_20110318013232.xml
-rw-r--r-- 1 oratest dba 14484 Mar 18 20:27 GEBIZ_POF_RPO000EPO20110318_20110318202754.xml
-rw-r--r-- 1 oratest dba 47653 Mar 19 01:29 GEBIZ_PYS_RPO00020110319_20110319012953.xml
-rw-r--r-- 1 oratest dba 937 Mar 21 09:34 GEBIZ_SUPP.xml
-rw-r--r-- 1 oratest dba 947 Mar 21 09:35 GEBIZ_SUPP1.xml
-rwxrwxrwx 1 oratest dba 121 Mar 21 17:43 test
-bash-3.2$
-bash-3.2$ cat > test
ls -lrt | tail -1
filelist = $(ls GEBIZ_SUPP*.xml)
for file in $filelist ; do
echo "inside loop"
file = $file
echo "file name " $file
done
XGBZ_SUPP_MAST_XMLTAG_PROC $file
-bash-3.2$ chmod 777 test
-bash-3.2$ ./test
-bash: ./test: Text file busy
-bash-3.2$
Initially I listed down all the files, in a sample file I've written the steps. But nothing is executed.
One thing I want to ask here XGBZ_SUPP_MAST_XMLTAG_PROC is my procedure. I think I need to invoke sqlplus in the so as to execute my pl/sql script.
Gurus, please let me know how to write them.
Regards
Nagendra -
Problem while calling concsub from shell script
Hi All,
I am facing problem when I am trying to run CONCSUB utility from shell script.The same works well when I try it from command line.The only prob I am facing from shell script is assigning values to temporary variables.
This is how my script looks
#!/bin/bash
export PARM5="$5"
export PARM6="$6"
export PARM7="$7"
echo "INTPARM5=\"$PARM5\""
echo "INTPARM6=\"$PARM6\""
echo "INTPARM7=\"$PARM7\""
echo $FND_TOP/bin/CONCSUB $1 ONT 'Order Management Super User, Vision Operations (USA)' $3 WAIT=Y CONCURRENT ONT $PROGRAM "$INTPARM5" "$INTPARM6" "$INTPARM7"When I try to run the above shell based concurrent program it doesn't pass the parameters as expected and it errors out saying "Wrong number of arguments to call the procedure"
I tried my luck from some of the previous posts ({thread:id=2360776} ),but to vain
If anyone has any ideas,please suggest!!
Thanks in advance!!
Edited by: sandy on May 4, 2013 12:54 PMHere are your proofs
Proocedure
PROCEDURE abc(--p_errbuf OUT VARCHAR2,
--p_errcode OUT VARCHAR2,
p_order_no IN NUMBER DEFAULT NULL,
p_customer_id IN NUMBER DEFAULT NULL,
p_name IN VARCHAR2 DEFAULT NULL
IS
v_cname VARCHAR2(200);
v_ordered_date DATE;
v_order_number NUMBER;
v_order_type VARCHAR2(200);
BEGIN
fnd_file.put_line(fnd_file.output, 'Begin Execution');
SELECT DISTINCT ac.customer_name,
d.ordered_date ordered_date,
d.order_number order_number,
x.NAME order_type
INTO v_cname
,v_ordered_date
,v_order_number
,v_order_type
FROM oe_order_headers_all d,
oe_transaction_types_tl x,
wsh_delivery_details b,
wsh_delivery_assignments c
,ar_customers ac
WHERE 1 = 1
AND ac.customer_id = b.customer_id
AND d.order_type_id = x.transaction_type_id
AND x.LANGUAGE = 'US'
AND b.released_status = 'B'
AND b.source_header_id = d.header_id
AND c.delivery_detail_id = b.delivery_detail_id
AND d.order_number=NVL(p_order_no,d.order_number)
AND ac.customer_id = NVL(p_customer_id,ac.customer_id)
AND x.name=NVL(p_name,x.name)
AND NOT EXISTS (SELECT 1
FROM wsh_delivery_details b
WHERE 1 = 1
AND b.released_status != 'B'
AND b.source_header_id = d.header_id)
--BETWEEN ('1213794') and ('1213797'))
AND rownum<2;
INSERT INTO xxc_temp(customer_name,ordered_date,order_number,order_type) VALUES(v_cname,v_ordered_date,v_order_number,v_order_type);
COMMIT;
fnd_file.put_line(fnd_file.output, 'Order Number is' || v_order_number);
fnd_file.put_line(fnd_file.output, 'Order Type is' || v_order_type);
END;Script
#!/bin/bash
set -x
export PARM5="$5"
export PARM6="$6"
export PARM7="$7"
sqlplus -s $1 <<EOF
set head off feed off serverout on size 1000000
exec abc('$PARM5','$PARM6','$PARM7');
exit
EOFNow when I run the 'XX Order Detail CSV Report' I get the below log and no Output
+---------------------------------------------------------------------------+
Application Object Library: Version : 12.0.0
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXKES_PDF_TRANSFER module: XX Order Detail CSV Report
+---------------------------------------------------------------------------+
Current system time is 06-MAY-2013 05:05:56
+---------------------------------------------------------------------------+
+ export PARM5=66432
+ PARM5=66432
+ export PARM6=
+ PARM6=
+ export PARM7=Mixed
+ PARM7=Mixed
+ sqlplus -s APPS/APPS
+---------------------------------------------------------------------------+
Executing request completion options...
Output file size:
0
+------------- 1) PRINT -------------+
Disabling requested Output Post Processing. Nothing to process. The output of the request is zero byte.
+--------------------------------------+
Finished executing request completion options.
+---------------------------------------------------------------------------+
Concurrent request completed successfully
Current system time is 06-MAY-2013 05:05:56
+---------------------------------------------------------------------------+After the concurrent program executed I queried the table xxc_temp and here you see the data
SQL> select * from xxc_temp;
CUSTOMER_NAME
ORDERED_D ORDER_NUMBER ORDER_TYPE
A. C. Networks
18-FEB-13 66432 MixedMy procedure fetches the data fro given set of i/p parameters but it doesn't give o/p coz it's a host based conc program.Please advise if there's a way to get the o/p in a host based conc program
Thanks!! -
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 -
Passing params from SQL file to Shell Script and then from Shell to SQL Fil
Afternoon guys,
Have a fun question for all you gurus in shell scripting out there. I have a shell script that is calling 2
different SQL programs. My objective is to pass a variable called request_number from one sql program
to the shell script and then from the shell script back to another SQL program. I will explain why I
need this to happen.
Here is what the shell script looks like which calls sql programs student_load_a.sql and
student_load_b.sql. Student_load_a.sql basically creates the control file (.ctl) which is needed for the
SQL*Loader and then student_load_b.sql reads the table that was just loaded and does the main
processing. My main objective here is to be passing the request_number which is being generated
using an Oracle Sequence in student_load_a.sql and using this generated number in my main
processing in student_load_b.sql to select records from the table based on request_number.
Any ideas ?Any help or recommendations is welcome and appreciated.
*1. Shell Script*
# Accept system input parameters
p_user_id=$1
p_job_id=$2
# Create control files for sqlload
sqlplus.exe -s $p_user_id @$STUDENT_PATH/student_load_a.sql $p_job_id
exit_status=$?
# Do sqlloads
sdesqlldr.exe userid=$p_user_id control=student_load-$p_job_id.ctl \
log=student_load-$p_job_id.log \
bad=student_load-$p_job_id.bad
exit_status=$?
# Main processing
# sqlplus.exe -s $p_user_id @$STUDENT_PATH/student_load_b.sql $p_user_id $p_job_id $p_request_number
sqlplus.exe -s $p_user_id @$STUDENT_PATH/student_load_b.sql $p_user_id $p_job_id
exit_status=$?
exit 0*2. student_load_a.sql (Would like to pass back the Sequence Number back to shell script and then use in student_load_b.sql*
-- Accept system input parameters
define p_job_id = &1
spool student_load-$p_job_id.ctl
select
'append into table TMP_STUDENT_LOAD
FIELDS TERMINATED BY '','' optionally enclosed by ''"''
trailing nullcols
(request_number CONSTANT ' || '''' || request_number_seq.nextval || ''',
student_id)'
from dual
spool off;
exit 0;
{code}
*3. student_load_b.sql (This is a big file so I am only adding code that is relevant for the SQL)*
{code}
declare
v_request_number number(6);
v_student_id number(7);
cursor cur_student_load is
select student_id
from TMP_STUDENT_LOAD
where request_number = v_request_number
order by 1;
begin
v_user_id := '&1';
v_job_id := &2;
-- This is the variable I would like to be be passing from shell script to student_load_b.sql
-- v_request_number = '&3';
open cur_student_load;
fetch cur_student_load into v_student_id;
exit when cur_student_load%notfound;
.... more logic of if then else in here
close cur_student_load;
end;
{code}
Edited by: RDonASnowyDay on Jan 29, 2010 4:03 PMHow come you are mixing WinDoze script (*.exe) with Unix?
You are aware that you will be passing the password along with the user id to the second sql script?
I will assume Unix ksh:
# Accept system input parameters
p_user_id=$1
p_job_id=$2
# Create control files for sqlload
p_seqno=`sqlplus -s $p_user_id @$STUDENT_PATH/student_load_a.sql $p_job_id`
exit_status=$?
# Do sqlloads
sqlldr userid=$p_user_id control=student_load-$p_job_id.ctl \
log=student_load-$p_job_id.log \
bad=student_load-$p_job_id.bad
exit_status=$?
# Main processing
# sqlplus -s $p_user_id @$STUDENT_PATH/student_load_b.sql $p_user_id $p_job_id $p_request_number
sqlplus -s $p_user_id @$STUDENT_PATH/student_load_b.sql \
$p_user_id $p_job_id $p_seqno
exit_status=$?
exit 0And the first sql script would look like this:
-- student_load_a.sql
-- Accept system input parameters
set echo off pages 0 feed off lin 80 trims on ver off
def p_job_id = &1
col seqno NEW_VALUE seqno
select request_number_seq.nextval seqno from dual;
set term off
spool student_load-$p_job_id.ctl
select
'append into table TMP_STUDENT_LOAD
FIELDS TERMINATED BY '','' optionally enclosed by ''"''
trailing nullcols
(request_number CONSTANT ''&&seqno'',
student_id)'
from dual
spool off;
exit 0;
{code}
:p -
Accept input from Shell script in sql*plus
Hey! Guys..
i need the following info.
I am running a shell script from sql*plus. I need to accept a value from shell script into my .sql file.
thanks..
Harsh.prompt for input, pass to another shell
# contract_status_prompt.sh
read udate?"Enter week-ending date in format dd-mmm-yyyy: "
contract_status_update.sh $udate >$FDWLOG/current/contractstatusupdate`date +%d%h%y`.log
echo `date`
# End contract_status_prompt.sh
Read the variable passed and use in SQLPlus:
# contract_status_update.sh
echo "Running contract_status.sh"
echo "create records for contract_status"
echo `date`
echo " "
echo " date used is "; print $1
echo " "
sqlplus <<exit
@$FDWSQL/sqlparms
set time on
prompt *** Set contract_status_period ***
update contract_status_period
set period_date = '$1';
commit;
exit
etc. -
Can I call host file ( Unix Shell script ) from Oracle 10g trigger
Hi,
I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
thanks & regards
paraguser12009546 wrote:
Hi,
I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
thanks & regards
paragIf you are in 10g, you can simple call shell script from DBMS_SCHEDULER:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'TEST_SCRIPT',
job_type => 'EXECUTABLE',
job_action => 'PATH_OF_YOUR_SCRIPT',
start_date => SYSDATE,
repeat_interval => 'FREQ=MINUTELY; INTERVAL=1',
enabled => TRUE,
comments => 'Shell script from Oracle'
END;
/ -
Calling a java code from shell script.
Hi all,
I want to access a method of java class from a unix shell script.basiacally I want to know how to access a java code from a shell scriptt.If anybody has any info on this , kindly revert back to me.
Rgds,
SatyaHi,
Suppose I hv a main() method.
Then how to access that class from Shell Script.
Can u send me the piece os compiling and running process for it.
Rgds,
Satya
Maybe you are looking for
-
Report for login and logout time
Dear All, Please can some one help me urgently. I have to find out users login and logout time over the last six months. I need to find out how many hours per user are being used. What report do I need to run to find out ?
-
Networked printer no longer recognized??
I've had the same setup working perfectly for months, I haven't changed a thing. My internet connection is maintained wirelessly through the airport extreme, to my cable modem, and works fine. Also, I have a printer and an external hard drive connect
-
Battlefield 3 on a Imac 27" possible?
Hello everyone, I think i gonna buy an Imac 27" 1 ghz gpu 3.1 ghz i5. But is it possible to play battlefield 3 on it, with boot camp and windows 7? Greet, Henk-Jan Leusink
-
Why when i plug my ipad in to chargr it says not charging
when i plug my ipad in to charge it says not charging how do i charge it
-
How to Top up Bank account with cash
Hi Experts, Can you give us a Configuration method to top up the Bank account with cash? i.e., I need to top-up the house bank with some money. With Regards Siva