Home » SQL & PL/SQL » SQL & PL/SQL » Need Help for query checking douplicate values
Need Help for query checking douplicate values [message #277170] Mon, 29 October 2007 02:41 Go to next message
Messages: 1
Registered: October 2007
Location: Bangalore
Junior Member

Hello eveybody,

i have 3 tables named tb_service ,tb_department and tb_linkdepartment

tb_service contains serviceid, service,

tb_department contains departmentid,department

i need to map department to services dynamically

in tb_linkdepartmentservice contains lnkdepartmentid,departmentid,serviceid.

for example if i map IT department with services like java, .net,microsft office.

their id's should be updated in tb_linkdepartmentservice.

Mapping should be allowed only once. If i map same services to IT departmnet should not be allow.

could u plz help me .how to check douplicate values..with in the query.


Re: Need Help for query checking douplicate values [message #277174 is a reply to message #277170] Mon, 29 October 2007 02:44 Go to previous messageGo to next message
Michel Cadot
Messages: 65088
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Post what you already tried.

read and follow OraFAQ Forum Guide, especially "How to format your post?" and "about IM speak" sections.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Always post your Oracle version (4 decimals).

Re: Need Help for query checking douplicate values [message #277274 is a reply to message #277170] Mon, 29 October 2007 06:32 Go to previous message
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
It sounds to me like you just need to create and delete rows in the TB_LINKDEPARTMENT.

Option 1) Simply check for the ORA-0001 Unique Constraint Violated exception when inserting a row

Option 2) Use MERGE to do the inserting instead of INSERT - that way if a row already exists in TB_LINKDEPARTMENT you'll just update the details.
Previous Topic: Translate Number value to Character
Next Topic: ORA-00904: invalid identifier, when calling a function inside the own schema
Goto Forum:

Current Time: Tue Jul 25 19:52:58 CDT 2017

Total time taken to generate the page: 0.06759 seconds