below is the pl-sql code.
It, displays the number of total records inserted/updated/deleted.
If the count matches, will issue COMMIT otherwise rollback.
SET SERVEROUTPUT ON;
DECLARE
v_update number := 0;
v_delete number := 0;
v_insert number := 0;
Begin
delete from bill_detail where bill_detail in (9878506)
and policy = 4236807;
v_delete := v_delete + SQL%ROWCOUNT;
update prem set written_prem = 50,
commission_amt = 7.50,
audit_id = USER,
last_modified = SYSDATE
where prem in (85272831)
and policy = 3567140;
v_update := v_update + SQL%ROWCOUNT;
update bill_detail set gross_amt = 50,
commission_amt = 7.50,
net_amt = 42.5
where bill_detail = 9881358 and policy = 3567140;
v_update := v_update + SQL%ROWCOUNT;
update installment set remaining_prem = 50,
installment_status = 'Future',
-- original_prem = 501,
total_due = 50,
paid_date = NULL,
bill_date = NULL
where installment = 21820355
and policy = 3567140;
v_update := v_update + SQL%ROWCOUNT;
DBMS_OUTPUT.PUT_LINE('ROWS UPDATED ' || v_update);
DBMS_OUTPUT.PUT_LINE('ROWS DELETED ' || v_delete);
DBMS_OUTPUT.PUT_LINE('ROWS INSERTED ' || v_insert);
END;
/
What is the equivalent code in t-sql to achieve the same as above?