Archives: 10/30/2015

Sum previous row values in oracle

with t as ((SELECT ‘0’ ordine, ‘2’ mtlevel, v.cd_int, NULL dt_tem, v.cd_grm || ‘ ‘ || v.cd_int nr_tem, NULL cd_clifor, v.ds_referenza_interna ds_descrizione, null nr_lotto, ‘E’ cd_tipo_movimento, NVL(gi.ps_netto, 0) qta, NVL(TAB_MOV.ps_movimento_inizioanno, 0) tqta FROM anag_referenze_ext v LEFT OUTER JOIN SIGO_INVENTARIO gi ON gi.cd_deposito = :CD_DEPOSITO AND gi.cd_int = v.cd_int AND gi.dt_inventario = TO_CHAR(TO_DATE(:ADATA), ‘YYYY’) – 1…

Managing errors

BEGIN — … — — statements — — … — RAISE_APPLICATION_ERROR(-20000, ‘Custom error’); /*-20000 .. -20999*/ –RAISE NO_DATA_FOUND; COMMIT; EXCEPTION WHEN NO_DATA_FOUND THEN ROLLBACK; DBMS_OUTPUT.put_line(‘Nessun dato trovato’); WHEN OTHERS THEN ROLLBACK; DBMS_OUTPUT.put_line(sqlerrm); END;

Go Top