Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/07/2013, 13:09
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: [ayuda]problema con función en pgsql

La verdad simulé tu escenario, y me respeta el where.
Solo me borra el registro que le paso.


Prueba sin hacer uso de alias y nombrando el campo de entrada diferente a la columna.
Código SQL:
Ver original
  1. CREATE OR REPLACE FUNCTION borrarnomina(v_id_nomina INTEGER)
  2. RETURNS INTEGER AS
  3. $$
  4. DECLARE
  5. tempo INTEGER;
  6. BEGIN
  7. DELETE FROM ONLY conceptodetalle WHERE id_nomina=v_id_nomina;
  8. --execute cadena into tempo;
  9. --if (FOUND)
  10. -- then
  11. -- delete from only detallenomina where id_nomina=$1;
  12. -- execute cadena into tempo;
  13. --if (FOUND)
  14. -- then
  15. -- delete from only nomina where id_nomina=$1;
  16. --execute cadena into tempo;
  17. --if (FOUND) --tempo
  18. -- then
  19. -- commit;
  20. -- return 1;
  21. --else
  22. -- rollback;
  23. --return 0;
  24. -- end if;
  25. --else
  26. -- rollback;
  27. -- return 0;
  28. --end if;
  29. --else
  30. -- rollback;
  31. --return 0;
  32. --end if;
  33. RETURN 1;
  34. END;
  35. $$
  36. LANGUAGE 'plpgsql';
__________________
Without data, You are another person with an opinion.
W. Edwads Deming