Home » SQL & PL/SQL » SQL & PL/SQL » Execute procedure with arguments (10.2.0.2.0 ,windows)
Execute procedure with arguments [message #430763] Thu, 12 November 2009 05:00 Go to next message
Hitman11
Messages: 94
Registered: October 2009
Location: norway
Member

Hi all,

What is the syntax to execute a procedure with arguments in SQLPLUS tool ?


Thanks,

Re: Execute procedure with arguments [message #430765 is a reply to message #430763] Thu, 12 November 2009 05:08 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Hitman,

Please read the Oracle documents.

Exec Procedure_name(argument1,argument2,...);

sriram
Re: Execute procedure with arguments [message #430772 is a reply to message #430765] Thu, 12 November 2009 05:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Please read the Oracle documents.

Why don't you just point to the documentation?
Of course, this will not OP's question as from his previous posts we know that he does not read the doc...

Regards
Michel
Re: Execute procedure with arguments [message #430777 is a reply to message #430772] Thu, 12 November 2009 05:37 Go to previous messageGo to next message
Hitman11
Messages: 94
Registered: October 2009
Location: norway
Member

Michel,

Its not like i do not refer document before posting in this forum.I was not sure about the syntax for executing a procedure with arguments/parameter.Thats why i posted my question here .

I still have one doubt in the syntax.Do we have to use codes within the parameter? I mean like this

Exec Procedure_name('argument1','argument2',...);

or

Exec Procedure_name('argument1; argument2',...);

Regards,
Re: Execute procedure with arguments [message #430781 is a reply to message #430763] Thu, 12 November 2009 05:42 Go to previous messageGo to next message
cookiemonster
Messages: 12422
Registered: September 2008
Location: Rainy Manchester
Senior Member
What do you think the 2nd example is going to do?
Anything in quotes is just a string of data.
Read the documentation - it includes examples.
Re: Execute procedure with arguments [message #430989 is a reply to message #430781] Fri, 13 November 2009 09:53 Go to previous messageGo to next message
babuknb
Messages: 1734
Registered: December 2005
Location: NJ
Senior Member

Quote:
Its not like i do not refer document before posting in this forum.I was not sure about the syntax for executing a procedure with arguments/parameter.Thats why i posted my question here

Looks still your not checking oracle documents. I belive some days before Mr Mic told 99% answer available in oralce document. Before posting here check oracle document & try to learn some basic stuff.

- Babu
Re: Execute procedure with arguments [message #431807 is a reply to message #430989] Thu, 19 November 2009 11:05 Go to previous messageGo to next message
joeller
Messages: 17
Registered: September 2007
Location: Indian Head, Maryland
Junior Member
Hitman11
Michel and othes on this always get very snippy about telling people to check the documentation. But they won't tell you where to find the documentation. The Google search that led me to this thread included over 4300 results but the only documentation I have found after viewing 150 results deals with Oracle OLAP, using PHP with Oracle. The only documentation on my computer takes me to the datawarehouse on-line documentation. I would think that a forum that pretends to help people should at least direct you to where the documentation is for this process instead of grumping about people not reading the documentation So hitman11 http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12022.htm#sthref1583 will describe how to use execute.
Re: Execute procedure with arguments [message #431810 is a reply to message #431807] Thu, 19 November 2009 11:16 Go to previous messageGo to next message
cookiemonster
Messages: 12422
Registered: September 2008
Location: Rainy Manchester
Senior Member
joeller wrote on Thu, 19 November 2009 17:05
But they won't tell you where to find the documentation.


We have.
Several times.
Plus if you look in the orafaq forum guide you'll find a link to it.

Re: Execute procedure with arguments [message #431825 is a reply to message #431807] Thu, 19 November 2009 11:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Michel and othes on this always get very snippy about telling people to check the documentation. But they won't tell you where to find the documentation.

We did it for him many times.

Quote:
So hitman11 http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12022.htm#sthref1583 will describe how to use execute.

Hope you will be there to repeat for him the same link or other in the same document, next time, and next next time and so on. Then we will see how many times you will hold before leaving. I will remind you your post.

Regards
Michel

[Updated on: Thu, 19 November 2009 11:55]

Report message to a moderator

Re: Execute procedure with arguments [message #431833 is a reply to message #431825] Thu, 19 November 2009 11:46 Go to previous messageGo to next message
cookiemonster
Messages: 12422
Registered: September 2008
Location: Rainy Manchester
Senior Member
Michel Cadot wrote on Thu, 19 November 2009 17:35
Quote:
I unpacket the cpio into the stage directory but I can't find any oui file except the following: OuiConfigVariables.xml.

We did it for him many times.


Replying to too many people at once?
Re: Execute procedure with arguments [message #431836 is a reply to message #431833] Thu, 19 November 2009 11:54 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yep! Wrong quote in my clipboard.
I fix it.

Regards
Michel
Re: Execute procedure with arguments [message #431858 is a reply to message #431807] Thu, 19 November 2009 12:39 Go to previous messageGo to next message
joeller
Messages: 17
Registered: September 2007
Location: Indian Head, Maryland
Junior Member
hitman11 That documentation in that link is not only rather weak but is more concerned with Execute SQLStatement rather than SP with parameters, particularly output parameters. This link here shows an example with an output parameter of type object

http://forums.oracle.com/forums/thread.jspa?messageID=3815551&#3815551

I could not figure out how to add a code block so here is the code that that guy figured answered his questions. I am still having issues as I am trying to figure out how to make this work with refcursor, but since you did not specify anything like that...

SQL> create or replace type t_obj as object (ename varchar2(10), deptno number);
2 /

Type created.

SQL> ed
Wrote file afiedt.buf

1 create or replace procedure myproc (p_empno in number, obj out t_obj) is
2 begin
3 select t_obj(ename, deptno)
4 into obj
5 from emp
6 where empno = p_empno;
7* end;
SQL> /

Procedure created.

SQL> set serverout on
SQL> declare
2 v_obj t_obj;
3 begin
4 myproc(7788, v_obj);
5 dbms_output.put_line(v_obj.ename||','||v_obj.deptno);
6 end;
7 /
SCOTT,20

PL/SQL procedure successfully completed.

Hope this helps.

Michel and other guys my boss answers the same entry level GIS questions on his blog all evening. I do that for our cutomers regarding SQL Server and ASP.Net all day long. I have also submitted questions to ASP.Net forums, ESRI forums and experts-exchange. Those above mention people have never complained about answering questions with obvious answers if no one wants to answer a question it just goes unanswered. They do not make derogatory remarks about the questions or the questioner. They assume he has done some research before having recourse to the forums. If you have a few experts that are so overwhelmed by the volume of questions that simple answers right in the book are not deserving of a polite answer just don't answer it. It would relieve your workload while at the same time leaving people who hit your site via google with a better impression of orafaq forums. "Not a sermon just a thought."
Re: Execute procedure with arguments [message #431863 is a reply to message #431858] Thu, 19 November 2009 12:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
above mention people have never complained about answering questions with obvious answers

The point is not there, we answer obvious question but we prefer giving hint and helping people to learn (see below link).
The point is that we ALREADY POSTED links to OP and HE DID NOT READ THEM.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel

[Updated on: Thu, 19 November 2009 12:50]

Report message to a moderator

Re: Execute procedure with arguments [message #431867 is a reply to message #431863] Thu, 19 November 2009 13:12 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
@joeller - I agree with you.
Re: Execute procedure with arguments [message #431874 is a reply to message #431867] Thu, 19 November 2009 13:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
andrew again wrote on Thu, 19 November 2009 20:12
@joeller - I agree with you.

But you never answered him when he thanked me a dozen times in the last month for the answers I gave him.
Maybe you think he does not deserve you answer him. Twisted Evil

Regards
Michel
Re: Execute procedure with arguments [message #431899 is a reply to message #431858] Thu, 19 November 2009 22:28 Go to previous message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
@ joeller
First you should read this document.
Guide lines to you


Quote:
I could not figure out how to add a code block


You can paste or write between
[code][/code]


Quote:
hitman11 That documentation in that link is not only rather weak but is more concerned with Execute SQLStatement rather than SP with parameters, particularly output parameters. This link here shows an example with an output parameter of type object


This is esspecially for you


Quote:
I am still having issues as I am trying to figure out how to make this work with refcursor, but since you did not specify anything like that...


refcursor



sriram

[mod-edit] fixed all then links that had extra HTML code in them.

[Updated on: Fri, 20 November 2009 07:58] by Moderator

Report message to a moderator

Previous Topic: Cursor Help with a Select Statement
Next Topic: ora-32960
Goto Forum:
  


Current Time: Fri Dec 09 02:07:32 CST 2016

Total time taken to generate the page: 0.15255 seconds