Search code examples
node.jsoraclenode-oracledb

ORA-01036 when calling Oracle PL/SQL function with Node.js


i'm trying to call this sql statement

 let sql: string = 'BEGIN :ret := PAC_AGE_WEB.FUN_ATIVA_FAT_ELETRONICA_AEL(:i_cod_un_cons, :i_num_cli, :i_cpu_os, :i_seq_oper_os, :i_seq_ger_os); END;';
  //
  let bindvars: oracledb.BindParameters = {
    i_cod_un_cons: Number.parseFloat(numeroUc),
    i_num_cli: Number.parseFloat(numeroCliente),
    i_cpu_os: codigoCpu.toString(),
    i_seq_oper_os: Number.parseFloat(numeroSeqOper),
    i_seq_ger_os: Number.parseFloat(numeroSeqGer),
    result: { type: oracledb.STRING, dir: oracledb.BIND_OUT, maxSize: 4000 }
  };
  //
  super.execute(sql, bindvars, autoCommit, connection, (errorAtivaFaturaEletronica, resultAtivaFaturaEletronica) => {

and i'm getting the folowing error => Error: ORA-01036: illegal variable name/number errorNum: 1036, offset: 0

The variables types are: i_cod_un_cons: float,
i_num_cli: float,
i_cpu_os: string,
i_seq_oper_os: float,
i_seq_ger__os: float


Solution

  • Resolved by changing ':ret' to ':result'.