ORA-06502: PL / SQL: numeric or significant error: character string buffer too low - execution using OCI

I completely broke out and do not understand what I need to do to fix this error. I have a plsql procedure that takes a varchar2 string and an OUT parameter, which is a number. Can you help me since I am also new to plsql and php.

the column type 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 follow the stored procedure described above with 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 result that I see in php

string integer Warning: oci_execute () [function.oci-execute]: ORA-06502: PL / SQL: numeric or significant error: character string buffer is too small ORA-06512: on line 1 in rtp2 / test.php on line 26 Identifier member is 0

+1
1

PHP, :

" maxlength OUT, PHP .

, - :

   //  Bind the input parameter
   oci_bind_by_name($stmt1,':MEMBER_NAME',$MEMBER_NAME);
   oci_bind_by_name($stmt1,':MEMBER_ID',$MEMBER_ID,20,SQLT_INT);

SQLT_INT.

+1

Source: https://habr.com/ru/post/1694814/


All Articles