Oracle triggers modify its own field solution

Source: Internet
Author: User
--CREATE TABLE Structure/*create table Tbl_user (  user_id INTEGER PRIMARY KEY,  UNAME VARCHAR2 () not NULL,  upwd VARCHAR2 (20) Not NULL,  last_modified DATE); */--1, creating a package Create or REPLACE the packages Pkg_tbluser_updateas  g_id tbl_user. User_id%type; END pkg_tbluser_update;/--2, creating row triggers create OR REPLACE TRIGGER after_upd_tbluser_rowtrgafter UPDATE of UNAME on Tbl_userfor Each rowbegin  pkg_tbluser_update. G_id:=:new. user_id; End;/--3, create a statement trigger (update the data table Tbluser field based on the global variables of the package) create OR REPLACE TRIGGER after_upd__tbluser_trgafter update of UNAME on Tbl_userbegin  UPDATE tbl_user     SET last_modified = sysdate     WHERE     user_id = pkg_tbluser_update. g_id; end;/

Oracle triggers modify its own field solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.