Sorry Barand but my php is not compiled with the OCI8 or oracle parameters, so I'm not allowed to use those functions.
I've finally managed to get odbc_prepare() and odbc_execute to work. I 'll tell you what I've tried so maybe you can tell me what I'm doing wrong.
I have this stored procedure in Oracle
PROCEDURE ck_cod_pais(
vCod_pais IN LHSWEB.paises.cod_pais%TYPE) IS
i INTEGER;
vCaracter CHAR(1);
iLongpais INTEGER;
v_cod_error LHSWEB.errores_sql.cod_error_sql%TYPE;
v_msg_error LHSWEB.errores_sql.mensaje%TYPE;
BEGIN
raise_application_error(-20999, 'HOLA');
iLongPais := nvl(LENGTH(vCod_pais),0);
IF iLongPais =0 THEN
RETURN;
END IF;
FOR i IN 1..iLongPais LOOP
vCaracter := substr(vCod_pais,i,1);
IF Es_Numero(vCaracter) = 'N' AND
Es_Letra_Mayuscula(vCaracter) ='N' THEN
v_cod_error := -20013;
Get_ERROR_SQL(v_cod_error, v_msg_error);
raise_application_error(v_cod_error,v_msg_error);
END IF;
END LOOP;
END ck_cod_pais;
And i'm calling it from PHP like this:
$arr[0] = 'AR';
$query = "begin lhsweb.ck_cod_pais(:vCod_pais); end;";
$qry_prep = odbc_prepare($con, $query);
$result = odbc_execute($qry_prep,$arr);
The error message that I get is:
Warning: SQL error: [unixODBC][Easysoft][Oracle]ORA-01008: not all variables bound, SQL state S1000 in SQLExecute in /var/www/html/sagas/admin/prueba3.php on line 31
I've also tried replacing the :vCod_pais by a '?' with no result
I think that maybe I'm mistaken with the syntaxis but I was not able to find and example in the internet to guide me.
Can you tell me what I'm doing wrong?