Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Uniqueness

RE: Uniqueness

From: Eric Buddelmeijer <Eric.Buddelmeijer_at_elegant.nl>
Date: Wed, 18 May 2005 09:23:38 +0200
Message-Id: <20050518072341.OWAO1293.amsfep18-int.chello.nl@wst116>


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_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] Namens Chirag DBA
Verzonden: woensdag 18 mei 2005 8:31Aan: jacintakean_at_yahoo.com CC: oracle-l_at_freelists.org
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_at_yahoo.com> 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
> --
> http://www.freelists.org/webpage/oracle-l
>

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


--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 18 2005 - 03:28:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US