I have a table with 14 columns in Oracle. All the columns are of integer type. i need to check no two columns in one row have same integer value in them. How can i do this using SQL. Or is it only possible to do using PL/SQL?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check the following examples.
Firstly I group the values into a collect. I’ve used the built in SYS.DBMS_DEBUG_VC2COLL but it is better if you create your won.
Then I take that collection then do a MULTISET UNION DISTINCT with an empty collection of the same type. That will remove duplicated entries.
Finally I compare that DISTINCT’d collection with the original collection. If they match, then the collection already only had unique values.