2 Business Requirements The following are the business requirements for this project Sl Requirement 1 Table Creation 2 Sequence Creation 3 Inserting Sample Data SQL Script 4 Query Genera
Trang 1Education and Research Department
Project Specification for Oracle
Jul 2005
Document No Authorized By Ver Revision Signature / Date
ER/CORP/CRS/
DB25/006
COMPANY CONFIDENTIAL
Trang 2© Infosys Technologies Limited Document Revision History
Document Revision History
Ver.
Anubhav
Nagendra Setty Rajagopalan P
Initial write
ER/CORP/CRS/DB25/006 Version No 1.0 i
Trang 3© Infosys Technologies Limited Table of Contents
Table of Contents
1 BACKGROUND 1
2 BUSINESS REQUIREMENTS 1
2.1 List of Files supplied 1
2.2 Best Practices 1
2.3 Table Creation 2
2.4 Sequence Creation 3
2.5 Data Insertion 3
2.6 Queries 3
2.7 Stored Procedures 4
2.8 Pro C 5
ER/CORP/CRS/DB25/006 Version No 1.0 i
Trang 4Infosys Project Specification for Oracle
1 Background
This document contains the high level design of the project that has to be executed in order
to complete the course Oracle
This project is the Database creation part of Automation of Infy Bank The database will be used for other modules
2 Business Requirements
The following are the business requirements for this project
Sl Requirement
1 Table Creation
2 Sequence Creation
3 Inserting Sample Data (SQL Script)
4 Query Generation
5 Stored Procedure Creation 1.1 List of Files supplied
a) Chose the most appropriate data type while creating the table
b) Create appropriate constraints wherever applicable while creating the table
c) Use SQL loader to import data from some other data source wherever possible
d) Always use anchored declaration while creating stored procedures and functions e) Carefully select the control structures
f) Wherever applicable use bind variables
g) Create appropriate triggers to implement business logic
h) Always store the scripts in the text files
i) Declare appropriate mode for variables in stored procedures and functions
j) The input and output parameters datatype should be SQL compatible while creating stored functions
k) Please follow day5 (LC) / day4 (SC) ppts for further information on best practices l) Always handle errors using exception handling construct wherever applicable
ER/CORP/CRS/DB25/006 Version No 1.0 Page 1
Trang 5Infosys Project Specification for Oracle
This module is used to create tables for storing data To get more information about field size and data type, refer the C project specification
a) Login (This table stores the authentication information)
UserID
Password
b) Customer (This table stores the customer information)
CustomerID
Name
DateOfBirth Address City State Pin Telephone Fax
c) Employee (This table stores the Employee information)
EmployeeID (Auto, Use a sequence)
Name
DateOfJoin Email Job
d) Account (This table stores the Account Information One customer can have more than
one account)
AccountNo
CustomerID
AccountType
DateOfOpening
ER/CORP/CRS/DB25/006 Version No 1.0 Page 2
Trang 6Infosys Project Specification for Oracle
CurrentAmount
Status (C, F) Status indicating whether the account is closed or
functional
e) Transaction (This table stores the details of each transaction)
TransactionID (Auto, Use a sequence)
AccountNo
DateOfTransaction
Amount
TransactionType (D, W) Deposit, Withdraw
Description
f) Locker (This table stores the locker information)
LockerNumber
CustomerID
DateOfOpening
g) LockerOperation
LockerNumber
DateOfOperation
InTime
OutTime
The sequence is used to generate unique numbers for the following fields
a) TransactionID
b) EmployeeID
Insert the sample data into the tables You are free to include more sample records
Write the following queries
a) Query to display AccountNo, CustomerID and Name of all the valid Account Holders
b) Query to display AccountNo, CustomerID and Name of all the account holders whose accounts have been deleted
ER/CORP/CRS/DB25/006 Version No 1.0 Page 3
Trang 7Infosys Project Specification for Oracle
c) Query to display the last 10 transaction for a particular account
Create the following stored procedures
a) Create a Stored Procedure/function for Authentication
The SP should accept UserID and Password and return an integer as explained below
i) 1, if the Role is Manager
ii) 2, if the Role is Staff
iii) 3, if the Role is Customer and her account is functioning
iv) 4, if the Role is Customer and her account is deleted
v) 5, if the UserD/Password is invalid
vi) 0, if the SP fails
b) Create a Stored Procedure/Function to check whether an AccountNo is existing The SP should accept AccountNo and return an integer as explained below
i) 1, if the AccountNo is existing and functional
ii) 2, if the AccountNo is existing, but deleted
iii) 0, if the AccountNo is not existing
c) Create a Stored Procedure/Function for Account Transaction
The SP should accept AccountNo, Amount, Type of Transaction and Description and insert them into the AccountTransaction table The field Transaction Date, should
be the system date This insertion should happen only if the following conditions are met
ii) The Amount should be a positive number
iii) The Type of transaction should be valid
iv) If the Type is ‘W’, sufficient amount should be available for the
transaction That is, the balance amount should be greater than or equal to 500 after withdrawal
The SP should also update CurrentAmount in the Account table The SP should return an integer as explained below
i) 1, if the AccountNo is invalid
ii) 2, if the Amount is not a positive number
iii) 3, if the fund is not sufficient
iv) 4, if the transaction is successful
v) 0, if transaction failed
d) Create a Stored Procedure/Function for FundTransfer
ER/CORP/CRS/DB25/006 Version No 1.0 Page 4
Trang 8Infosys Project Specification for Oracle
The SP should accept FromAccountNo , ToAccountNo, Description and Amount and call the Account Transfer SP for withdrawing amount from the FromAccountNo and depositing amount to the ToAccountNo The SP should return an integer as explained below
i) 1, if the Account Number(s) is invalid
ii) 2, if the Amount is not positive
iii) 3, if the fund is not sufficient
iv) 4, if the transaction is successful
v) 0, if the transaction failed
e) Create a Stored Procedure/Function for generating the new customer ID
The SP should return the next customer ID
f) Create a Stored Procedure/Function for generating the new Account number The SP should return the next account number
Create the following Pro C program:
functionality using Pro C
b) Refer to the C module project and implement “Deposit” functionality using
Pro C
ER/CORP/CRS/DB25/006 Version No 1.0 Page 5