hint IGNORE_ROW_ON_DUPKEY_INDEX

psufnxk2000發表於2014-01-07
11G新加 IGNORE_ROW_ON_DUPKEY_INDEX 這個hint可以讓對有主鍵的重複值時,不去報錯:


SQL> drop table test purge;


Table dropped.


SQL> create table test (id number primary key, name varchar2(10));


Table created.


SQL> insert into test values (1,'111');


1 row created.


SQL> insert into test values (1,'111');
insert into test values (1,'111')
*
ERROR at line 1:
ORA-00001: unique constraint (SONG.SYS_C0011677) violated




SQL> insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(test,SYS_C0011677)*/ into test values (1,'111');


0 rows created.


SQL> insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(test,aaa)*/ into test values (1,'111');             --hints用錯,會報錯
insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(test,aaa)*/ into test values (1,'111')
                                                       *
ERROR at line 1:
ORA-38913: Index specified in the index hint is invalid

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1068150/,如需轉載,請註明出處,否則將追究法律責任。

相關文章