You mean "Is there anyway I can write this trigger properly, so it does not look like spagheti code"?Originally posted by Giani
Is there anyway I can write this trigger properly ?![]()
Sure, something like:
It performs exactly the same thing your trigger does, but doesn't it look much more compact?Code:Create or Replace trigger restrict_ip after logon on database declare c_exclude1 varchar2(16) := '19.40.60.58'; c_exclude2 varchar2(16) := '19.9.100.1'; c_exclude3 varchar2(16) := '19.9.100.2'; begin if ( sys_context('userenv','ip_address') IN (c_exclude1,c_exclude2,c_exclude3 ) then raise_application_error(-20001,'connection refused'); end if; end;
Now I don't thing the triger is what is causing your troubles, the trigger is just the manifestation of the real problem you have in your database. Because I'm almost certain the real reason for your troubles lies in the table SYS.DUAL!
What does this query return:
SELECT COUNT(*) FROM dual;
I bet it returns 2 or more. Someone must have inserted you aditional rows in your table DUAL. Delete all rows but one from there and you'll be fine.




Reply With Quote