Get PLSQL stored procedure in unix shell script
Hi Experts,
I have a PLsql procedure with the specification below-
PROCEDURE SEND_INV_VIA_EMAIL (p_pdf_file_name IN VARCHAR2, p_submitted_frm IN VARCHAR2);
I can pass two parameters of SHELL script and it works fine-
# By calling the PLSQL procedure
sqlplus-s $APPS_USER < < EOSQL
SET SERVEROUTPUT SIZE 1000000
whenever sqlerror exit 1;
run MOB_XMLPUB_ARCHIVE_ARINV_PCK.send_inv_via_email ("basename $DATA_FILE", "ARCHIVE");
"exit";
EOSQL
But now I want to have an output in the plsql procedure parameter-
PROCEDURE SEND_INV_VIA_EMAIL (p_pdf_file_name IN VARCHAR2, p_submitted_frm IN VARCHAR2, p_return_status IN OUT VARCHAR2);
based on this I want to determine the concurrent request completion status since the shell script is called via the simultaneous program.
How will pass parameter out of the shell and how do I use this parameter in the SHELL script to determine completion status?
Thank you very much.
Vikrant
Something like this:
# By calling the PLSQL procedure
sqlplus-s $APPS_USER<>
SET SERVEROUTPUT SIZE 1000000
whenever sqlerror exit 1;
declare
rstatus varchar2 (100) - or however long, it must be
Start
MOB_XMLPUB_ARCHIVE_ARINV_PCK.send_inv_via_email ("basename $DATA_FILE", 'ARCHIVE', rstatus);
dbms_output.put_line (' status = ' | rstatus);
end;
/
"exit";
EOSQL
grep 'Return status =' somefile
Tags: Database
Similar Questions
-
How to validate SQL * MORE connection in Unix shell script
I wrote the following function in unix shell script to validate SQL * MORE connection and throw a user-defined message.
function check_db_conn
{
output | sqlplus-s-L $User/$Password@$SID >/dev/null
If [[$?-no 0]]; then
echo 'credentials incorrect DB.
FI
}
However, I would like to change this feature so that the user has entered a good connection and that there is a problem with TNS listener must display the appropriate message.
Hello
Try adding:
lsnrctl status $listener_name > /dev/null if [[ $? -ne 0 ]]; then echo "Issue with Listener" fi
-
Call the OBIEE Unix Shell Script
Hi all
Is it possible to make a call to a Unix Shell Script with the framework of the Action of OBIEE.
Thanks in advanceI don't think, but we can go for it instead side BI. Try to transfer the same features side shell script so that the script can identify your report using the tail of the log nqquery and execute the rest of your lines in shell script.
This can done and works as expected. If you identify your report instead of this long logical query at all with my suggestion that you can go for a little keyword.
Score pls help if
-
Re: Unix shell script to notify if an array has reached a number of lines
Looking to write a script to send an alert notification when an Oracle database table object reaches a certain value of line number. If anyone has the logic "If this while" for a script shell unix would be great.
With the logic of control and check on the table when it reaches the total line number can be added to the script and on-demand via cron.
Thank you.
Thus, you must periodically (how often?) a COUNT (*) on the target table? Is this acceptable overhead?
/Korn Bourne shell scripts can compare numbers and check if one is greater than another. See "-gt" UNIX - Shell basic operators
Hemant K Collette
-
The call PLSQL stored procedure from the HTML form Submit button
Hello
I'm having a little difficulty with the appellant a stored procedure using a html form button. Here is the code I have right now...
Here's the question - I need to find a way to pass variables to this stored procedure, so he knows what data to operate on. This stored procedure removes the data in a specific database record and I have to pass three variables to this procedure to run.HTP.PRINT('<form action=ZWGKERCF.P_confdelete>'); HTP.PRINT('<input type=''submit'' value='' Yes '' onClick=''document.getElementById("mypopup").style.display="none"''>'); HTP.PRINT('</form></div>');
Allows to call class_number, term, conf will impact these three variables and the data will be deleted and the person will see a confirmation screen once the deletion request completed.
So ideally I would want: ZWGKERCF. P_confdelete (class_number, term, conf), then the stored procedure would deal with the rest!
Seems simple enough, but I don't know how to make this happen... My thoughts were:
Transmit data to this (the three areas that I need) html form in hidden variables. Then somehow pass them using the POST method to the procedure and read using GET?
Can someone clarify what the best way to do it? I feel that its little something miss me you - but I would really like an idea expertise :-)
Thank you very much in advance!
-Jeff>
...I would like to assign a variable, the duration, the conf crn all variables in this procedure and then act on them accordingly.
But you already have it in a variable. If you want you can assign the value again to another variable.
example of
PROCEDURE P_confdelete(CRN NUMBER,TERM NUMBER, CONF VARCHAR2) IS v_crn number(38); v_term number(38); v_conf varchar2(1000); BEGIN HTP.PRINT('test1 '||crn||'/'||term||'/'||conf); v_crn := crn; v_term := term; v_conf := conf; HTP.PRINT('test2 '||v_crn||'/'||v_term||'/'||v_conf); END P_confdelete;
-
How2 validate the chain of connection in unix shell script
I am writing a shell script unix which removes the instance user/passwd/user, form a connection string and pass it to sqlplus. Now, I want to validate if a valid/clean connection string was formed. Basically, I want to do something like below
sqlplus-s $CONN_STR
and disconnect if valid string and always disconnect and return to guest if it's not a string valid.
Is there a clean way, I can check if the return has been after a successful login and how disconnect it in script and check if a string is not valid.Create a file name test.sql containing only the OUTPUT and use-L option to SQL * more (attempts to connect only once, instead of reprompting error.)
D:\>sqlplus -L hr/ko@XE @test.sql SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 17 08:48:37 2010 Copyright (c) 1982, 2007, Oracle. All rights reserved. ERROR: ORA-01017: invalid username/password; logon denied SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus D:\>echo %errorlevel% 1 D:\>sqlplus -L hr/hr@XE @test.sql SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 17 08:48:49 2010 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production D:\>echo %errorlevel% 0 D:\>sqlplus -L hr/hr@KO @test.sql SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 17 08:52:22 2010 Copyright (c) 1982, 2007, Oracle. All rights reserved. ERROR: ORA-12154: TNS:could not resolve the connect identifier specified SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus D:\>echo %errorlevel% 1
-
DBMS_SCHEDULER - trying to create and run a UNIX shell script from Oracle
How can I run Script Shell Unix from Oracle using DBMS_SCHEDULER?
After reading many examples online, I finished the 3 steps below.
Create program, create jobs, run task. On my 3rd stage, I get the following error.
How can I make sure that the work was created?
ORA-27475: "APPS. POSPAY_FILE_CHECK_JOB' must be work
(1) create the program
(2) create jobsBEGIN dbms_scheduler.create_program( program_name => 'POSPAY_FILE_CHECK_PROG', program_type => 'EXECUTABLE', program_action => '/home/ldcgroup/ldccbc/POSPAY_USC2_CHECK.sh', number_of_arguments => 0, enabled => TRUE, comments => 'Test Program' ); END;
(3) the job (not calendar, I'll run this a concurrent request of EBS)BEGIN DBMS_SCHEDULER.CREATE_JOB ( job_name => 'POSPAY_CHECK_FILE_JOB', program_name => 'POSPAY_CHECK_FILE_PROG', enabled => TRUE); END; /
BEGIN DBMS_SCHEDULER.run_job ( job_name => 'POSPAY_FILE_CHECK_JOB'); END; /
Of [documentation | http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/scheduse002.htm#i1009668]
The job is created disabled. You must enable it with DBMS_SCHEDULER.ENABLE before the Scheduler will automatically run it. Jobs are set to be automatically dropped by default after they complete. Setting the auto_drop attribute to FALSE causes the job to persist.
-
OEDQ 9.0.8 - external task - execution of Shell Script
Hello Disqualification Experts.
I am looking for your expert advise on this... With the help of the external task I am able to call the .bat (batchfiles) but I'm not able to run .ksh (UNIX shell script file), attached is the example script I am trying to run via the external task.
File name: testfile.ksh
#! / usr/bin/ksh
Set - x
$ORACLE_HOME/bin/sqlplus - s edq_test/edqtest@edqd < < EOF
WHENEVER SQLERROR EXIT SQL. SQLCODE
EXECUTE SP_TRUNCATE_TABLE ('ABC_OWN', 'ABC_TABLE');
COMMIT;
quit smoking;
EXPRESSIONS OF FOLKLORE
output
Disqualification-> Manager-> External tasks-> Creates a new task called TestTask who has the below...
Command: testfile.ksh
Working directory: \opt\local\software\edq\config\commandarea
Get this error Message:
The external task (Execute testfile.ksh) failed because of the following exception: cannot run program "/ opt/local/software/edq/config/commandarea/testfile.ksh": error = 2. No such file or directory
Thanks in advance!
BG
Dear Richard, thank you for your prompt response.
# / bin/bash helped and I also have to export the ORACLE_HOME in the script, somehow the $ORACLE_HOME is not recognized by the external task.
Example of Script working:
#! / bin/bash
export ORACLE_HOME=/ora02/oracle/product/11.2.0.4/client
$ORACLE_HOME/bin/sqlplus - s edq_test/edqtest@edqdev<>
WHENEVER SQLERROR EXIT SQL. SQLCODE
EXECUTE SP_TRUNCATE_TABLE ('ABC_SCHEMA', 'ABC_TABLE');
COMMIT;
QUIT SMOKING;
EXPRESSIONS OF FOLKLORE
output
Thanks for your help!
BG
-
Query does not not in shell scripts
Hi Experts,
I created a query to check the temp tablespace use in production servers and I wanted to run the query using shell scripts, but when I run the query in the script I get no error or output I am unale to correct where exactly, I make the mistake
This is the query
SELECT A.tablespace_name 'space', D.gb_total, ROUND (SUM (A.used_blocks * D.block_size) / 1024 / 1024/1024,2) "gb_used", ROUND (D.gb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024/1024,2) 'gb_free' v$ \sort_segment A, (SELECT B.name, C.block_size, ROUND(SUM (C.bytes) / 1024 / 1024/1024,2) 'gb_total' v$ \tablespace B, v$ \tempfile C WHERE B.ts #= C.ts # GROUP BY B.name, C.block_size) D WHERE A.tablespace_name = D.name GROUP by A.tablespace_name D.gb_total
You can help in this.
Thank you...
Basic Linux/Unix shell script format
#! / bin/sh
oracle set environment #.
Export ORACLE_HOME =...
export of SID =... or TWO_TASK = export
.. etc.
# launch sqlplus
sqlplus-s/nolog<>
Connect scott/tiger
together... environment of sqlplus
-execution of script sql (or sql query)
@script.sql
output
EXPRESSIONS OF FOLKLORE
#end script
Character $ is interpreted by the shell as environment variables, you must escape the $ character is as well as it not assimilated to the variable approx.
For example, v$ instance should be written as v$ instance.
-
Component sql through shell script
How to call a sql through UNIX shell script file?Rahul India wrote:
export ORACLE_HOME=$ORACLE_BASE/product/10g cd $ORACLE_HOME set `sqlplus -s
/ < THIS SCRIPT IS OK?
You will also need to set ORACLE_SID
And I don't know why everyone puts the reference to sqlplus context of a 'set' assessment, nor why they put the reference to Scripture in a redirected input stream. What you need is
sqlplus -s user/password @r_100.sql
And to make sure the environment is set correctly:
export ORACLE_SID=whatever export ORAENV_ASK=NO . oraenv unset ORAENV_ASK=NO sqlplus -s user/password @r_100.sql
-
I am new to shell scripting, I've heard of him, but that's all.
Can a DBA, someone recommend me to websites that I can learn UNIX shell script from the point of view of Oracle DBA?
I would like to see what I can do with UNIX Shell script as a DBA.http://www.orafaq.com/wiki/scripts#Unix_Shell_Scripts
A good collection of Shell script for oracle dba.
HTH
Girish Sharma -
Insert a record, call a stored procedure and execute a shell script
Hello
I am trying to build a page APEX do these three things in order.
#1. Insert a new record in a database table (pk, donnees_xml, attr1 and attr2, etc.) and download the XML file to the donnees_xml column
#2. Save this XML file on a file system
#3. Parse the XML file on a file system and update the database with the parsed data table
I can do #1 with a regular shape based on the database table. I can do #2 with a stored procedure.
I can do #3 with a shell script.
I wonder how these tasks can be combined into a single action in APEX.
do #1;
If successful, do #2;
If successful, do #3;
I'd appreciate comments on this.
Thank you
Define a process of PL/SQL page submit that runs after the record is inserted, if P1_FILE is not null.
-
Unzip the file sys of operation or execute an Oracle stored procedure shell script
Y at - it a package or something else I can use a procedure stored Oracle to decompress a file of the operating system or run a shell script? Have Oracle 11g 2, Linux Redhat. I am familiar with utl_file to look at properties, open, close, write files, etc., but am looking for a way to decompress a file or run a shell script.Without papers, and likely or very likely not supported
http://technology.AMIS.nl/Blog/5307/Oracle-database-directory-listing-with-ls-function
There are JVM/Java alternatives to it. Search asktom.oracle.com
Published by: Marco Gralike on August 23, 2011 22:31
-
Pass the Shell script variable to the plsql block
Hello
I have a shell script and pass the parameter of Shell script in a PLSQL block, I use the code but impossible to get any result, below
Can someone help me with this issue?
Shell script: test.sh
* #! / bin/sh *.
var1 = $1
SQLPLUS = 'sqlplus-s ".
Login = "gmisowner/gmisowner1".
day ='$SQLPLUS $LOGON < < ++
set the position
Set feedback off
Start
select count () from mis_ref_codes where ref_description = & var1; *
end;
"exit";
++`
echo $day
Execution at the command prompt: >./test.sh Underline
returns nothing
1. I was hoping the count (*) in the number of lines in him select statement is stored in the day, but nothing returned as output of the plsql block
the select statement above is an example, but I'll have to run a much larger plsql block
I have syntactically doing something wrong? Please suggest
Published by: Camilla January 14, 2012 12:35First of all you needget get rid of anonymous PL/SQL block:
var1=$1 SQLPLUS="sqlplus -s" LOGON="gmisowner/gmisowner1" day=`$SQLPLUS $LOGON <<++ set heading off set feedback off select count(*) from mis_ref_codes where ref_description=&var1; exit; ++` echo $day
But it still does not work. Your SQL * more script a proxy & var1. It has nothing to do with shel environment variable var1. That is why SQL * PLus prompts you to enter the value just after she readings
Select count (*) in the mis_ref_codes where ref_description = &var1;
And since you redirected input to your script, you must put value of var1, which isn't what you want, right? So what you need is:
dev > # I'll set $1 to X
dev > set X
dev > var1 = $1
dev > SQLPLUS = 'sqlplus-s ".
dev > login = ' / '.
dev > ='$SQLPLUS $LOGON < < EOF
> set position
> leave your comments
> set verify off
> select ' Have a nice day! "twice where dummy ="$var1 ";
> "exit";
> EOF'
dev > echo $day
Good day!
dev >SY.
Published by: Solomon Yakobson on 13 January 2012 15:17
-
Problem to run the shell script procedure
Hello
I wrote a shell script which needs to execute the stored procedure
The shell script:
The script gets two parameters: id (1) (2) the procedure that I have to runcat bi_loading2.sh #!/usr/bin/ksh export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/11.2.0/DWH11gR2 export ORACLE_SID=DWH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib echo "zero arg is :$0" echo "First arg is :$1" echo "Second arg is :$2" /u01/app/oracle/product/11.2.0/DWH11gR2/bin/sqlplus system/xxx@dwh << EOF insert into SYSTEM.POC_EXDATA_RESULTS values($1,'$2',sysdate,null); commit; execute system.$2; update SYSTEM.POC_EXDATA_RESULTS set end_date=sysdate where id= $1; commit; EOF exit 0
As you can see below oracle is to omit the 'run' command
Please notice why I can't run the stored procedure.
$ 83 poc_cf54xbx6cchf2 bi_loading2.shzero arg is :bi_loading2.sh First arg is :83 Second arg is :poc_cf54xbx6cchf2 SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 15 17:46:37 2011 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Automatic Storage Management and Real Application Testing options SQL> 1 row created. SQL> Commit complete. SQL> SQL> SQL> BEGIN system.poc_cf54xbx6cchf2; END; * ERROR at line 1: ORA-06550: line 1, column 17: PLS-00103: Encountered the symbol "SYSTEM" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "SYSTEM" to continue. SQL> SQL> 2 3 4 rows updated. SQL> Commit complete.
Read the error stack.
ORA-06512: at "SYSTEM.POC_CF54XBX6CCHF2", line 3
The error is on line 3 of the POC_CF54XBX6CCHF2 procedure
If the procedure is called.----------
Sybrand Bakker
Senior Oracle DBA
Maybe you are looking for
-
Printing pictures - I'm trying to print a photo 8 x 10 inches of a 4 x 6 print.
I am trying to print a photo 8 x 10 inches from a 4 x 6 print. I've done it before without problem. When I select 8 x 10, my printer prints a 4 x 5. If I select four 3 x 5 prints, for example, I get four separate draws on four separate pages. The
-
* Original title: DRIVER PROBLEM I recently updated my win windows 7 ultimate version premium. I had received some sort of notification messages about ITS peripheral WD. After which, my windows was left produced more authentic steps. So I have to upg
-
Questions of torch for blackBerry Smartphones
UPDATE: I have blackberry maps once again, but he doesn't locate me well that google maps doesn't. I know that my GPS works but not on blackberry maps. Help, please. I thank very you much for your time. Hello I have problems with blackberry maps on m
-
When I burn music to a cd with Windows Media Player recording resulting is too fast. In other words, the recording on the cd looks like "The Chipmunks". Why is this?
-
How to re-install first CC 2015.2 Speedgrade compatibility?
I know since the release of CC 2015.3 there were other frustrated by not being able to use Speedgrade. Not only no longer be able to use it, but not being able to work in or export older projects. I'm one of those people. I saw in the forums that