Oracle views created from multiple tables cannot be inserted.

Source: Internet
Author: User

The oracle view can be created from a single table or multiple tables. The oracle view created for a single table can be added, deleted, or modified. Multi-table views cannot be directly updated by adding oracle views.

Solution: Replace the trigger. Speaking of this, everyone may know how to do it.

 
 
  1. Create or replace trigger name
  2.  
  3. Instead Of Insert or update or delete
  4.  
  5. On View
  6.  
  7. For each row
  8.  
  9. Declare
  10.  
  11. Begin
  12.  
  13. If Inserting Then
  14.  
  15. Insert Into basic table 1 (t11, t12) Values (: New. f1,: New. f2 );
  16.  
  17. Insert Into basic table 2 (t11, t22) Values (: New. f1,: New. f3 );
  18.  
  19. Elsif Updating Then
  20.  
  21. Update basic table 1 set t11 =: New. f1, t12 =: New. f2 where t11 =: New. f1;
  22.  
  23. Update basic table 2 set t11 =: New. f1, t22 =: New. f3 where t11 =: New. f1;
  24.  
  25. Elsif Deleting then
  26.  
  27. Delete from basic table 1 where t11 =: Old. f1;
  28.  
  29. Delete from basic table 2 where t11 =: Old. f1;

Entire Process of creating Oracle Materialized View

Statement syntax for oracle time addition and subtraction

Oracle deadlock handling

Statement of Oracle paging Query

ORACLE instance creation process

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.