| What would happen if we use RETURN clause in Procedure? [message #319923] |
Tue, 13 May 2008 07:13  |
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   |
Frank Messages: 5756 Registered: April 2002 Location: NL |
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   |
flyboy Messages: 519 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 #319956 is a reply to message #319931 ] |
Tue, 13 May 2008 08:25  |
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
|
|
|