Home » Infrastructure » Windows » Create a Batch File[merged topic]
Create a Batch File[merged topic] [message #288383] Mon, 17 December 2007 05:27 Go to next message
pritesh
Messages: 5
Registered: December 2007
Junior Member
Does anyone have ideas how to call stored
procedures from batch file? I want to crate a batch file in dos to call Stored Procedure written in oracle.
Re: Create a Batch File [message #288386 is a reply to message #288383] Mon, 17 December 2007 05:33 Go to previous messageGo to next message
Michel Cadot
Messages: 59991
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
sqlplus @batchscript.sql

with batchscript.sql:
connect scott/tiger
exec myproc
exit

This is just an example of how to do it.

Regards
Michel
Re: Create a Batch File [message #288389 is a reply to message #288386] Mon, 17 December 2007 05:49 Go to previous messageGo to next message
pritesh
Messages: 5
Registered: December 2007
Junior Member
Hi Michel, Thank you very much.
But I have differ database.
how can I give datbase name?
Details:
DataBase Name: ora-pip
username : Xyz
Password : Abc
Re: Create a Batch File [message #288394 is a reply to message #288389] Mon, 17 December 2007 05:58 Go to previous messageGo to next message
Michel Cadot
Messages: 59991
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
sqlplus scott/tiger@mydb @myscript
and no connect inside myscript.sql
or
sqlplus @myscript scott tiger mydb
with
connect &1/&2@&3
inside myscript.sql

Regards
Michel

[Updated on: Mon, 17 December 2007 05:59]

Report message to a moderator

Re: Create a Batch File [message #288398 is a reply to message #288394] Mon, 17 December 2007 06:39 Go to previous messageGo to next message
pritesh
Messages: 5
Registered: December 2007
Junior Member
Hey ,
I am giving you troble once again.
Needed: I want to call Stored Procedure using batch file.
I have crrated sample.sql in c:/sample.sql
Then In SP.BAT file, what should I write?
I have tried followed code.
code:
START C:\oracle\ora92\bin\sqlplusw.exe u100@New/u100
exec pr2(500,'pritesh', 50000)
EXIT

Note: pr2 is my SP. first input is number then varchar2 and number.
Thx.
Re: Create a Batch File [message #288404 is a reply to message #288383] Mon, 17 December 2007 07:05 Go to previous messageGo to next message
Michel Cadot
Messages: 59991
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Why don't you try what I posted and prefer to start a new topic with something that obviously is from Unix?

Regards
Michel
Re: Create a Batch File [message #288406 is a reply to message #288404] Mon, 17 December 2007 07:43 Go to previous messageGo to next message
pritesh
Messages: 5
Registered: December 2007
Junior Member
Hey Michel,
Can u re-look my problem?
Because, I am not Oracle programmer.
I am working in java.I don't have much info.
I am using window as OS.

Sorry for troubling more.
Thank a lot.
regards,
Pritesh Shah
Re: Create a Batch File [message #288407 is a reply to message #288406] Mon, 17 December 2007 07:46 Go to previous messageGo to next message
Michel Cadot
Messages: 59991
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I gave you 2 solutions, they work, if they do not fit what you want to do tell why.

Regards
Michel

[Updated on: Mon, 17 December 2007 07:47]

Report message to a moderator

Re: Create a Batch File [message #288480 is a reply to message #288398] Mon, 17 December 2007 13:28 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8024
Registered: November 2002
Location: California, USA
Senior Member
pritesh wrote on Mon, 17 December 2007 04:39

Hey ,
I am giving you troble once again.
Needed: I want to call Stored Procedure using batch file.
I have crrated sample.sql in c:/sample.sql
Then In SP.BAT file, what should I write?
I have tried followed code.
code:
START C:\oracle\ora92\bin\sqlplusw.exe u100@New/u100
exec pr2(500,'pritesh', 50000)
EXIT

Note: pr2 is my SP. first input is number then varchar2 and number.
Thx.



-- Create your c:/sample.sql with the following contents:
exec pr2 (500, 'pritesh', 50000)


-- Then create your sp.bat file with the following contents:
C:\oracle\ora92\bin\sqlplus.exe u100/u100@new @c:\sample.sql


-- Then at your windows command prompt type:
sp.bat


Re: Create a Batch File [message #288513 is a reply to message #288480] Mon, 17 December 2007 21:30 Go to previous message
pritesh
Messages: 5
Registered: December 2007
Junior Member
Hey Brother, Michle
Thanks you so much. It is working nicely.
Good Work Michle!!!

Pritesh
Previous Topic: ORA-04030 error in Windows 2003!
Next Topic: Oracle9.2.0.1 Error
Goto Forum:
  


Current Time: Fri Dec 19 03:44:50 CST 2014

Total time taken to generate the page: 0.09084 seconds