¶
9.17.1.INSERT SOFT
INSERT SOFT can be used in place of INSERT INTO if you are unsure whether the value to be inserted into a primary key column will violate that constraint. If the row with this primary key already exists, then the new row is not inserted.
SQL> create table insert_test(id integer primary key, txt varchar); Done. -- 90 msec. SQL> insert into insert_test(id, txt) values(1, 'test'); Done. -- 0 msec. SQL> insert into insert_test(id, txt) values(1, 'test'); *** Error 23000: [Virtuoso ODBC Driver][Virtuoso Server]SR197: Non unique primary key on DB.DBA.insert_test. at line 4 (4) of Top-Level: insert into insert_test(id, txt) values(1, 'test') SQL> insert soft insert_test(id, txt) values(1, 'testsoft'); Done. -- 0 msec. SQL> select * from insert_test; id txt INTEGER NOT NULL VARCHAR _______________________________________________________________________________ 1 test 1 Rows. -- 60 msec.