-
Junior Member
Return datatype in procedure
Hi friends happy to join with you people, can u give me an example for using return data type in the procedures. Because I never used return in procedures, so kindly reply me.
-
Expert Member
Re: Return datatype in procedure
This is example for sub procedure with return type i.e. Using out parameter
create or replace procedure out_example as
message char(80);
procedure welcome_print(s in char, m out char) as
begin
m := 'welcome to ' || s;
end;
begin
welcome_print('geekinterview.com', message);
dbms_output.put_line(message);
end;
/
The following points should be kept in mind before using out parameter
1)A formal out parameter acts like an un-initialized variable. It must be assigned with new values before the end of the procedure or function.
2)An actual out parameter must be a variable.
3)An actual out parameter will not pass any value to the formal parameter.
4)An actual out parameter will receive a copy of the value from the formal parameter at the end of the procedure or function.
Last edited by krishnaindia2007; 02-18-2008 at 08:02 AM.
-
Re: Return datatype in procedure
Even though we can use out paramter to return value from a procedure . But that is not the actual purpose of a procedure .Better to use FUNCTION instead.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules