Advanced usage of update, insert, and delete in oracle

Source: Internet
Author: User


1. Update the view. In addition to single tables, update, insert, and delete can also be applied to views and subqueries, but there are various restrictions. Restrictions on the www.2cto.com view (subquery:
1. No set operators (sum, difference, and intersection); 2. No DISTINCT operators; 3. No aggregate or analysis functions; 4. No group by, order by, MODEL, connect by, or start with clause; 5. No set expression in SELECT; 6. No subquery in SELECT; 7. No with read only; 8. updatable associated view. 9. There is an instead of trigger. Www.2cto.com: The primary key or unique index of the base table is also unique in the associated view. Then, the base table is the key reserved table. Updatable join View:
1. No with read only; 2. ONLY one basic table can be updated at a time; 3. UPDATE rule: All UPDATE columns must come from the same key-reserved table, if the view has with check option, all associated fields and all fields in most referenced tables cannot be updated. 4. DELETE rule: you can update a key to keep the table rows, it can be referenced multiple times, but it cannot be updated if multiple references have with check option. If multiple keys are retained, the first table in the FROM clause is updated; 5. INSERT rules: a non-key reserved table field cannot be referenced obviously or implicitly. If a field with check option exists, it cannot be updated. 6. If there is an embedded view in the view, the embedded view should be merge to the main view. 2. INSERT multiple tables. Insert multiple tables unconditionally at the same time: insert all into t1 into t2... values (...); insert multiple tables that meet the conditions. Each record inserts all tables that meet the conditions: insert all www.2cto.com when condition1 then into t1 when condition2 then into t2... [else into tn] values (...); insert a table that meets the conditions. Each record is inserted into the first table that meets the conditions: insert all when condition1 then into t1 www.2cto.com when condition2 then into t2... [else into tn] values (...); if the condition is not met and there is no else clause, ignore this record. Author hulubo

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.