我正在将对象绑定到 oracle 过程,但它抛出错误“NJS-012:在参数 2 中遇到无效的绑定数据类型”
这是我的 Oracle 包定义, 所有变量
create or replace PACKAGE allVariables AS
Patient_Gender_Male VARCHAR2(1) := 'M';
Patient_Gender_Female VARCHAR2(1) := 'F';
Error_Type_Alert VARCHAR2(20) := 'ALERT';
Error_Type_Information VARCHAR2(20) := 'INFORMATION';
Error_Type_Warning VARCHAR2(20) := 'WARNING';
Error_Location_Table VARCHAR2(20) := 'TABLE';
Error_Location_Package VARCHAR2(20) := 'PACKAGE';
Body_Adpsty_Adjstmnt_Fctr NUMBER := 1.5;
Body_Adpsty_Indx_Fctr NUMBER := 1.8;
Body_Fat_BMI_Weightage NUMBER := 1.20;
Body_Fat_Age_Weightage NUMBER := 0.23;
Body_Fat_Gender_Weightage NUMBER := 10.8;
Body_Fat_Calc_Factor NUMBER := 5.4;
TYPE GeneralHealthInputPrmtrsRcrd IS RECORD (PatientAge NUMBER,
PatientGender VARCHAR2(1),
Height NUMBER,
Weight NUMBER,
WristCircumference NUMBER,
ForearmCircumference NUMBER,
WaistSize NUMBER,
HipSize NUMBER,
ActivityLevel VARCHAR2 (20));
TYPE GeneralHealthInputPrmtrsTable IS TABLE OF GeneralHealthInputPrmtrsRcrd;
TYPE OutputParameterRecord IS RECORD ( Serial_Id NUMBER,
Analysis_Name VARCHAR2(20),
Analyzed_Value NUMBER,
Analyzed_Outcome VARCHAR2(20),
Alert_Severity VARCHAR2(10),
Alert_Message VARCHAR2(250));
TYPE OutputParameterTable IS TABLE OF OutputParameterRecord INDEX BY BINARY_INTEGER;
TYPE InputParameterRecord IS RECORD (InputParameter_Name VARCHAR2 (100),
InputParameter_Value VARCHAR2 (2000));
TYPE InputParameterTable IS TABLE OF InputParameterRecord INDEX BY BINARY_INTEGER;
END allVariables;
calculate_AllHealthOutcomes 包
create or replace PACKAGE calculate_AllHealthOutcomes AS
FUNCTION isUserValid (i_UserId IN VARCHAR2) RETURN BOOLEAN;
PROCEDURE HealthOutcomeCalculator (i_InputParameterTable IN allVariables.InputParameterTable,
o_OutputParameterTable OUT allVariables.OutputParameterTable);
END calculate_AllHealthOutcomes;
calculate_AllHealthOutcomes 包正文
create or replace PACKAGE BODY calculate_AllHealthOutcomes AS
PROCEDURE appendOutputTable (i_InputParameterTable IN allVariables.InputParameterTable,
i_ErrorMessageTable IN manage_ErrorMessages.TableType,
o_InputParametersTable OUT allVariables.OutputParameterTable) IS
BEGIN
NULL;
END appendOutputTable;
FUNCTION isUserValid (i_UserId IN VARCHAR2) RETURN BOOLEAN IS
BEGIN
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
NULL;
END isUserValid;
PROCEDURE HealthOutcomeCalculator (i_InputParameterTable IN allVariables.InputParameterTable,
o_OutputParameterTable OUT allVariables.OutputParameterTable) IS
v_Rowcount BINARY_INTEGER:=0;
v_ErrorRowCount BINARY_INTEGER:=0;
v_InputParamaterTable allVariables.InputParameterTable;
v_OutputParameterTable allVariables.OutputParameterTable;
v_ErrorMessageTable manage_ErrorMessages.TableType;
BEGIN
calculate_GeneralHealthOutcome.GeneralHealthRiskCalculator (i_InputParameterTable,v_OutputParameterTable,v_ErrorMessageTable);
IF v_OutputParameterTable.COUNT = 0 THEN
IF v_ErrorMessageTable.COUNT >0 THEN
IF manage_ErrorMessages.isFailure(v_ErrorMessageTable) THEN
v_ErrorRowCount := 1;
v_OutputParameterTable(v_Rowcount).Serial_Id := v_ErrorRowcount;
v_OutputParameterTable(v_Rowcount).Analysis_Name :=NULL;
v_OutputParameterTable(v_Rowcount).Analyzed_Value := NULL;
v_OutputParameterTable(v_Rowcount).Analyzed_Outcome := NULL;
v_OutputParameterTable(v_Rowcount).Alert_Severity := v_ErrorMessageTable( v_ErrorRowCount). Error_Message_Severity ;
v_OutputParameterTable(v_Rowcount).Alert_Message := v_ErrorMessageTable( v_ErrorRowCount).Error_Message ;
ELSE
o_OutputParameterTable := v_OutputParameterTable;
END IF;
ELSE
o_OutputParameterTable := v_OutputParameterTable;
END IF;
ELSIF v_OutputParameterTable.COUNT > 0 THEN
o_OutputParameterTable := v_OutputParameterTable;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END HealthOutcomeCalculator;
END calculate_AllHealthOutcomes;
我从节点 js 应用程序调用了该过程,但它抛出错误:“错误:NJS-012:在参数 2 中遇到无效的绑定数据类型”。参数2中的数据类型有什么问题?
const result = await conn.execute("BEGIN calculate_allhealthoutcomes.HealthOutcomeCalculator(:input, :output); END;",
{
input: { dir: oracledb.BIND_IN,
val: {
PatientAge:35,
// USERNAME:"TESTUSER",
PatientGender:"M",
Height: 155,
Weight: 60,
// "PATIENTHEIGHT":155,
WristCircumference:10,
ForearmCircumference:7,
WaistSize:33,
HipSize:38,
ActivityLevel:"HIGH"
},
type: oracledb.OBJECT
// type: oracledb.STRING
},
output: { dir: oracledb.BIND_OUT, type: oracledb.OBJECT }
}, {});
请帮忙,TIA。