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
What is oracle rownum?
what are the advantages of running a database in archive log mode?
How to rename an index?
What is oracle open database communication (odbc)?
What is sequence?
Explain the use of log option in exp command.
What is proxy method?
How data locks are respected in oracle?
Whether any commands are used for months calculation? If so, what are they?
A table t is there.If you perform insert ,update and delete then the trigger will fire.What is the minimum no of trigger required for a table.
What is the usage of save points in oracle database?
How to connect to a local oracle 10g xe server?
what are bitmap indexes? How does they work?
What is a system tablespace and when it is created?
What is tns service name?