Escolar Documentos
Profissional Documentos
Cultura Documentos
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
*/
3) The account number for each type of account will be different. i.e,
If a customer has an account of Account_type_1 and an account of type
Account_type_2, the account number for the Account_type_1 account
will be different from the account number of the Account_type_2.
4) Description of account types
a) Account_Type_1
1) Minimum balance is 250. While opening the account, the customer
has to deposit this amount.
2) Withdrawals will not be allowed if the minimum balance goes
below 250.
3) At the time of closing the account, the balance
will be paid to the customer.
b) Account_Type_2
1) No restrictions on minimum balance.
0 or -ve.
c) Account_Type_3
1) At the time OF Closing the account, the customer will pay
the balance
##############################################################
OBJECT TYPES AND THEIR RELATIONSHIP
##############################################################
customer
/
\
/
\
/
|
person
account
/
|| | |
/
/ \ \ \___________________________
address
/
\ \
\
|
\ \_______________
\
|
\
\
\
|
\
\
\
|
\
\
\
|
\
\
\
v_account_type account_type_1 account_type_2 account_type_3
(REF)
(REF)
(REF)
/*
** ##############################################################
**
**
CODING STYLE USED
**
** ##############################################################
**
**
1. Uppercase is used for PL/SQL keywords and lower case for user
**
defined items.
**
2. Naming convention followed for user defined types:
**
Data Structure Name
Prefixed With
**
--------------------------------------------**
Object Type names
o_
**
Varray Names
v_
**
Nested Table Types
n_
**
Object Tables
ot_
**
Relational Tables
rt_
**
Nested Table
nt_
**
Local Variables
l_
*/
l_actnum3 := l_o_account.open_account(l_ssn,l_account_type,l_amount,
null,null,null,null);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---
l_o_account.deposit_amount(l_actnum1,1000);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---
l_o_account.deposit_amount(l_actnum1,4000);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---
l_o_account.deposit_amount(l_actnum2,2000);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('--- Withdraw 500 from James account- in AT2 ---');
l_o_account.withdraw_amount(l_actnum2,500);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('--- Withdraw 1500 from James account- in AT1 ---');
l_o_account.withdraw_amount(l_actnum1,1500);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---
l_o_account.deposit_amount(l_actnum1,2500);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('--- Withdraw 1500 from James account- in AT3 ---');
l_o_account.withdraw_amount(l_actnum3,1500);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('--- Withdraw 1750 from James account- in AT1 ---');
l_o_account.withdraw_amount(l_actnum1,1750);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---Query for the current balance in James account---');
l_o_account.current_balance(l_actnum1);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('--Query the transaction details of James-----');
l_o_account.trans_details(l_ssn);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('--- Closing the account for James ---');
l_o_account.close_account(l_actnum1);
DBMS_OUTPUT.PUT_LINE('');
l_name := 'John';
l_date := to_date('20-AUG-78','dd-MON-yy');
l_gender := 'M';
l_address := o_address('B7896','Concurse Drive','Belmont','California',
'94065');
l_ssn := 'B7896';
l_account_type := 'AT2';
l_amount := 2000;
DBMS_OUTPUT.PUT_LINE('--- Opening an account of type AT1 for John ---');
l_actnum1 := l_o_account.open_account(l_ssn,l_account_type,l_amount,
l_name,l_date,l_gender,l_address);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---
l_o_account.withdraw_amount(l_actnum1,1000);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('---
l_o_account.deposit_amount(l_actnum1,3000);
DBMS_OUTPUT.PUT_LINE('');
DBMS_OUTPUT.PUT_LINE('----Details for John----');
l_o_account.trans_details('B7896');
END;
/
show errors
spool dm024.lis
set serveroutput on
EXECUTE run_objdemo;
spool off