About SELECT .... FOR UPDATE OF [fields] instructions

If the SELECT statement are used Alias, DISTINCT operator, CURSOR expression, SET (union, union all, minus, intersect) operators, group_by_clause, or aggregate (count, max, mix, avg) functions, you can not update query return value ;



eg:



TABLE: emp



id name salary

==========================

10 aaaa 1234

13 abcd 2313

15 cdue 1245

... ... ...





case 1> use an alias;



select id emp_id, name emp_name, salary emp_salary

from emp

where

for update; - This is not to achieve the purpose of updating;



Can be modified to



select id emp_id, name emp_name, salary

from emp

where

for update of salary - on the salary field is updated;

  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of About SELECT .... FOR UPDATE OF [fields] instructions

  • ORACLE 10G RAC error 10.2.0.4 upgrade

    15. SQL> @? / Rdbms / admin / catupgrd.sql 16. SQL> SPOOL OFF 17. Review the patch.log file for errors and inspect the list of components that is displayed at the end of catupgrd.sql script. This list provides the version and status of each SER ...

  • Oracle Database Exp / Imp tools for performance tuning

    Abstract: Oracle Exp / Imp instrument is a simple, convenient and flexible backup and restore data transfer tool, it can implement the entire class library, user-level, table-class data backup and recovery. For the amount of data in class G or G with ...

  • oracle pl / sql examples of practice

    The first part: oracle pl / sql examples of practice (1) First, use the scott / tiger user under the emp table and dept table finish the following exercises, the structure described below emp employee table (empno number of staff / ename employee nam ...

  • SQL optimization (4) - Table of the three connections

    Test the following three commonly used connection between the table: Sort - merge connected (sort-merge join, SMJ) Nested loops (nested loop, NL) Hash connection (hash join, HASH) 1. To create the test table SQL> select * from v $ version; BANNER ...

  • SQL optimization (5) - commonly used test hints

    First, the purpose of testing SunnyXu in accordance with the "SQL Performance adjust - summarized," commonly used to test the following four categories of hints: 1. The method of instruction optimizer hints with the aim ALL_ROWS: Based on t ...

  • SQL optimization (3) - four index

    Test the following four types of index: Unique Index Scan (INDEX UNIQUE SCAN) Index range scan (INDEX RANGE SCAN) Scan the whole index (INDEX FULL SCAN) Express-wide scan index (INDEX FAST FULL SCAN) 1. To create the test table and the only composite ...

  • SQL optimization (1) - full table scan and index the test

    Test Objective: To test CBO and RBO, as well as full table scan than index the situation quickly. 1. To create a test environment SQL> select * from v $ version; BANNER -------------------------------------------------- -------------- Oracle Datab ...

  • SQL optimization (2) - there is the order of the index data

    Data in the index have been scheduled well in advance of the order. So when SQL specified in accordance with the index to sort out when, in the implementation of the plan do not need to sort of. 1. To create a test environment SQL> create table te ...

  • Using SQL TRACE and TKPROF

    Can type in the operating system to obtain tkprof all available options and output options to sort a list of note has Sort Option Description call analysis prscnt execnt fchcnt the implementation of the number of extraction Analysis of the implementa ...

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries
Latest Comments