Create a table First Brzl
Where Pym is the first letter of BRXM Pinyin
Trigger creation method Under simple remarks before creating a new trigger
create [or replace] Tigger Trigger Name trigger event on table name [for each row]begin PL/SQL statement end where: Trigger name: The name of the trigger object. Because the trigger is automatically executed by the database, the name is just a name and has no real purpose. Trigger time: Indicates when the trigger executes, which is preferable: Before: Represents the trigger execution before the database action; After: Indicates that the trigger executes after the database action. Trigger event: Indicates which database actions trigger this trigger: Insert: Database insert triggers this trigger; UPDATE: Database modification triggers this trigger; Delete: Database delete triggers this trigger. Table name: The table where the database trigger resides. For each row: executes once on each row of the table trigger. If you do not have this option, only one time is executed for the entire table.
Start operation
1 CREATE OR REPLACE TRIGGERbrzl_pym_up2BeforeInsert onBrzl3 forEach row4 Declare5Lipymvarchar2(Ten);--declaring Variables6 BEGIN7 8 SelectFgetpy (: NEW.BRXM) intoLipym fromDual--: New is the record that will be inserted9 Ten: New.pym:=Lipym; One A ENDBrzl_pym;
The effect is as good as the description is poor. Direct view operation;
Oracle uses triggers to update values for a column when inserted