PDA

Ver la Versión Completa : Error en sentencia delete


febito
23-06-2004, 21:12:46
estoy trabajnado con oracle 9i
la siguiente sentencia delete al ejecutrala devuelve 'comando sql no terminado correctamente'

DELETE TableOwner.ATRI
FROM TableOwner.ATRI A, TableOwner.GRUPO G, TableOwner.DE_GRU DG, TableOwner.LISTA_GRU_MUE LGM
WHERE A.IDGRU=G.IDGRU AND G.IDGRU=LGM.IDGRU AND LGM.IDMUE= :IDMUE AND DG.IDDEGRU=G.IDDEGRU AND DG.GLOBAL='N'

que error de sintaxis estoy cometiendo. Gracias

delphi.com.ar
23-06-2004, 21:23:51
Sencillamente esta mal escrita. Las tres funciones DDL básicas (INSERT, DELETE y UPDATE), pueden apuntar solo a una tabla por vez. Si puedes en el where hacer referencia a otras tablas

DELETE FROM TableOwner.ATRI
WHERE EXISTS (SELECT 1 FROM TableOwner.GRUPO G, TableOwner.DE_GRU DG, TableOwner.LISTA_GRU_MUE LGM
WHEREA.IDGRU=G.IDGRU AND G.IDGRU=LGM.IDGRU AND LGM.IDMUE= :IDMUE AND DG.IDDEGRU=G.IDDEGRU AND DG.GLOBAL='N')

Saludos!

febito
25-06-2004, 15:23:50
Funciono bien, Muchas gracias