我一直在研究一个触发器,它计算修改表时的用户数。
桌子:
SKN_ENJIN
ID NUMBER
ENJIN_NAME VARCHAR2(99)
EMAIL VARCHAR2(99)
IP_ADDRESS VARCHAR2(15)
STATUS NUMBER
SKN_ENJIN_COUNT
ID NUMBER
COUNT_DATE DATE
MEMBER_COUNT NUMBER
触发
create or replace trigger "BI_SKN_ENJIN_COUNT_TG"
after insert or update or delete on "SKN_ENJIN"
DECLARE
mCount NUMBER;
mDate DATE;
begin
select COUNT(ID) into mCount from SKN_ENJIN where Status = 1;
select CURRENT_DATE into mDate from dual;
MERGE INTO SKN_ENJIN_COUNT c
USING (Select * from SKN_ENJIN_COUNT)
ON (TO_DATE(c.Count_date, 'MM-DD-YYYY') = TO_DATE(mDate, 'MM-DD-YYYY'))
WHEN MATCHED THEN
UPDATE SET c.Member_count = mCount
WHEN NOT MATCHED THEN
INSERT (Count_date, Member_count)
VALUES (mDate, mCount);
end;
当我手动将数据放入对象浏览器时,触发器工作正常。
当我将脚本放入sql命令时,它也可以工作…
但当我在应用程序中放置相同的数据时,会出现以下错误:
Ajax call returned server error ORA-20987: APEX - ORA-01858: a non-numeric
character was found where a numeric was expected ORA-06512: at
"SOKAN_MEMBER_DATA.BI_SKN_ENJIN_COUNT_TG", line 11 ORA-04088: error during
execution of trigger 'SOKAN_MEMBER_DATA.BI_SKN_ENJIN_COUNT_TG' - Contact
your application administrator. Details about this incident are available
via debug id "835641798". for .