Jump to content

[SOLVED] Calling packaged stored procedure from php fails


Recommended Posts

The following php fails with:-
Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SPMEMBERDETAILS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in C:\Program Files\Apache Group\Apache2\htdocs\KioskCurrent\GM2.php on line 28
Cannot Execute statement

[code]<?php
$number = "2100418933";
// Connect to database...
$conn=OCILogon("big", "big");
if ( ! $conn ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$cursor = OCINewCursor($conn);
$stmt = OCIParse($conn, "BEGIN spPackage.spMemberDetails(:number, :cv_memberdetails); END;")
or die('Cannot parse query');
OCIBindByName($stmt, ":cv_memberdetails", &$cursor)
or die('Cannot bind array variable');
OCIBindByName($stmt, ":number", &$number)
or die('Cannot bind number variable');
$exec = OCIExecute($stmt)
or die('Cannot Execute statement');
OCIExecute($cursor);
while ($data = OCIFetchInto($cursor)) {
var_dump($data);
}

OCIFreeStatement($stmt);
OCIFreeCursor($cursor);
OCILogoff($conn);
?>

and the stored procedure looks like

SQL> desc sppackage;
PROCEDURE SPGETMEMBERNUMBER
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_NUMBER VARCHAR2 IN
P_MEMBERNUMBER VARCHAR2 OUT
PROCEDURE SPGETSLOTSHANDLE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_HANDLE NUMBER(15,2) OUT
P_NUMBER VARCHAR2 IN
P_STARTDATE VARCHAR2 IN
P_ENDDATE VARCHAR2 IN
PROCEDURE SPGETTABLEHANDLE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_HANDLE NUMBER(15,2) OUT
P_NUMBER VARCHAR2 IN
P_TABLEGAMEPREFIX VARCHAR2 IN
P_STARTDATE VARCHAR2 IN
P_ENDDATE VARCHAR2 IN
PROCEDURE SPMEMBERDETAILS
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_NUMBER VARCHAR2 IN
CV_MEMBERDETAILS REF CURSOR OUT
RECORD OUT
R_MEM_NUMBER VARCHAR2(12) OUT
R_MEM_SNAME VARCHAR2(25) OUT
R_MEM_FNAME VARCHAR2(25) OUT
R_MEM_TITLE VARCHAR2(25) OUT
PROCEDURE SPTABLESPLAYED
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_NUMBER VARCHAR2 IN
P_STARTDATE VARCHAR2 IN
P_ENDDATE VARCHAR2 IN
CV_TABLESPLAYED REF CURSOR OUT
RECORD OUT
:[/code]

Please tell me what I have done incorrect.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.