我想从oracle会话中提取os用户,在table触发器中执行命令。这是可能的,如果是这样,有人能指出我如何实现这一目标吗?谢谢。
CREATE OR REPLACE TRIGGER tr_my_table_after_delete
AFTER DELETE
ON my_table
FOR EACH ROW
BEGIN
INSERT INTO sync_my_table_audit
(
id,
audit_user,
audit_action,
audit_date)
VALUES
( :old.id,
--executing session's os user,
'D',
current_timestamp );
END;
/
SYS_CONTEXT('USERENV', 'OS_USER')
是你的朋友,请参阅SYS_CONTEXT