About Procedures
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: About Procedures

Hybrid View

  1. #1
    Join Date
    Jan 2001
    Posts
    642
    hi,
    I have to written a stored procedure, which accepts 2 IN parameters.
    Upon the complete execution of the procedure, I want to return a status.
    I tried to have a OUT - formal parameter.

    From the calling program, How do i get back the value that is stored in the
    OUT variable.

    Also I have a problem, how to execute a stored procedure, when it has OUT parameter.
    I tried to exec ute with
    SQL> exec my_proc('name', age, ' ')
    The 2 IN parameters are Name and age,
    OUT parameter is status. Initial it is null. How do I execute it;
    Badrinath

  2. #2
    Join Date
    Jul 2000
    Posts
    296
    For an out parameter you need a variable.

    In SQL*Plus:
    VAR my_var VARCHAR2(10)
    EXEC my_proc('name', age, :my_var)




  3. #3
    Join Date
    Jan 2001
    Posts
    642
    Hi,
    What If I want to read the out parameter after executing the procedure.
    I need to call this procedure from a diff procedure and have to get the
    out put parameter.
    How do I do it;
    badrinath

  4. #4
    Join Date
    Feb 2001
    Posts
    7

    Thumbs up

    Hi,

    At SQL prompt just say

    PRINT <bind variable name without ':' prefix>

    Good luck
    Pramathesh Kumar Mohapatra
    Sql Star International Ltd.
    Stp Hyderabad. Andhra Pradesh
    India

  5. #5
    Join Date
    Feb 2001
    Posts
    7
    [QUOTE][i]Originally posted by badrinathn [/i]
    [B]Hi,
    What If I want to read the out parameter after executing the procedure.
    I need to call this procedure from a diff procedure and have to get the
    out put parameter.
    How do I do it;
    badrinath [/B][/QUOTE]

    Hi

    1. as i said u have to say

    PRINT VARIABLE NAME

    while giving the variable name do not use " : " sign.

    2. If u r calling this procedure inside another procedure then , u need to use a local varible of same type as of Out Parameter and while calling the procedure u need to use the folling syntax e.g

    proc1('xyz',getage);

    Where xyz is literal value and getage is a locally declared variable.

    moreover u can also use a packaged variable for this purpose.

    Good luck

    pramathesh
    Pramathesh Kumar Mohapatra
    Sql Star International Ltd.
    Stp Hyderabad. Andhra Pradesh
    India

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width