How to use the oracledb.BIND_INOUT function in oracledb

To help you get started, we’ve selected a few oracledb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oracle / node-oracledb / test / plsqlBindScalar.js View on Github external
it('70.5.1 basic case: a simple string', function(done) {
      var bindVar = {
        p_inout : {
          dir:  oracledb.BIND_INOUT,
          type: oracledb.STRING,
          val:  "PL/SQL Binding INOUT Scalar"
        }
      };

      connection.execute(
        sqlrun,
        bindVar,
        function(err, result) {
          should.not.exist(err);
          // console.log(result);
          should.strictEqual(result.outBinds.p_inout, "PL/SQL Binding INOUT Scalar");
          done();
        }
      );
    }); // 70.5.1
github oracle / node-oracledb / test / binding.js View on Github external
function(callback) {
          connection.execute(
            "BEGIN nodb_bindproc3(:i, :io, :o); END;",
            [
              'Alan',  // bind type is determined from the data type
              { val: 'Turing', dir : oracledb.BIND_INOUT },
              { type: oracledb.NUMBER, dir : oracledb.BIND_OUT }
            ],
            function(err, result) {
              should.not.exist(err);
              // console.log(result);
              result.outBinds.should.be.eql([ 'Alan Turing', 101 ]);
              callback();
            }
          );
        },
        function(callback) {
github oracle / node-oracledb / test / plsqlBindIndexedTable2.js View on Github external
function(callback) {
        connection.execute(
          "BEGIN nodb_beachpkg.array_inout(:1, :2); END;",
          [
            { type: oracledb.STRING,
              dir:  oracledb.BIND_INOUT,
              val:  ["Port Melbourne Beach", "Eighty Mile Beach", "Chesil Beach"],
              maxArraySize: 3},
            { type: oracledb.NUMBER,
              dir:  oracledb.BIND_INOUT,
              val:  [8, 3, 70],
              maxArraySize: 3}
          ],
          function(err, result) {
            should.not.exist(err);
            // console.log(result.outBinds);
            (result.outBinds[0]).should.eql([ 'Chesil Beach', 'Eighty Mile Beach', 'Port Melbourne Beach' ]);
            (result.outBinds[1]).should.eql([ 70, 3, 8 ]);
            callback();
          }
        );
      }
github oracle / node-oracledb / test / dbObjectsInOut.js View on Github external
it ('195.1 IN NULL value, OUT valid String for Name', async () =>  {
    try {
      let typeName = "NODB_TEST195_TYP";
      let cls = await connection.getDbObjectClass (typeName);
      let sql = "begin nodb_test195_proc( :a ); end; ";
      let bindVar = { a :
                      { type : cls,
                        dir : oracledb.BIND_INOUT,
                        val : null
                      }
      };
      let result = await connection.execute (sql, bindVar);
      let obj = result.outBinds.a;

      should.equal ( obj.NAME, "Tom" );
    }
    catch (err) {
      should.not.exist (err);
    }
  });  // 195.1
github oracle / node-oracledb / test / resultSet2.js View on Github external
function(callback) {
          connection.execute(
            "BEGIN nodb_rs2_get_emp_inout(:in, :out); END;",
            {
              in: 200,
              out: { type: oracledb.CURSOR, dir: oracledb.BIND_INOUT }
            },
            function(err) {
              should.exist(err);
              (err.message).should.startWith('NJS-007:');
              // NJS-007: invalid value for "type" in parameter 2
              callback();
            }
          );
        },
        function(callback) {
github oracle / node-oracledb / test / fetchArraySize6.js View on Github external
var proc_query_inout = function(updateFromId, maxArraySizeVal, fetchArraySizeVal, cb) {
      connection.execute(
        "BEGIN nodb_ref_pkg.array_inout(:id_in, :c); END;",
        {
          id_in: { type: oracledb.NUMBER, dir:  oracledb.BIND_IN, val: updateFromId },
          c: { type: oracledb.STRING, dir: oracledb.BIND_INOUT, val: ["something new"], maxArraySize: maxArraySizeVal },
        },
        {
          fetchArraySize: fetchArraySizeVal
        },
        function(err, result) {
          should.not.exist(err);
          var rowsAffected = tableSize - updateFromId;
          should.strictEqual(result.outBinds.c.length, rowsAffected);
          proc_verifyResult_inout(result.outBinds.c, updateFromId, cb);
        }
      );
    };
github oracle / node-oracledb / test / rowidFunctionBindAsString_bindinout.js View on Github external
var funBindInOut = function(fun_exec, content_in, expected, callback) {
    var bindVar_in = {
      i: { val: insertID, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
      c: { val: content_in, type: oracledb.STRING, dir: oracledb.BIND_INOUT },
      o: { type: oracledb.STRING, dir: oracledb.BIND_OUT }
    };
    connection.execute(
      fun_exec,
      bindVar_in,
      function(err, result) {
        should.not.exist(err);
        var resultVal_1 = result.outBinds.c;
        var resultVal_2 = result.outBinds.o;
        should.strictEqual(resultVal_2, expected);
        should.strictEqual(resultVal_1, "AAACiZAAFAAAAJEAAA");
        callback();
      }
    );
  };
github oracle / node-oracledb / test / binding_procedureBindInout.js View on Github external
function(cb) {
        var bindVar = {
          i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
          c: { val: content, type: bindType, dir: oracledb.BIND_INOUT, maxSize: 1000 }
        };
        inBind(table_name, proc_name, dbColType, bindVar, bindType, nullBind, cb);
      },
      function(cb) {
github oracle / node-oracledb / test / binding_functionBindInout.js View on Github external
function(cb) {
        var bindVar =[ { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }, sequence, { val: content, type: bindType, dir: oracledb.BIND_INOUT, maxSize: 1000 } ];
        inBind(table_name, proc_name, dbColType, bindVar, bindType, nullBind, cb);
      }
    ], callback);
github oracle / node-oracledb / test / rowidFunctionBindAsString_bindinout.js View on Github external
var funBindInOut_update_default = function(fun_exec, content_1, content_2, expected, callback) {
    var bindVar_in = {
      i: insertID,
      c1: { val: content_1, type: oracledb.STRING, dir: oracledb.BIND_INOUT },
      c2: { val: content_2, type: oracledb.STRING, dir: oracledb.BIND_INOUT },
      o: { type: oracledb.STRING, dir: oracledb.BIND_OUT }
    };
    connection.execute(
      fun_exec,
      bindVar_in,
      function(err, result) {
        should.not.exist(err);
        var resultVal_1 = result.outBinds.c1;
        var resultVal_2 = result.outBinds.o;
        should.strictEqual(resultVal_2, expected);
        should.strictEqual(resultVal_1, "AAACiZAAFAAAAJEAAA");
        callback();
      }
    );
  };