Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bank Transaction.

Dharani123Mar 30 2015 — edited Mar 30 2015

Sorry for Wrongly posted Question.

I have a Bank Transaction table table.I want to display the  Account No wise Date wise Deposits and withdrawals and closing balance.

CREATE TABLE bank_transaction

    ( acc_no                        VARCHAR2(20 BYTE),

      trn_dt                          DATE,

      trn_type                      CHAR(1 BYTE),

      trn_amt                        NUMBER(10,2)

    );

/*D-Deposits and W-Withdrawals*/

 

INSERT INTO bank_transaction

VALUES('100',TO_DATE('2015-03-17 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'D',6000);

INSERT INTO bank_transaction

VALUES('100',TO_DATE('2015-03-24 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'W',5000);

INSERT INTO bank_transaction

VALUES('100',TO_DATE('2015-03-25 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'D',10000);

INSERT INTO bank_transaction

VALUES('100',TO_DATE('2015-03-25 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'W',5000);

INSERT INTO bank_transaction

VALUES('101',TO_DATE('2015-03-17 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'D',10000);

INSERT INTO bank_transaction

VALUES('101',TO_DATE('2015-03-24 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'W',5000);

INSERT INTO bank_transaction

VALUES('101',TO_DATE('2015-03-25 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'D',5000);

INSERT INTO bank_transaction

VALUES('101',TO_DATE('2015-03-25 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'W',1500);

I want to display data like this.

Account No:100

Trn_dt           Deposit      Withdrawal           Closing Bal

17-mar-2015      6000                                            6000

24-mar-2015                            5000                      1000

25-mar-2015     10000              5000                       6000

Account No:101

17-mar-2015      10000                                          10000

24-mar-2015                            5000                       5000

25-mar-2015        5000             1500                       8500

This post has been answered by Manik on Mar 30 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2015
Added on Mar 30 2015
10 comments
1,797 views