Home » SQL & PL/SQL » SQL & PL/SQL » What would happen if we use RETURN clause in Procedure? (Oracle)
What would happen if we use RETURN clause in Procedure? [message #319923] Tue, 13 May 2008 07:13 Go to next message
VEDDETA
Messages: 54
Registered: May 2008
Member
What would happen if we use RETURN clause in Procedure?
Re: What would happen if we use RETURN clause in Procedure? [message #319925 is a reply to message #319923] Tue, 13 May 2008 07:17 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Try it.
If we would tell you, then you'd forget within a week. If you try it yourself, you will never ever forget.
Re: What would happen if we use RETURN clause in Procedure? [message #319929 is a reply to message #319923] Tue, 13 May 2008 07:24 Go to previous messageGo to next message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
To avoid these users' doubts, Oracle already created documentation about the database, where most of its features are described. You shall get familiar with it; you will find it eg. online on http://tahiti.oracle.com/.
Open PL/SQL User's Guide and Reference specific for your Oracle version and search for RETURN Statement.
Re: What would happen if we use RETURN clause in Procedure? [message #319931 is a reply to message #319923] Tue, 13 May 2008 07:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
What about reading the doc.
It took me 10 seconds to go to the index, scroll down to RETURN and find:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/subprograms.htm#sthref1672

Regards
Michel
Re: What would happen if we use RETURN clause in Procedure? [message #319953 is a reply to message #319925] Tue, 13 May 2008 08:20 Go to previous messageGo to next message
VEDDETA
Messages: 54
Registered: May 2008
Member
yah thats correct!
We hardly forget what we do...
Liked it Smile
Re: What would happen if we use RETURN clause in Procedure? [message #319956 is a reply to message #319931] Tue, 13 May 2008 08:25 Go to previous message
VEDDETA
Messages: 54
Registered: May 2008
Member
The RETURN statement immediately ends the execution of a subprogram and returns control to the caller. Execution continues with the statement following the subprogram call. (Do not confuse the RETURN statement with the RETURN clause in a function spec, which specifies the datatype of the return value.)

A subprogram can contain several RETURN statements. The subprogram does not have to conclude with a RETURN statement. Executing any RETURN statement completes the subprogram immediately.

In procedures, a RETURN statement does not return a value and so cannot contain an expression. The statement returns control to the caller before the end of the procedure.

In functions, a RETURN statement must contain an expression, which is evaluated when the RETURN statement is executed. The resulting value is assigned to the function identifier, which acts like a variable of the type specified in the RETURN clause.

Thanks to Michel and Flyboy for providing the information...
Regards, Veddeta
Previous Topic: Varchar evaluation as timestamp
Next Topic: Multiple Rows Returned but Only Want One Based on stat_cde
Goto Forum:
  


Current Time: Wed Dec 11 23:01:57 CST 2024