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

Home -> Community -> Usenet -> c.d.o.misc -> Re: giving tuples a number to make them unique..

Re: giving tuples a number to make them unique..

From: <mgogala_at_rocketmail.com>
Date: Fri, 15 Jan 1999 01:39:10 GMT
Message-ID: <77m67t$2rh$1@nnrp1.dejanews.com>


In article <369e0837.88294881_at_bigXb>,
  uk7i_at_rz.uni-karlsruhe.de wrote:
>
> i need to number rows in a _select_-statement to get unique tuples
> with ascending instanceids:
>
> name, instanceid
> a, 1
> a, 2
> b, 1
> c, 1
> c, 2
> c, 3
> d, 3
>
> (the select-statement is a flattened inclusion-hierarchy using
> connect-by which is intended to be inserted in another relation)
>
> any ideas?
>
> if that's not possible: how can i get a sequence on the fly? in sybase

It's a bad idea to do things while you are flying. It may prove dangerous.

> one uses number(*) for that purpose..

Oracle uses rownum. Your query would be something like:

Select rownum,name,instanceid from mytab order by name,instanceid;

>
> ciao, jan
>

Mladen Gogala

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Jan 14 1999 - 19:39:10 CST

Original text of this message

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