Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how do u setup a replication site?

1914


How do I uninstall oracle 11g?

1038


Explain about your project and its relation to the current job position you are applying to?

942


What is redo log?

1003


Point the difference between translate and replace?

1024


How to start an oracle instance?

950


Explain the use of rows option in imp command.

1040


How to create a stored procedure in oracle?

1026


types of indexes and the rationale behind choosing a particular index for a situation.

2443


Can you have more than one content canvas view attached with a window ?

2260


How to define default values for formal parameters?

980


How to assign values to variables?

1042


What is tns service name?

1069


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?

1045


what is partitioning? Types of partitioning. explain? what is the new kind of partitioning type introduced in 9i?

2218