Oracle - URG. PROBLEMAS CON ROWNUM

 
Vista:

URG. PROBLEMAS CON ROWNUM

Publicado por MANUEL (11 intervenciones) el 25/04/2006 16:04:55
TENGO PROBLEMAS PARA TRAERME UNA CANTIDAD DE DATOS DE UNA TABLA, POR EJEMPLO SI LE DIGO QUE ME MUESTRE:
WHERE ROWNUM <= 100, LO HACE, PERO CUANDO LE DIGO >100, NO TRAE NADA.

SI ALGUIEN ME PUEDE AYUDAR SE LO AGRADEZCO.

SALUDOS

MANUEL
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:URG. PROBLEMAS CON ROWNUM

Publicado por car2004 (9 intervenciones) el 25/04/2006 18:15:28
El rownum no esta asociado en el registro y simplemente es un contador de registros. Si le pones que sea <= 100 se para cuando llega a 100, pero si le pones que >100 no trae ninguno porque cada registro que evalua es el rownum=1, como no es > 100 lo desecha y coge el siguiente, pero sigue siendo el 1. ¿me explico?
Saludos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:URG. PROBLEMAS CON ROWNUM

Publicado por Claudia (1 intervención) el 10/10/2006 20:32:57
Conditions testing for ROWNUM values greater than a positive integer are always
false. For example, this query returns no rows:
SELECT * FROM employees
WHERE ROWNUM > 1;
The first row fetched is assigned a ROWNUM of 1 and makes the condition false. The
second row to be fetched is now the first row and is also assigned a ROWNUM of 1
and makes the condition false. All rows subsequently fail to satisfy the condition, so
no rows are returned.
You can also use ROWNUM to assign unique values to each row of a table, as in this
example:
UPDATE my_table
SET column1 = ROWNUM;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar