Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: giving tuples a number to make them unique..
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