AdmMono/src/db/migration/V20170807_1439__mantis9339.sql

8 lines
326 B
SQL

declare
object_exists exception;
pragma exception_init (object_exists , -00001);
begin
execute immediate 'update ruta_secuencia r set r.kmoriginal = COALESCE((select t.cantkmreal - coalesce(t.cantkmentradasaida,0) from tramo t where t.tramo_id = r.tramo_id), 0)';
exception when object_exists then null;
end;