0% found this document useful (0 votes)
65 views

PL/SQL Project 7 Banking Database: Write The Following Functions, Procedures and Triggers: Functions

The document describes a banking database that stores information about clients, accounts, agencies, agents, and transactions. It includes entities for clients, accounts, agencies, agents, and transactions. It also provides descriptions of functions, procedures, and triggers to implement business logic for the banking system, such as calculating client and account information, displaying account details, processing monthly fees, updating salaries, and enforcing business rules.

Uploaded by

Ali Haidar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

PL/SQL Project 7 Banking Database: Write The Following Functions, Procedures and Triggers: Functions

The document describes a banking database that stores information about clients, accounts, agencies, agents, and transactions. It includes entities for clients, accounts, agencies, agents, and transactions. It also provides descriptions of functions, procedures, and triggers to implement business logic for the banking system, such as calculating client and account information, displaying account details, processing monthly fees, updating salaries, and enforcing business rules.

Uploaded by

Ali Haidar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PL/SQL Project 7

Banking Database

A database is used to manage the clients’ accounts of the different agencies of a bank. A client
can have many accounts and the same account can be shared by many clients. An account can
either be a CURRENT or a SAVING account. The operation can be either RETRIEVAL or
DEPOSIT. By default, the operation date is the date of the current day, the amount of the
operation is always positive. Every client has an advisor who is an agent working in the agency
where the account of the client is open. A client can only retrieve money from an account that he
belongs or shares and the amount to retrieve should not exceed the balance of the account. The
director of an agency should earn more than any agent of the agency.
ACCOUNT (accid, balance, openingdate, acctype, currency) C15, N, D, C7, C10
AGENCY (agencyid, agencyname, tel, director) N, C20, C10, N
AGENT (agentnum, fname, lname, address, salary, agencyid) N, C20, C20, C30, N, N
CLIENT (cltid, fname, lname, address, agencyid, adviser, nationality) C5, C20,C20,C30,N,N,
C20
CLIENTACCOUNT (accid, cltid) C15, C5
OPERATION (oprnum, cltid, accid, oprdate, oprtype, amount) N, C5, C15, D, C10, N

Write the following functions, procedures and triggers:

Functions
1. Write a function ClientsperAdviser that calculates and returns, for a given adviser, the
number of his clients.
2. Write a function SumBalances that calculates and returns, per client, per type of
account and per currency, the sum of his balances.
3. Write a function that returns the maximum number of accounts per client.

Procedures

1. Write a procedure ShowAccounts that displays the identifiers of the various accounts
owned by a client knowing his id.
2. Write a month-end procedure ServiceCharge that debits by a given amount each
current account managed by a given agency.
3. Write a procedure to increase by a given percentage the salary of the advisers whose
clients made this year a greater number of transactions than the average number of
transactions made this year by a client.
4. Write a procedure to list by agency the number of current accounts and the number of
savings accounts in USD
Triggers

P7-1
Write the triggers ensuring:
1. that a client can only withdraw money from an account that belongs to him.
2. that a client cannot make a withdrawal that is greater than the balance of the
account concerned by the withdrawal transaction.
3. that the director of an agency is better paid than the agents of his agency.
4. that after each transaction, the balance of the account concerned by the
transaction is updated.

P7-2

You might also like