我在下面的代码
上遇到了令人不安的错误DECLARE
CR_QUERY INTEGER;
CR_HANDLE INTEGER;
V_COL1 VARCHAR2(40);
V_COL2 VARCHAR2(18);
N_ACTION NUMBER(3);
T_CREATE_TS TIMESTAMP(6);
V_COL3 VARCHAR2(60);
BEGIN
CR_QUERY := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE (CR_QUERY, I_V_QUERY, DBMS_SQL.NATIVE);
DBMS_SQL.DEFINE_COLUMN (CR_QUERY, 1, V_COL1, 40);
DBMS_SQL.DEFINE_COLUMN (CR_QUERY, 2, V_COL2, 18);
DBMS_SQL.DEFINE_COLUMN (CR_QUERY, 3, N_ACTION, 3);
DBMS_SQL.DEFINE_COLUMN (CR_QUERY, 4, T_CREATE_TS, 6);
DBMS_SQL.DEFINE_COLUMN (CR_QUERY, 5, V_COL3, 60);
CR_HANDLE := DBMS_SQL.EXECUTE (CR_QUERY);
LOOP
BEGIN
EXIT WHEN DBMS_SQL.FETCH_ROWS (CR_HANDLE) = 0;
DBMS_SQL.COLUMN_VALUE (CR_QUERY, 1, V_COL1, N_COLERR, I_ACTUAL_LEN);
DBMS_SQL.COLUMN_VALUE (CR_QUERY, 2, V_COL2, N_COLERR, I_ACTUAL_LEN);
DBMS_SQL.COLUMN_VALUE (CR_QUERY, 3, N_ACTION, N_COLERR, I_ACTUAL_LEN);
DBMS_SQL.COLUMN_VALUE (CR_QUERY, 4, T_CREATE_TS, N_COLERR, I_ACTUAL_LEN);
DBMS_SQL.COLUMN_VALUE (CR_QUERY, 5, V_COL3, N_COLERR, I_ACTUAL_LEN);
错误是错误(41,5):PLS-00307:“COLUMN_VALUE”的声明太多与此调用相匹配。
有人会建议最新消息吗?
答案 0 :(得分:3)
问题在于:
DBMS_SQL.COLUMN_VALUE (CR_QUERY, 4, T_CREATE_TS, N_COLERR, I_ACTUAL_LEN);
如果将变量T_CREATE_TS定义为DATE,它应该可以正常工作,但是COLUMN_VALUE没有VALUE类型为TIMESTAMP的声明(至少在10.2中没有),因此它会抛出错误。