RE: Uniqueness

  • From: "Eric Buddelmeijer" <Eric.Buddelmeijer@xxxxxxxxxx>
  • To: <chiragdba@xxxxxxxxx>, <jacintakean@xxxxxxxxx>
  • Date: Wed, 18 May 2005 09:23:38 +0200

If you are more interested in the ones that are not unique, I use

Select col_name,count(*) 
From table
Group by col_name
Having count(*) > 1

Kind regards,
Eric


-----Oorspronkelijk bericht-----
Van: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]
Namens Chirag DBA
Verzonden: woensdag 18 mei 2005 8:31Aan: jacintakean@xxxxxxxxx
CC: oracle-l@xxxxxxxxxxxxx
Onderwerp: Re: Uniqueness

If it is a primary key, it will be unique... if not then you have to write
an sql for finding duplicate values. If there are duplicate values it is not
unique.

select col_name from table1 where rowid not in(Select min(rowid) from
table1 group by col1,col2,col3,....);

Hope this will work.

Regards - Chirag=20

On 5/18/05, Kean Jacinta <jacintakean@xxxxxxxxx> wrote:
> Hi again,
>=20
> Is there a way to check for uniqueness of a value ?
> Apart from set the column to be unique ?
>=20
> For example :
>=20
> Table : mytbl
> PK ID
> ----
> 1
> 2
> 3
>=20
> Insert into mytbl (id) values (2);
>=20
> Oracle will give error.
>=20
>=20
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around  
>http://mail.yahoo.com
> --
> //www.freelists.org/webpage/oracle-l
>
--
//www.freelists.org/webpage/oracle-l


--
//www.freelists.org/webpage/oracle-l

Other related posts: