0

テーブルの削除を監査テーブルに記録するトリガーを作成しようとしています。

トリガーは次のようになります。

create or replace TRIGGER cusdelete
AFTER
DELETE OR UPDATE
ON CUSTOMER
DECLARE
v_username varchar2(10);

BEGIN
SELECT V('APP_USER')
INTO v_username
FROM dual;

-- Insert record into audit table
INSERT INTO cusudit
( CUSTOMER_id,
country,
first_name,
last_name,
birth_date,
address,)
VALUES
(old.CUSTOMER_id,
old.country,
old.first_name,
old.last_name,
old.birth_date,
old.address,
sysdate,
v_username );

END;​

ただし、これを保存してコンパイルしようとすると、次のメッセージが表示されます。

*Compilation failed, line 20 (15:29:04) The line numbers associated with compilation errors are relative to the first BEGIN statement. 
    This only affects the compilation of database triggers.

PLS-00049: bad bind variable 'OLD.QUANTITY'Compilation failed, line 21 (15:29:04) 
    The line numbers associated with compilation errors are relative to the first BEGIN statement. 
    This only affects the compilation of database triggers.

PLS-00049: bad bind variable 'OLD.COST_PER_ITEM'Compilation failed, line 22 (15:29:04)
    The line numbers associated with compilation errors are relative to the first BEGIN statement. 
    This only affects the compilation of database triggers.
PLS-00049: bad bind variable 'OLD.TOTAL_COST'*
4

2 に答える 2

0

Oracle監査を使用できます

audit delete on customer

監査証跡表を問い合せる

select * from dba_audit_trail
于 2013-05-16T17:06:21.597 に答える