How Oracle can update newly inserted data with trigger implementation

Source: Internet
Author: User

How Oracle can update newly inserted data with trigger implementation
Create or Replace Trigger Tr_name
Before insert
On table
For each row
Begin
: New. A field = ' newly value ';
End

Modify a field of a table of data AA (this field is specified), after saving the data in a table of the other field BB will be based on a function of the AA field value after processing update
Create or Replace Trigger BF_ZJ_UPDATEZJM
After update of AA on a
For each row
Begin
Update a set Bb=f_pinyin (: NEW.AA) where pk_id=:old.pk_id;
End
---pk_id is the primary key for your table a,---bb=f_pinyin (: new.aa) updates the BB field after the new AA value is processed by the function
You can test to see if it can be updated and if the concurrent operation will deadlock

Four floors, right.
---pk_id is the primary key for your table a,---bb=f_pinyin (: new.aa) updates the BB field after the new AA value is processed by the function
You can test to see if it can be updated and if the concurrent operation will deadlock
As a result, there will be
Thank you for your help. Now the problem has been solved, the previous thinking is wrong, if you want to operate on the same table, should not use after update and should be before update, that should be changed before update and which is the update of which data To modify that data, so
if (: Old.pk_medinvbasdoc =: New.pk_medinvbasdoc) Then
: New.invmnecode: = F_pinyin (: new.invname)
You can do it.
Thank you for your help, thank.
http://bbs.csdn.net/topics/380200537


How Oracle can update newly inserted data with trigger implementation

Related Article

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.