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 do u setup a replication site?
How do I uninstall oracle 11g?
Explain about your project and its relation to the current job position you are applying to?
What is redo log?
Point the difference between translate and replace?
How to start an oracle instance?
Explain the use of rows option in imp command.
How to create a stored procedure in oracle?
types of indexes and the rationale behind choosing a particular index for a situation.
Can you have more than one content canvas view attached with a window ?
How to define default values for formal parameters?
How to assign values to variables?
What is tns service name?
I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?
what is partitioning? Types of partitioning. explain? what is the new kind of partitioning type introduced in 9i?