Home » SQL & PL/SQL » SQL & PL/SQL » Need to generate unique number for the combination of values (merged)
Need to generate unique number for the combination of values (merged) [message #404750] Sat, 23 May 2009 04:16 Go to next message
manju.siddaramegowda
Messages: 3
Registered: July 2008
Location: Bangalore
Junior Member
Hi,

I need to generate unique number for the combination of values.
My requirement is as follows.

CSC ID	CSC Desc	       Request id	CSC Group Id
------  --------------------   ----------       -------------
PSIBM	PRODUCT SUPPORT IBM	10	          1
SVCDEL	PRODUCT SUPPORT IBM	20	          2
PSSJ	PRODUCT SUPPORT-ST JOHN	30	          3
...
...
...
PSIBM	PRODUCT SUPPORT IBM	50	          1


CSC Group Id is the new column I need to add to the table and maintain unique number for the combination of CSC ID & CSC Desc.

In the future if any new record will have same existing CSC ID & CSC Description(in this example PSIBM & PRODUCT SUPPORT IBM) then CSC Group Id for that row should be same as the earlier(already generated) one. In this example it is 1 for Request id 50.

I hope, I am able to explain my requirement.

Thank you very much for your help.

Regards,
Manju siddaramegowda



[mod-edit: added code tags: next time please do it yourself]

[Updated on: Fri, 19 June 2009 21:06] by Moderator

Report message to a moderator

Re: Need to generate unique number for the combination of values (merged) [message #404768 is a reply to message #404750] Sat, 23 May 2009 09:40 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't understand.
Post a working Test case: create table and insert statements along with the result you want with these data.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: Need to generate unique number for the combination of values (merged) [message #409181 is a reply to message #404750] Fri, 19 June 2009 21:10 Go to previous message
Barbara Boehmer
Messages: 8625
Registered: November 2002
Location: California, USA
Senior Member
You might be able to use a trigger to check for existing values. However, a unique CSC group id can be obtained from a select statement using an analytic function, so there is no need to have such a column to store the information.
Previous Topic: How to Document PL/SQL Code
Next Topic: Help with SQL
Goto Forum:
  


Current Time: Sun Dec 04 10:46:19 CST 2016

Total time taken to generate the page: 0.09135 seconds