Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Database trigger
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== After - statement-level trigger === An Oracle syntax statement trigger that is called after an UPDATE to the phone_book table. When the trigger gets called it makes an insert into phone_book_edit_history table <syntaxhighlight lang="sql"> CREATE OR REPLACE TRIGGER phone_book_history AFTER UPDATE ON phone_book BEGIN INSERT INTO phone_book_edit_history (audit_history_id, username, modification, edit_date) VALUES (audit_history_id_sequence.nextVal, USER,'Update', SYSDATE); END; </syntaxhighlight> Now doing exactly the same update as the above example, however this time with a statement level trigger. <syntaxhighlight lang="sql"> UPDATE phone_book SET phone_number = '111-111-1111' WHERE last_name = 'Jones'; </syntaxhighlight> {| class="wikitable" |- ! Audit_History_ID !! Username !! Modification !! Edit_Date |- | 1 || HAUSCHBC || Update || 02-MAY-14 |} The result shows that the trigger was only called once, even though the update did change two rows.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)