Question
Pass CF variable to Oracle Trigger
Anyone know the best way (if possible) to pass a variable to
a trigger through coldfusion? Say I have a table "games" with a
trigger on it that inserts the transaction history from that table
into an audit table called "games_audit". The app user name is
defined by appuser, and I need to get that value into my audit
table as the change user.
<cfset appuser = "Firstname Lastname">
<cfquery>insert into games (game_num, game_name) values (1, 'Scrabble')</cfquery>
... then this trigger in the database runs...
create or replace trigger trg_insert_audit
after insert on games...
insert into games_audit (game_num, change_type, change_date, change_user)
values (1, 'Insert', SYSDATE, #appuser#)
...
How do I pass #appuser# into the trigger?
Note: Oracle's USER value will not work in this situation. Our database uses a generic user for all web users. I need the specific web user defined in cf.
CFMX 7, Oracle 10g
Thanks!
<cfset appuser = "Firstname Lastname">
<cfquery>insert into games (game_num, game_name) values (1, 'Scrabble')</cfquery>
... then this trigger in the database runs...
create or replace trigger trg_insert_audit
after insert on games...
insert into games_audit (game_num, change_type, change_date, change_user)
values (1, 'Insert', SYSDATE, #appuser#)
...
How do I pass #appuser# into the trigger?
Note: Oracle's USER value will not work in this situation. Our database uses a generic user for all web users. I need the specific web user defined in cf.
CFMX 7, Oracle 10g
Thanks!
