I am implementing this query correctly with PHP? [closed]

1

Am I implementing this query correctly with PHP?

I have already reviewed the connection data and they are correct, I propose my query based on the official documentation of PHP, however I do not obtain the expected result, in advance I thank you for your support.

Query that shows me results directly in console:

SET SERVEROUTPUT ON 
DECLARE 
num_N_ACCOUNT_ID NUMBER;
num_N_OVERDRAFT NUMBER;
dt_D_OVERDRAFT_END    DATE;
BEGIN
SI_USERS_PKG_S.GET_ACCOUNT_CREDIT(
num_N_ACCOUNT_ID => 148664791,
num_N_OVERDRAFT => num_N_OVERDRAFT,
dt_D_OVERDRAFT_END => dt_D_OVERDRAFT_END
);
DBMS_OUTPUT.PUT_LINE(num_N_OVERDRAFT);
DBMS_OUTPUT.PUT_LINE(dt_D_OVERDRAFT_END);
END;

Implemented with PHP

$sql="  SET SERVEROUTPUT ON 
    DECLARE 
    num_N_ACCOUNT_ID NUMBER;
    num_N_OVERDRAFT NUMBER;
    dt_D_OVERDRAFT_END DATE;
    BEGIN
    SI_USERS_PKG_S.GET_ACCOUNT_CREDIT(
    :num_N_ACCOUNT_ID,
    :num_N_OVERDRAFT,
    :dt_D_OVERDRAFT_END
    );
    END;";
$account    = 148664791;
$stid = oci_parse($conn, $sql);
oci_bind_by_name($stid, ':num_N_ACCOUNT_ID', $account);
oci_bind_by_name($stid, ':num_N_OVERDRAFT', $cantidad,20);
oci_bind_by_name($stid, ':dt_D_OVERDRAFT_END', $fecha,20);
oci_execute($stid);
print "$cantidad\n";
    
asked by Justo Sotomayor 19.12.2016 в 18:11
source

1 answer

0

The problem is the SQL statement as the error marks you. If you are looking for the error of ORA by google we found this

  

Error: ORA-00922: missing or invalid option

     

Cause: An invalid option was specified in defining a column or storage   clause The valid option in specifying a column is NOT NULL to specify   that the column can not contain any NULL values. Only constraints may   follow the datatype. Specifying a maximum length on a DATE or LONG   datatype also causes this error.

     

Action: Correct the syntax. Remove the erroneous option or length   specification from the column or storage specification. '

Check and find wrong data specification (Number, String, etc) or column length or storage specification.

create table T_PRODUCTOS (
  numproduct number,  <-- tipo de dato
  desproduct varchar2(10)  <-- tipo de dato y tamaño de caracteres
)
    
answered by 19.12.2016 в 18:57