This could be a security issue. When you "open the trigger.. [and] recompile" it, which tool or application do you use for that? Whichever tool you use likely gets the benefit of role-based security. This is different than your PL\SQL procedure has when it runs, since PL\SQL does not have the benefit of role-based grants. It uses only direct (user-based) grants and/or system privileges (like "alter any table", etc.).
To build or modify a trigger dynamically with PL\SQL you may need to grant the owner of your PL\SQL procedure the "create any trigger" and "alter any trigger" system privileges. I'm not sure I would want that risk in a production database. Is modifying the trigger text the only way to accomplish what you need? It may be safer and easier to modify data in a control table, and have the trigger read from the control table to modify its action based on the data it finds there.
Main Topics
Browse All Topics





by: DrSQLPosted on 2002-04-03 at 06:21:41ID: 6915349
thuannc,
Try posting a before and after example of the trigger code. Also try posting the stored procedure.
Something for you to check while we all look at that is the syntax of your create trigger:
Since you are changing the stored trigger (when you "open that trigger change any character...then re-compile so it is valid") there could be a syntax error in the create-trigger-string that isn't making it into the stored trigger and the only reason it is "working" is because you recompiled it. Did you put a trailing "/" at the end (you shouldn't) or some other extraneous character(s) that aren't showing up in the trigger you later "open"?
Good luck!