我收到错误
PL/SQL:ORA-00932:不一致的数据类型:预期的 NUMBER 得到 INTERVAL DAY TO SECOND
当我尝试运行此程序时。下面代码中的列EXPIRES
是 SESSIONS 表中的 TIMESTAMP(6) 类型。就代码而言,我有两个一致的数据类型被相互减去。那么为什么会出现这个错误呢?
CREATE OR REPLACE PROCEDURE demo_restrict_multlogin (p_login varchar2,
p_out OUT NUMBER,
p_msg OUT VARCHAR2)
IS
vl_val NUMBER;
vl_diff TIMESTAMP(6);
BEGIN
p_out := 0;
SELECT SYStimestamp-EXPIRES
INTO vl_diff
FROM sessions
WHERE LOGIN_DETAILS = p_login;
SELECT CASE WHEN COUNT (1) > 0 THEN 1 ELSE 2 END
INTO vl_val
FROM sessions
WHERE LOGIN_DETAILS = p_login AND TO_CHAR (vl_diff, 'mi') > 30;
IF vl_val = 1
THEN
p_msg := 'Pass expired';
ELSE
p_msg := 'Pass not expired ';
END IF;
EXCEPTION
WHEN OTHERS
THEN
p_out := 1;
END;