oracle - PHP calling ORA stored procedure: ORA-01722 invalid number -


i have ora stored procedure:

procedure calc(code in number, extloan in number, loan in number, payment in number, duration in number, saleid in number, resultblob out clob); 

(currently header available).

i have tried php call (i using oci_* functions directly, though have wrapper object them):

$query = ' begin      calc(         :code,         :extloan,         :loan,         :payment,         :duration,         :saleid,         :result);  end;';  $stmt = oci_parse($this->connection, $query);  oci_bind_by_name($stmt, ':code', 100, 3, sqlt_int); oci_bind_by_name($stmt, ':extloan', 20000, 9, sqlt_int); oci_bind_by_name($stmt, ':loan', 50000, 9, sqlt_int); oci_bind_by_name($stmt, ':payment', 0, 9, sqlt_int); oci_bind_by_name($stmt, ':duration', 60, 3, sqlt_int); oci_bind_by_name($stmt, ':saleid', 2211445, 9, sqlt_int); // <- row generating error  // tried these binds no luck (same error) //oci_bind_by_name($stmt, ':code', 100); //oci_bind_by_name($stmt, ':extloan', 20000); //oci_bind_by_name($stmt, ':loan', 50000); //oci_bind_by_name($stmt, ':payment', 0); //oci_bind_by_name($stmt, ':duration', 60); //oci_bind_by_name($stmt, ':saleid', 2211445);  $desc = oci_new_descriptor($this->connection, oci_d_lob); oci_bind_by_name($stmt, ':result', $desc, -1, oci_b_clob);  oci_execute($stmt, oci_default); // <- here error occurs... 

now, see, of sqlt_int binds pure integer numbers. procedure awaits numbers going in... error ora-01722 invalid number occurs.

now if change

oci_bind_by_name($stmt, ':saleid', 2211445, 9, sqlt_int); 

to

oci_bind_by_name($stmt, ':saleid', 2211445, 9, sqlt_num); 

the execute generates error: ora-01403 no data found.

what have tried call:

$query = ' begin      calc(         100,         20000,         50000,         0,         60,         2211445,         :result);  end;';  $stmt = oci_parse($this->connection, $query);  $desc = oci_new_descriptor($this->connection, oci_d_lob); oci_bind_by_name($stmt, ':result', $desc, -1, oci_b_clob);  oci_execute($stmt, oci_default); // <- here error occurs... 

but still same ora-01722 invalid number error.

i tried run query directly in sql developer:

declare   code number := 100;   extloan number := 20000;   loan number := 50000;   payment number := 0;   duration number := 60;   saleid number := 2211445;   cclob clob; begin   calc(     code,     extloan,     loan,     payment,     duration,     saleid,     cclob);   dbms_output.put_line(cclob); end; 

and statement executed while output outputted supposed.

do have idea may cause problem???


edit 1: funny thing if in sql developer

saleid varchar2(7) := '2211445'; 

(instead of previous saleid number := 2211445;)the procedure still executed no error, conversion/casting succeeds...


edit 2: make sure problem not descriptor nor clob variable binding, have tried next call (the rest same):

$this->db->parsequery(' declare     code number := :code;     extloan number := :extloan;     loan number := :loan;     payment number := :payment;     duration number := :duration;     saleid number := :saleid;     myclob clob; begin      calc(         code,         extloan,         loan,         payment,         duration,         saleid,         myclob);     :myclob := myclob;      exception when others         :myclob := \'<params>     <code>\' || code || \'</code>     <extloan>\' || extloan || \'</extloan>     <loan>\' || loan || \'</loan>     <payment>\' || payment || \'</payment>     <duration>\' || duration || \'</duration>     <saleid>\' || saleid || \'</saleid> </params>\'; end;'); 

removed bindings clob 1 , output ($lob->load();) returned proper xml string values passed in...

i guess clear problem lies elsewhere , descriptor/clob biniding ok...


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -