Home > front end >  ERROR ORA-01008 using nodeOracledb with TS
ERROR ORA-01008 using nodeOracledb with TS

Time:11-04

i have one problem in result of my code, i tring consult one script ORACLE with nodejs using TS but i don't know why this error apear in my console i tring many ways to fix this error and i can't fix them, i hope your can help me whit this, bellow follow my code and screenshot of my error.

Controller

async bipagem(req: Request, res: Response) {
    try {
      let credentials = super.openToken(req);
      let { p_fil_filial, p_set_cdgo, p_mini_fab, p_codigo_barra } = req.query;
      let info = await this.rep.bipagem(
        p_fil_filial as string,
        p_set_cdgo as string,
        p_mini_fab as string,
        p_codigo_barra as string,
        credentials as string
      );
      res.json(info);
    } catch (error) {
      catchErr(res, error);
    }
  }

Repository

public async bipagem(
    p_fil_filial: string,
    p_set_cdgo: string,
    p_mini_fab: string,
    p_codigo_barra: string,
    userPool: string
  ) {
    let conn;
    try {
      conn = await connection(userPool);
      const resultado = await conn.execute(
        `DECLARE
            result SYS_REFCURSOR;
           BEGIN
          -- Call the function
            :result := brio.pck_fab0024.bipagem(p_fil_filial => :p_fil_filial,
            p_set_cdgo => :p_set_cdgo,
            p_mini_fab => :p_mini_fab,
            p_codigo_barra => :p_codigo_barra,
            p_msg => :p_msg);
          END;`,
        {
          p_fil_filial,
          p_set_cdgo,
          p_mini_fab,
          p_codigo_barra,
          p_msg: { type: oracledb.STRING, dir: oracledb.BIND_OUT },
        }
      );
      return resultado;
    } catch (erro) {
      console.log(erro);
    } finally {
      if (conn) conn.close();
    }
  }

Screenshot error

this is error into my console

CodePudding user response:

ORA-01008 means "not all variables bound". It looks like you have 6 variables in your PL/SQL block, but only 5 variables that are assigned to those. :result is not bound.

  • Related