テーブルの削除を監査テーブルに記録するトリガーを作成しようとしています。
トリガーは次のようになります。
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'*