0

I am having difficulty figuring out how to add data as input to an Oracle cursor being sent to a stored procedure of a package in PHP.

I am trying to send 2 pieces of data through a cursor. I have verified the data is correct up to sending.

PHP Code:

$finalpieces = explode('|',$lkeyarr[$i]); //0=unique id, 1=table
$conn = oci_connect($oracleUsername,$oraclePassword,$oracleService);
$stmt = OCIParse($conn,"BEGIN PROD.PKG_CORE_OBSERVER.StuckPages_Unlock(:cur_PageDetails); END;");
$cur = oci_new_cursor($conn);
OCIBindByName($stmt,':cur_PageDetails',$cur,-1,OCI_B_CURSOR);
ociexecute($stmt,OCI_DEFAULT);

Stored Procedure Details:

PROCEDURE StuckPages_Unlock
    (
      cur_PageDetails IN OUT SYS_REFCURSOR
    )

accepts ref cursor that includes 2 fields:

 ProcessID          NUMBER(2);
 PageUniqueID       NUMBER(10);

Any help would be greatly appreciated.

1 Answer 1

1

A Ref Cursor is a pointer to a result set. We cannot assign values to a Ref Cursor, we use it with a query:

open my_ref_cursor for
    select process_id, page_unique_id
    from some_table;

So, your approach is wrong. It is difficult to be sure what you're trying to achieve but I think what you want is a stored procedure which accepts two parameters that it uses to query a table and return a ref cursor. Perhaps, something like this:

PROCEDURE StuckPages_Unlock
    (
      p_proc_id in some_table.process_id%type
      , p_page_id in some_table.page_unique_id_id%type
      , cur_PageDetails OUT SYS_REFCURSOR
    ) 
IS
    open PageDetails for
        select *
        from some_table
        where process_id = p_proc_id
        and page_unique_id = p_page_id;
END;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.