I'm getting ORA-1006 error, "bind variable doesn't exists"
Below is my snippet of code
create or replace procedure bindFailure(In_cntAcct, In_custAcct, In_CardNo, In_Code) AS
txnHdl INTEGER;
begin
txnHdl := dbms_sql.open_cursor;
sqlStmt := 'select * from txn t'
|| ' where t.cntAcct = :IN_CNTACCT '
|| ' and t.custAcct = :IN_CUSTACCT '
|| ' and t.cardNo = :IN_CARDNO '
|| ' and t.Code = :IN_CODE ';
dbms_sql.parse(txhHdl, sqlStmt, DBMS_SQL.NATIVE);
dbms_sql.bind_variable(txnHdl, ':IN_CNTACCT' , In_cntAcct);
dbms_sql.bind_variable(txnHdl, ':IN_CUSTACCT' , In_custAcct);
dbms_sql.bind_variable(txnHdl, ':IN_CARDNO' , In_CardNo);
dbms_sql.bind_variable(txnHdl, ':IN_CODE' , In_Code);
dbms_sql.execute(txnHdl);
.... /* In actual code we use fetch rows */
end;
/
Here, cntAcct
, custAcct
are Number
, cardNo
and Code
are Varchar2
Most of the time above code works fine, but rarely once in 100K this code failed with error "binding variable doesn't exists".
If we take the same input and process, it works fine. I'm not able to figure out, why we are having this issue. Please help me on this.
Note: above code is snippet and i manually typed if any typo issue please ignore.
Thank you, Premchand C