Oracle Stored Procedure

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • paddy_nyr

    #1

    Oracle Stored Procedure

    What is the correct syntax for calling an oracle stored procedure and
    getting a retrun value? I created a simple procedure on my oracle database
    for testing and yes I know I could do this in a function but I have a more
    complex procedure that I have created for the creation of reports. I'm
    trying to use ora_parse and ora_bind without much luck. Any help would be
    much appreaciated.

    Thanks

    CREATE OR REPLACE PROCEDURE P_PHP_PROC_CALL (
    p_survey_code IN VARCHAR2,
    p_request_id OUT NUMBER
    )
    AS
    BEGIN

    IF p_survey_code = 'XYZ' THEN
    p_request_id := 12345;
    END IF;
    END;
    /


  • Andy Hassall

    #2
    Re: Oracle Stored Procedure

    On Mon, 17 Oct 2005 13:38:02 -0400, "paddy_nyr" <mpprpp@yahoo.c om> wrote:
    [color=blue]
    >What is the correct syntax for calling an oracle stored procedure and
    >getting a retrun value? I created a simple procedure on my oracle database
    >for testing and yes I know I could do this in a function but I have a more
    >complex procedure that I have created for the creation of reports. I'm
    >trying to use ora_parse and ora_bind without much luck.[/color]

    Don't use them, they're the (very) old API.

    There's an example of calling a stored procedure on the OCI8 manual page.

    If you're using ADODB then see http://phplens.com/lens/adodb/docs-oracle.htm
    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Volker Hetzer

      #3
      Re: Oracle Stored Procedure

      paddy_nyr wrote:[color=blue]
      > What is the correct syntax for calling an oracle stored procedure and
      > getting a retrun value? I created a simple procedure on my oracle database
      > for testing and yes I know I could do this in a function but I have a more
      > complex procedure that I have created for the creation of reports. I'm
      > trying to use ora_parse and ora_bind without much luck. Any help would be
      > much appreaciated.
      >
      > Thanks
      >
      > CREATE OR REPLACE PROCEDURE P_PHP_PROC_CALL (
      > p_survey_code IN VARCHAR2,
      > p_request_id OUT NUMBER
      > )
      > AS
      > BEGIN
      >
      > IF p_survey_code = 'XYZ' THEN
      > p_request_id := 12345;
      > END IF;
      > END;
      > /[/color]

      If you can rewrite your code as a function you could simply
      do a "select P_PHP_PROC_CALL (...) from dual"

      Dual is a table available to every user for the specific
      purpose of calling functions, that is, if you don't use
      the functions in any "real" select with real tables.

      The typical example is "select sysdate from dual".

      Lots of Greetings!
      Volker

      Comment

      Working...