Click to See Complete Forum and Search --> : with SELECT execute, with DELETE no


pepe perez
October 20th, 2004, 10:44 AM
Hi, i'm making sql cosults for oracle and i want to access to determinate number of records with ROWNUM function.
When i execute select it give me that i want without problems but when i execute delete i have problems.
My consult is:
DELETE * FROM TABLA WHERE ROWNUM<10 ORDER BY FECHA.
Do anybody know what is the problem? ¿can anybody help me?

Thanks very much

!Hola¡
Estoy haciendo consultas sql para oracle y he llegado a un punto en el que quiero acceder a un número determinado de registros con la funcion ROWNUM, cuando ejecuto el select lo obtengo sin problema, pero al ejecutar el delete no lo acepta.
Mi consulta es:
DELETE * FROM TABLA WHERE ROWNUM<10 ORDER BY FECHA.

¿Sabe alguien a que es debido?¿Sabe alguien otra forma de hacer lo mismo?¿alguien me puede ayudar?

Muchas gracias.

elsapo
October 21st, 2004, 09:14 AM
Hi,

I think that the ORDER BY clause should not be added to a DELETE statement, and it's anyway a non-sense...

I have to admit that I've never tried it but I'm pretty much sure that this could nbe the problem.

Hope this helps.

Bye.

spuppett
October 25th, 2004, 04:08 PM
What I did once was to use the select statement to make a recordset, and then use DELETE * from my recoredset.