Results 1 to 3 of 3

Thread: Return datatype in procedure

  1. #1
    Junior Member
    Join Date
    Feb 2008
    Answers
    15

    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.


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    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.

  3. #3
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact