I am completely flaberghasted and dont understand what i need to do to fix this error. I have a plsql procedure that accepts a varchar2 string and an OUT param which is a number.Can you pls help me as i am learning and new to plsql and php.
type of columns member_name is VARCHAR2(100) and member_id is NUMBER(20)
create or replace procedure GET_MEMBER_ID (V_MEMBER_NAME IN VARCHAR2,V_MEMBER_ID OUT NUMBER ) AS
BEGIN
SELECT member_id INTO V_MEMBER_ID
FROM mn_member WHERE member_name = V_MEMBER_NAME;
END;
/
i execute the above stored procedure from php as follows
error_reporting(E_ALL);
ini_set('display_errors', 1);
$conn = oci_connect("$user","$password","$sid");
$MEMBER_ID=0;
$MEMBER_NAME='45390';
echo gettype($MEMBER_NAME), "\n";
echo gettype($MEMBER_ID), "\n";
$sql_get_member_id = "BEGIN GET_MEMBER_ID(:MEMBER_NAME,:MEMBER_ID);END;";
$stmt1 = oci_parse($conn,$sql_get_member_id);
// Bind the input parameter
oci_bind_by_name($stmt1,':MEMBER_NAME',$MEMBER_NAME);
oci_bind_by_name($stmt1,':MEMBER_ID',$MEMBER_ID);
oci_execute($stmt1);
echo "Member ID is ".$MEMBER_ID;
?>
This is the output i see in php
string integer Warning: oci_execute() [function.oci-execute]: ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 1 in rtp2/test.php on line 26 Member ID is 0
member_id
in table is not number. Please post result ofdesc mn_member
– Kacpervarchar2
in table. What is type ofmember_name
? – Kacper