Jump to content


Photo

[SOLVED] Calling packaged stored procedure from php fails


  • Please log in to reply
No replies to this topic

#1 stockton

stockton
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts
  • LocationMidrand South Africa

Posted 08 July 2006 - 10:05 AM

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

<?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
:

Please tell me what I have done incorrect.
Regards,
Alf Stockton   Programmer for rent.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users