Oracle SQL, PLSQL, APEX How To's by Dr. S. Raghunathan - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

update profit_loss set expenditure = (select sum(nvl(debit,0)) from raak_trans_detail where raak_trans_detail.ledger_name = profit_loss.ledger_name);

update profit_loss set income = (income - expenditure), expenditure= null where income > nvl(expenditure,0); update profit_loss set expenditure = (expenditure -

income), income = null where expenditure > nvl(income,0);

 

pl:=0;

 

select sum(expenditure) - sum(income) into pl from profit_loss;

--dbms_output.put_line(to_char(pl));

 

if pl < 0 then

 

update profit_loss set expenditure = pl*-1 where ledger_name like 'PROFIT';

else

 

update profit_loss set income = pl where ledger_name like

 

'LOSS';

 

end if;

 

delete from profit_loss where nvl(income,0) = 0 and nvl(expenditure,0) = 0;

end;

 

end;

 

Find Your Next Great Read

Describe what you're looking for in as much detail as you'd like.
Our AI reads your request and finds the best matching books for you.

Showing results for ""

Popular searches:

Romance Mystery & Thriller Self-Help Sci-Fi Business