t1
col1 col2
nishi 5000
lucky 6700
akash 7000
i want that a query that when i insert 7000 it will show me data already present and data will not insert. if data is not present it will insert.
Answer Posted / ravi gali
hi u can use DUP_VAL_ON_INDEX exception
SQL> create table test(id number primary key);
Table created.
SQL> set serverout on
SQL>
begin
insert into test values(1);
exception
when DUP_VAL_ON_INDEX then
raise_application_error('duplicate value entered on the row ');
when others then
dbms_output.put_line('if u entered wrong data');
end;
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
How to best split csv strings in oracle 9i?
What is dynamic proxy?
Explain the use of grant option in imp command.
How to pass a parameter to a cursor in oracle?
Explain the different normalization forms?
How to end the current transaction in oracle?
What is private procedure oracle?
How to create tables for odbc connection testing?
When do we use group by clause in a sql query?
How to create a new table in your schema?
what is the difference between data migration and production migration.
How do I spool in oracle?
What is data type in oracle?
How to update values in a table in oracle?
Explain the use of Merge statement in oracle 11g