Execute stored procedure from batch file
Hi,
can someone helpme hoe to run my stored procedure from a bacth file. I need it urgently. Can some one help
Thanks,
Sri
Hi,
You can perform the below step..
1) Create .sql file and write the line as shown below there....
exec your_procedure_name
2) create .bat file containing authentication
sqlplus username/password@databasename @.sqlfilename
suppose i have a procedure called test then and my database name is oracle and user name is scott then i will create a file like
.sql file.. and sql file name is proc.sql
exec test {(parameter if any)};
.bat file
sqlplus scott/tiger@oracle @procIf you have any issue past here..
Similar Messages
-
Executing Stored procedure from host file
Hi all,
I am trying to execute a procedure from a host file.I don't know where I am doing wrong but the procedure is not executing.
#!/bin/bash
echo "*********************** Initializing Global Variables ***********************"
export CONNECT_STRING=$1
export START_TIME=`date +%m/%d/%Y:%H%M`
#export DATE_FROM=`date +%m/%d/%Y:%H%M`
#export DATE_TO=`date +%m/%d/%Y:%H%M`
DATE_FROM=$5
DATE_TO=$6
sqlplus -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S ${CONNECT_STRING} <<EOF
WHENEVER SQLERROR EXIT FAILURE
set echo off
execute xxjy_extract_ar_transactions.main_preinterface('$DATE_FROM','$DATE_TO');
EOF
echo "From Date is $DATE_FROM"
echo "To Date is $DATE_TO" In my log i can see the From Date is 1-Jan-2013 and To date is 28-Feb-2013 which are my input parameters to concurrent program.But I don't understand why my procedure is not getting called.
Please advice.
Thanks,
SandeepPlease post the details of the application release, database version and OS.
Is the issue with this specific host concurrent program?
Did you follow the steps in these docs?
How to Register a Host Concurrent Program in Applications [ID 156636.1]
How To Create A Custom Concurrent Program With Host Method and Pass Parameters To The Shell Script [ID 266268.1]
How Do You Run A Unix Host Script From Concurrent Managers On MS Windows Platform? [ID 412392.1]
How To Setup A Custom Concurrent Host Program [ID 147455.1]What is the reason of using more than one "-S" in the sqlplus command?
Please enable trace and generate the TKPROF file to find out what is happening when you kick off this concurrent program?
FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]
How To Trace a Concurrent Request And Generate TKPROF File [ID 453527.1]
Thanks,
Hussein -
Execute Stored Procedures from Stellent
Can we execute stored procedures from stellent 7.5.2 ?
By using java, I dont find any method to execute stored procedure from WorkSpace interface.
Please guide me to solve this..
Appreciate your help and efforts.May not be exactly what you're looking for, but I hope this helps:
http://www.corecontentonly.com/Blog/Calling-A-Stored-Procedure-From-Oracle-Fusion-ECM-Stellent
For java based execution basically:
1. Create your stored proc in the db
2. Create a component
3. Create a query resource
4. In your java code use the createResultSet method of the Workspace object and pass in the name of your query resource and then the current databinder object -
Execute stored procedure from TestStand
I am having difficulty executing a stored procedure from the TestStand Database step types. I am using the "Data Operation" step type to set the input parameter, but I still get the following error;
Procedure or function 'sproc_prior step' expects parameter '@serial_number', which was not supplied.
I've attached the sequence file for review.
Any help would be appreciated.
Attachments:
db Stored Procedure1.seq 9 KBWe were able to fix this sequence by making the following changes:
1.) In the Open SQL Statement change the Command Type to Stored Procedure instead of Default.
2.) On the Get Results step change the Operation to Get - Retrieve Values from Record instead of Close since the Close SQL Statement takes care of that for you.
3.) Also change the Record To Operate On to Current - Use Current Record.
After making these changes the sequence should work. Also note, that it would be preferable to change the stored procedure name to us all underscores and not spaces since this is more standard for use with databases.
John B.
Applications Engineer
National Instruments -
Facing error while trying to execute stored procedure from JSF Application
Hi, I am facing the below error when I try to execute a stored Procedure from JSF application which is deployed on WAS 7.0
=2013-03-04 19:06:58,550 INFO [com.lloydstsb.iw.util.DBUtils] - DBUtils : executeFileNetStoredProc method started..
=2013-03-04 19:11:58,271 ERROR [com.lloydstsb.iw.dao.FileNetCustomDBSynchDAOImpl] - Data Access Exception
com.lloydstsb.iw.common.exceptions.DataAccessException: Data Access Exception Occured : Integration Stored Proc- java.sql.SQLException: java.lang.ClassCastException: oracle.jdbc.driver.LogicalConnection incompatible with oracle.jdbc.OracleConnection
at com.lloydstsb.iw.util.DBUtils.executeFileNetStoredProc(DBUtils.java:959)
at com.lloydstsb.iw.util.DAOUtil.executeFileNetStoredProc(DAOUtil.java:117)
at com.lloydstsb.iw.dao.FileNetCustomDBSynchDAOImpl.updateFileNetDetailsCustomDB(FileNetCustomDBSynchDAOImpl.java:36)
at com.lloydstsb.iw.servlet.IndexServlet.service(IndexServlet.java:127)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:859)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)
The oracle version we are using is 11g.
Previously it worked fine when the application was used in 10g.
Can someone please help me in resolving this issue?
Kiran
Edited by: 991640 on Mar 4, 2013 8:25 PMjava.lang.ClassCastException: oracle.jdbc.driver.LogicalConnection incompatible with oracle.jdbc.OracleConnection
Are the the JDBC JARs packaged with the application? If so, remove the applicaiton packaged JDBC JARs as the JARs are also in WebSphere application server. -
Problem in executing Stored Procedure from Trigger
Hi,
Case1.
I am executing a stored procedure form a trigger. The stored procedure is not executing fully.
Case 2.
But when when I execute Stored Procedure alone it is executing.
CREATE OR REPLACE TRIGGER mhubadmin.call_proc_ratesheet_new
after INSERT OR delete ON mhubadmin.pvt_br_ratesheet
FOR EACH ROW
declare
var_orgid number;
begin
if inserting then
select org_child_id into var_orgid from business_relationship where br_id=:new.br_id;
mhubadmin.proc_ratesheet_new(var_orgid);
else
select org_child_id into var_orgid from business_relationship where br_id=:old.br_id;
mhubadmin.proc_ratesheet_new(var_orgid);
end if;
end;
CREATE OR REPLACE PROCEDURE proc_ratesheet_new(var_orgid in number)
IS
cursor c3 is select distinct(purs.user_id) from hubuser hu
inner join PVT_USER_RATESHEET purs on hu.USER_ID=purs.USER_ID
where hu.ORG_ID=var_orgid;
cursor c1(varUser_id number) is select purs.user_id,purs.ratesheet_id from hubuser hu
inner join PVT_USER_RATESHEET purs on hu.USER_ID=purs.USER_ID
where hu.ORG_ID=var_orgid and purs.USER_ID=varUser_id;
cursor c2(varUser_id number) is select hu.user_id,pbr.ratesheet_id from HUBUSER hu
inner join BUSINESS_RELATIONSHIP br on hu.ORG_ID=br.ORG_CHILD_ID
inner join PVT_BR_RATESHEET pbr on br.BR_ID=pbr.BR_ID
where hu.user_id in(select distinct(purs.USER_ID) from hubuser hu
inner join PVT_USER_RATESHEET purs
on hu.USER_ID=purs.USER_ID
where hu.ORG_ID=var_orgid) and hu.user_id=varUser_id;
foundFlag boolean;
incrFound integer;
insertFound integer;
deleteFound integer;
str varchar2(4000);
BEGIN
incrFound:=0;
insertFound:=0;
for c3var in c3 loop
for c2var in c2(c3var.user_id) loop
insert into test values ('Step3:'||c2var.user_id);
foundFlag:=false;
for c1var in c1(c3var.user_id) loop
if c2var.ratesheet_id=c1var.ratesheet_id then
foundFlag:=true;
incrFound:=incrFound+1;
exit;
end if;
end loop;
if foundFlag=False then
--insert into pvt_user_ratesheet (username_ratesheet_id,user_id,ratesheet_id) values (SEQ_USER_RATESHEET.nextval,c3var.user_id,c2var.ratesheet_id);
dbms_output.put_line('Inserted for user :'||c3var.user_id||' is - ratesheet :'||c2var.ratesheet_id);
insertFound:=insertFound+1;
end if;
end loop;
end loop;
commit;
incrFound:=0;
deleteFound:=0;
for c3var in c3 loop
for c1var in c1(c3var.user_id) loop
foundFlag:=false;
for c2var in c2(c3var.user_id) loop
if c1var.ratesheet_id=c2var.ratesheet_id then
foundFlag:=true;
incrFound:=incrFound+1;
exit;
end if;
end loop;
if foundFlag=False then
--delete from pvt_user_ratesheet where user_id=c3var.user_id and ratesheet_id=c1var.ratesheet_id;
--dbms_output.put_line('Deleted for userid:'||c3var.user_id||' for ratesheet :'||c1var.ratesheet_id);
deleteFound:=deleteFound+1;
end if;
end loop;
end loop;
commit;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line (SQLCODE||' '|| SQLERRM);
END;
Regards,
MathewIn general, I would suggest that you only catch errors that you can handle reasonably. If you know that a SELECT INTO might return 0 rows for example, handle the NO_DATA_FOUND exception. Having a WHEN OTHERS, particularly without re-raising the exception, only serves to hide the source of the problem. I would much rather that my code fail quickly and explicitly than hope that I see an error message in the output and that other code doesn't start failing because the system wasn't left in an appropriate state.
As Mark suggests, you may choose to implement a comprehensive logging framework using autonomous transactions, in which case a WHEN OTHERS would be reasonable, but you would still want to propagate exceptions you cannot handle.
If you see a WHEN OTHERS clause and there is no RAISE, you probably have an error waiting to happen.
Justin -
Execute stored procedure from DOS or Unix Shell
Hi, need ur help again,
How to execute the stored procedure from DOS or Unix Shell?
Thanks!sqlplus -s /NOLOG @your_sql_script.sql
-- your_sql_script.sql :
connect user/password@connect_string
execute package.procedure (param1, param2, ...) -- for packages
execute procedure (param1,...) -- for procedures
exit ;this way you won't advertise your user/password on unix systems -
Execute stored procedure from Unix shell script
My current method of executing stored procedures (wpl_1 and wpl_2) from a unix shell script is as follows:
<<wpl.sh>>
sqlplus user/password @/home/oracle/scripts/wpl.sql
<<wpl.sql>>
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
Question: Is it possible to combine the two scripts (unix and oracle) together?A little rusty on this, but this may work:
My current method of executing stored procedures
(wpl_1 and wpl_2) from a unix shell script is as
follows:
<<wpl.sh>>sqlplus user/password @/home/oracle/scripts/wpl.sql << EOF
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
EOF
>
Question: Is it possible to combine the two scripts
(unix and oracle) together? -
Call procedure from batch-file
Hello,
I want to write a batch-file which call a stored procedure and deletes a file in a directory.
I wrote in my batch-file this. But it doesn't work.
SQLPLUS scott/tiger@ proc
del c:\test.txtYou put the space on the wrong place.
Try this:
SQLPLUS scott/tiger @proc
del c:\test.txt -
Executing Stored Procedure from TOAD: ORA-00900: invalid SQL statement
Ok…I have ALL the stored procedures converted into Oracle…now, when I go to test them I am getting the vague error of:
ORA-00900: invalid SQL statement
I am attempting to execute:
--EXEC IEXGetAgentSysPerf(to_date('2008/09/01', 'yyyy/mm/dd/'), to_date('2008/09/11', 'yyyy/mm/dd'), 'US HelpDesk');
EXEC IEXGetAgentSysPerf('9/1/2008', '9/11/2008', 'US HelpDesk');
(Neither work). These are calling a Stored Procedure with the following header:
PROCEDURE IEXGetAgentSysPerf (
v_curparm_IEXGetAgentSysPerf IN OUT pkg_IEX.cur_IEXGetAgentSysPerf
,v_BDateTime DATE
,v_EDateTime DATE
,v_WorkGroup VARCHAR2
The IDE is “TOAD” for Oracle. Thanks in advance.Hi,
This is your procedure
PROCEDURE IEXGetAgentSysPerf (
v_curparm_IEXGetAgentSysPerf IN OUT pkg_IEX.cur_IEXGetAgentSysPerf
,v_BDateTime DATE
,v_EDateTime DATE
,v_WorkGroup VARCHAR2
you are providing the ,v_BDateTime DATE,v_EDateTime DATE and v_WorkGroup
and how about "v_curparm_IEXGetAgentSysPerf ". So that procedures is returning the error.
Adding the the earlier post, If you want to test the Stored Procedures... then I say you work on the PL/SQL
Developer which good for debugging (easy to use...) When compare to TOAD.. :-)
Test ..it there...
- Pavan Kumar N -
Execute Stored Procedure from C#
Hi, im new to using stored procedures and i have the following stored procedure...
CREATE OR REPLACE PROCEDURE DRL_PROCEDURE2(var_SOURCE_OBJECTID IN varchar2, var_NEW_OBJECTID OUT varchar2)
AS
BEGIN
SELECT MAX(NEW_OBJECTID)
INTO var_NEW_OBJECTID
FROM DRL_CONVERSION
WHERE SOURCE_OBJECTID = var_SOURCE_OBJECTID;
END;
I want to be able to call this procedure from my windows form application and display the result of the stored procedure into a label...could someone please help me! Thanks in advance!http://www.csharpfriends.com/articles/getarticle.aspx?articleid=78
You can find how to call stored procedure (in the above link you will find an example of SQL Server 2005 which also work for you as of your oracle stored procedure) in C#.
HTH
Girish Sharma -
Calling PL/Sql Stored Procedure from java file
Having problem in calling oracle stored procedure using bc4j.
in ApplicationModuleImpl you can use following e.g.
on client side use a custom method to access
try {
DBTransaction dBTransaction = getDBTransaction();
String stmt = "CALL CHANGE_OWNER( ?, ?)";
CallableStatement callableStatement = dBTransaction.createCallableStatement(stmt,DBTransaction.DEFAULT);
callableStatement.setString( 1, oldOwner );
callableStatement.setString( 2, newOwner );
callableStatement.execute();
} catch (SQLException ex) {
throw new JboException(ex);
} -
In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .
Hi Srinath,
The below blog might be useful
http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
regards,
Harish -
Error ORA-04031 while executing a stored procedure from Pro C++ code
I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
Does anyone know why it is happening and any possible solutions?
TIA
Srithaj.One thing that can be done is to flush the shared pool before starting the application.
alter system flush shared pool;
Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
null -
Error while executing Multiple Stored Procedure through .sql file
Hi Guru's.
I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
I have one test.sql file with Stored Procedure is like,
CREATE OR REPLACE PROCEDURE skeleton1
AS
BEGIN
DBMS_Output.Put_Line('skeleton1');
END skeleton1;
CREATE OR REPLACE PROCEDURE skeleton2
AS
BEGIN
DBMS_Output.Put_Line('skeleton2');
END skeleton2;
Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
I am opening test.sql file from SQL PLUS,
SQL>
1 CREATE OR REPLACE PROCEDURE skeleton1
2 AS
3 BEGIN
4 DBMS_Output.Put_Line('skeleton1');
5 END skeleton1;
6 /
7 CREATE OR REPLACE PROCEDURE skeleton2
8 AS
9 BEGIN
10 DBMS_Output.Put_Line('skeleton2');
11* END skeleton2;
SQL> /
Warning: Procedure created with compilation errors.
SQL> show errors;
Errors for PROCEDURE SKELETON1:
LINE/COL ERROR
6/1 PLS-00103: Encountered the symbol "/"
SQL>
Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
Regards,
ShatrughanHi,
Try this
CREATE OR REPLACE PROCEDURE skeleton1
AS
BEGIN
DBMS_Output.Put_Line('skeleton1');
END ;
CREATE OR REPLACE PROCEDURE skeleton2
AS
BEGIN
DBMS_Output.Put_Line('skeleton2');
END;
/Save the file and call it.
Regards,
Bhushan
Maybe you are looking for
-
2 weeks and counting... please help
I've had my Mac for 2 weeks. I've had to reboot it several times (like windows) for security updates. I've had it lock up 3 times so bad that I had to do a hard reset. Today for the 4th time I opened the lid and it wouldn't come on requiring a hard r
-
Whats new in SAP CRM 7.0 Telecom
Hello Experts, Can you please share whats new in SAP CRM 7.0 Telecom solution. Specially in the sales order management related scenarios any pointers will be appreciated thanks Rishi
-
I got an error cannot Find url when i attempt to play my camera recorded video from my iphone 4S 32 gig. I try to restart my phone but still no luck. There was no problem previously, but suddenly i got this problem with no reason. I also unable to co
-
9 Box Grid Settings are not availaible through admin console
Hi ALL, We are implementing Nakisa 3.0 SP1 here. While configuring Succession Planning, for Employees, 'Grid' option is not availaible through Administration Console. However the same is availaible for End USer under Employee>>Grid. If I understand i
-
Issues with unauthorized Adobe products
An issue is preventing me from donwloading the "Free Grab Photoshop CS2 offered from Google/Adobe. Repairs were made to my computer by an independant IT Man, (friend of a friend) who installed unauthorized software on my computer. I have tryed num