How to insert a view created from multiple Oracle tables

Source: Internet
Author: User

The following articles mainly describe the actual insert operations for views created from multiple Oracle tables. We all know that views created from a single table are actually operated, you can add, delete, and modify it. Views created from multiple Oracle databases cannot be directly added to views or updated.

Solution: Replace the trigger. Everyone may know how to do this.

Create or replace trigger name

 
 
  1. Instead Of Insert or update or delete 

On View

 
 
  1. for each row  
  2. Declare  
  3. begin  
  4. If Inserting Then  

Insert Into basic table 1 (t11, t12) Values (: New. f1,: New. f2 );

Insert Into basic table 2 (t11, t22) Values (: New. f1,: New. f3 );

 
 
  1. elsif Updating Then 

Update basic table 1 set t11 =: New. f1, t12 =: New. f2 where t11 =: New. f1;

Update basic table 2 set t11 =: New. f1, t22 =: New. f3 where t11 =: New. f1;

 
 
  1. elsif Deleting then 

Delete from basic table 1 where t11 =: Old. f1;

Delete from basic table 2 where t11 =: Old. f1;


The above content is the description of the insert View created in Oracle multi-Table mode. We hope it will help you in this regard.

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.