Skip to content
Advertisement

oci_execute(): ORA-06550: PLS-00306: wrong number or types of arguments in call to ‘GET_CITIZEN_INFO’

My PHP code:

$sql = '
begin
get_citizen_info(:n_id, :c_name, :c_date_of_birth, :c_vehicle_number, :success);
end;';
$result = oci_parse($conn, $sql);
oci_bind_by_name($result, ':n_id', $_POST['n_id'], -1);
oci_bind_by_name($result, ':c_name', $c_name, 50);
oci_bind_by_name($result, ':c_date_of_birth', $c_date_of_birth, 50);
oci_bind_by_name($result, ':c_vehicle_number', $c_vehicle_number, 50);
oci_bind_by_name($result, ':success', $success, 8);
oci_execute($result);

My procedure

create or replace procedure get_citizen_info(n_id number, 
                                             c_name out varchar, 
                                             c_date_of_birth out varchar, 
                                             c_vehicle_number out varchar, 
                                             success out boolean)
is
c_id number;
begin
success := true;
begin
select name, date_of_birth, vehicle_number into c_name, c_date_of_birth, c_vehicle_number 
  from citizens 
 where national_id = n_id;
exception
when no_data_found then
success := false;
end;
end

Error

<br /><b>Warning</b>:  oci_execute(): ORA-06550: line 3, column 1:PLS-00306: wrong number or types of arguments in call to 'GET_CITIZEN_INFO'ORA-06550: line 3, column 1:PL/SQL: Statement ignored in <b>C:xampphtdocsget_citizen_info(add-case).php</b> on line <b>15</b><br />false

I am proving correct number of argument so what seems to be wrong here?

Advertisement

Answer

You are providing the correct number of arguments, but not necessarily the correct type of arguments. You might need to specify at least the first and last parameter types:

oci_bind_by_name($result, ':n_id', $_POST['n_id'], -1, OCI_B_INT);
oci_bind_by_name($result, ':c_name', $c_name, 50);
oci_bind_by_name($result, ':c_date_of_birth', $c_date_of_birth, 50);
oci_bind_by_name($result, ':c_vehicle_number', $c_vehicle_number, 50);
oci_bind_by_name($result, ':success', $success, 8, OCI_B_BOL);

docs

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement