You are on page 1of 8

Data Insertion Using Stored Procedure Competency Building Asset

CONSULTANCY SERVICES LIMITED

February 2010

1. Part A: Data Insertion Using Stored Procedure Requirements.....................................................3 a. Functional Requirements.........................................................................................................3 b. Critical Quality Requirements...................................................................................................3 1.1 Security (High)..................................................................................................................3 1.2 Interoperability (Criticality)................................................................................................3 1.3 Performance (Criticality)...................................................................................................3 1.4 Reliability (High)...............................................................................................................3 1.5 Usability (Criticality)..........................................................................................................3 1.6 Maintainability (Criticality).................................................................................................3 1.7 Portability (Criticality)........................................................................................................3 2. Part B: Data Insertion Using Stored Procedure Process Steps....................................................4 2.1 Pre-requisite condition...........................................................................................................4 2.2 SQL Server ..........................................................................................................................4 2.2.1 Process steps for Functional Requirements.....................................................................4 2.2.2 Process steps for CTQs...................................................................................................4 2.3 MySQL..................................................................................................................................5 2.3.1 Process steps for Functional Requirements.....................................................................5 2.3.2 Process steps for CTQs...................................................................................................5 2.4 Oracle ..................................................................................................................................5 2.4.1 Process steps for Functional Requirements.....................................................................5 2.4.2 Process steps for CTQs...................................................................................................6 2.5 Appendix A: Table Description..............................................................................................6 3. Part C Acceptance Criteria........................................................................................................8

1. Part A: Data Insertion Using Stored Procedure Requirements a. Functional Requirements


(Suitability) Requirements Statement Create a database for XYZ Corporation to keep track of information regarding their Customer. The Database will have 4 tables. One table named Customer will stores customer information and it will refer information in another 3 table CITY, Branch and ZIP. The relationship between Customer and City table will be lives in relationship. The DBMS used is SQL and the commands should be written with standard ANSI SQL. CITY, Branch and ZIP table contains static data. To enter data into these tables, instead of writing insert statement use stored procedure. The layouts of the tables are provided in Appendix A. Context Where does the requirement fit in the system? Almost every application requires storing valuable data. These valuable data are stored using DBMS (Database Management System). Database uses Tables to store data according to a schema. These data are used to perform different organizational operations.

b. Critical Quality Requirements


CTQ- Critical to Quality, Criticality: High/ Medium/ Low 1.1 Security (High) The Application should not allow any user to access without authentication. Permission to create database or table should be defined using user roles. 1.2 1.3 1.4 Interoperability Performance Reliability (Criticality)

(Criticality)

(High)

Data type of the parameters using in the procedure should match with the data type of the corresponding column. 1.5 1.6 1.7 Usability (Criticality) (Criticality)

Maintainability Portability

(Criticality)

2. Part B: Data Insertion Using Stored Procedure Process Steps


2.1 Pre-requisite condition
For creating database and tables refer Create Database and Table CBA.

2.2 SQL Server


2.2.1 Process steps for Functional Requirements Creating the Database and Required Table 1. 2. 3. 4. Open Microsoft SQL server Management studio. Provide server name and authentication details and click connect. Click on New Query Tab. Under the workspace, write
USE <database name>;

5. Press F5 6. Click on New Query Tab. Write command to create a stored procedure INSERT_CITY_INFO for Insertion Operation on CITY table. The procedure should take parameter corresponding to each column of the table. The procedure body should contain insert statement to store data in the city Table using procedure parameter as values.

7. Press F5 8. To execute the stored procedure use EXEC command. 9. Create and execute store procedure for Branch and ZIP table as well.

2.2.2

Process steps for CTQs

2.2.2.1 Security Management studio provides two options: (1)Windows Authentication (2)SQL Server Authentication To provide permissions user roles can be used and access right to database could be provided using the user role. 2.2.2.2 Reliability While creating procedure specify the size of the parameters used appropriately.

2.3 MySQL
2.3.1 Process steps for Functional Requirements 1. Open MySql prompt from All Programs menu. 2. Provide password for authentication and then press enter 3. Type below command to enter into the database Use <database name>; 4. Write command to create stored procedure for inserting data into CITY table. a. Use Delimiter command to start the procedure b. Pass IN parameters in the procedure create statement. The value of the parameter is to assign to the column c. Inside Begin---End block, write the Insert statement for the table using parameter value d. Use Delimiter command to finish the procedure. 5. To execute the stored procedure use CALL command. 6. Similarly create and execute the stored procedure for BRANCH and ZIP table. 2.3.2 Process steps for CTQs

2.3.2.1 Security To grant access permission for table use GRANT commands at SQL command prompt. 2.3.2.2 Reliability While creating procedure specify the size of the parameters used appropriately.

2.4 Oracle
2.4.1 Process steps for Functional Requirements

1. Select Programs in the Start menu. Then select Oracle - ORACLE_HOME, then Application Development, and click SQL Plus. The SQL*Plus window appears displaying the Log On dialog.

2. Enter user name and password. If you are connecting to a remote Oracle database, enter the Oracle Net connect identifier in the Host String field. To connect to the default database, leave the Host String field blank. 3. Write command to create stored procedure for inserting data into CITY table. a. Pass IN parameters in the procedure create statement. This is because the value of the parameter is going to be assigned to column b. Inside Begin---End block write the Insert statement for the table using parameter value 4. To execute the stored procedure write EXEC command 5. Create and execute stored procedure for BRANCH and ZIP table as well/similarly.

2.4.2 Process steps for CTQs 2.4.2.1 Security To grant access permission for table use GRANT commands at SQL command prompt. 2.4.2.2Reliability While creating procedure specify the size of the parameters used appropriately.

2.5 Appendix A: Table Description


a. Definition for BRANCH Table :

S. No 1 2 3

Column Name

Field Type
INTEGER CHARACTER CHARACTER

Size
9999 50 3

Remarks

branch_code branch_name city_id

Numeric maximum 9999 refers branch master String max 50 characters 3 character code for city referring city master

b. Definition for CITY Table:

S. No 1 2 3 4

Column Name

Field Type
CHARACTER

Size
3

Remarks
NOT NULL, UNIQUE NUMBER IDENTIFYING THE CITY.

city_id city_name State country

CHARACTER

50

50 characters max 50 characters max 50 characters max

CHARACTER

50

CHARACTER

50

c. Definition for ZIP Table: S. No 1 2 Column Name Field Type


CHARACTER CHARACTER

Size
4 20

Remarks
NOT NULL, UNIQUE NUMBER IDENTIFYING THE EMPLOYEE AND HIS LIBRARY CARD NO. NOT NULL

city_id Zip_code

Primary Key

Foreign Key

3. Part C Acceptance Criteria


Criteria a) b) Ability to build quality Execute the CBA correctly Time to build quality Productivity Benchmark productivity (experts) Minimum acceptable productivity Time to build competence in associate range UOM % hours Hours Hours Days Target Value 100 1 2 .5 to 1

c)

You might also like