绑定ora-06502:pl/sql:数值或值错误:Node.js i中的字符串缓冲区太小
在Oracle Dev中运行此SP时 错误输出为绑定ora-06502:pl/sql:数值或值错误:Node.js i中的字符串缓冲区太小,node.js,reactjs,oracle,Node.js,Reactjs,Oracle,在Oracle Dev中运行此SP时 错误输出为 TABLE_1(:p_txn_seq, :v_rec_seq); ORA-02091: transaction rolled back ORA-02291: integrity constraint (TABLE_1.COLUMN1_FK1) violated - parent key not found 但是在NodeJS中,绑定出现了一个不同的错误 ora-06502: pl/sql: numeric or value error: cha
TABLE_1(:p_txn_seq, :v_rec_seq); ORA-02091: transaction rolled back
ORA-02291: integrity constraint (TABLE_1.COLUMN1_FK1) violated - parent key not found
但是在NodeJS中,绑定出现了一个不同的错误
ora-06502: pl/sql: numeric or value error: character string buffer too small
下面是node.js中的代码
const sql = `BEGIN
SP_NAME(
:INPUT_TXN,
:INPUT_SEQ_CNT,
:IGNORE,
:ROW_ERROR,
:STATUS);
END;`;
const bindVars = {
INPUT_TXN: transactionSeq,
INPUT_SEQ_CNT: count,
IGNORE: '',
ROW_ERROR: { dir: Database.BIND_OUT, type: Database.STRING, maxSize: 200 },
STATUS: { dir: Database.BIND_OUT, type: Database.STRING, maxSize: 2000 },
}
let result;
try {
result = await this._database.simpleExecute(sql, bindVars);
} catch (err) {
return this.throwTxnError(417, "error. txnSeq: " + transactionSeq, err,
{ transactionSeq, sql, bindVars });
}
status bind变量包含状态:{dir:Database.bind_OUT,type:Database.STRING,maxSize:2000}
感谢您的帮助检查返回字符串的大小,并根据需要增加
maxSize
这也给出了ORA-06502:PL/SQL:numeric或value错误:字符串缓冲区太小
,但如果将第一个maxSize
值增加到3,则其工作正常
await connection.execute(
`create or replace procedure SP_NAME(
INPUT_TXN IN NUMBER,
INPUT_SEQ_CNT IN NUMBER,
IGNORE IN VARCHAR2,
ROW_ERROR OUT VARCHAR2,
STATUS OUT VARCHAR2) as
begin
row_error := 'abc';
status := 'def';
end;`);
const sql = `BEGIN
SP_NAME(
:INPUT_TXN,
:INPUT_SEQ_CNT,
:IGNORE,
:ROW_ERROR,
:STATUS);
END;`;
let transactionSeq = 123;
let count = 456;
const bindVars = {
INPUT_TXN: transactionSeq,
INPUT_SEQ_CNT: count,
IGNORE: '',
ROW_ERROR: { dir: oracledb.BIND_OUT, type: oracledb.STRING, maxSize: 2 },
STATUS: { dir: oracledb.BIND_OUT, type: oracledb.STRING, maxSize: 20 },
};
result = await connection.execute(sql, bindVars);