0% found this document useful (0 votes)
308 views3 pages

This Study Resource Was: SQL SCRIPT 1: Create A Stored Procedure SHOWSTATE That Has A Parameter of Two-Character State

The document contains instructions for creating 4 SQL scripts: 1. A stored procedure that displays customer information based on a 2-character state code parameter. 2. A stored procedure that displays sales transaction details based on a transaction number parameter. 3. A user-defined function that calculates the total payment for a transaction specified by number. 4. A stored procedure that displays transactions, customer name, total sales, total payment, and difference using views and the payment function.

Uploaded by

Marvin Cinco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
308 views3 pages

This Study Resource Was: SQL SCRIPT 1: Create A Stored Procedure SHOWSTATE That Has A Parameter of Two-Character State

The document contains instructions for creating 4 SQL scripts: 1. A stored procedure that displays customer information based on a 2-character state code parameter. 2. A stored procedure that displays sales transaction details based on a transaction number parameter. 3. A user-defined function that calculates the total payment for a transaction specified by number. 4. A stored procedure that displays transactions, customer name, total sales, total payment, and difference using views and the payment function.

Uploaded by

Marvin Cinco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL SCRIPT 1: Create a stored procedure SHOWSTATE() that has a parameter of two-character state

code ( eg. NY, CA, NJ) that will list all information about the customer who lives in a particular state.
Refer to the CUSTOMER table. The state code can be in lower or uppercase supplied in the parameter.
Use CA to test your stored procedure.

Hint: Use LIKE and UPPER in your stored procedure.

m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh

This study source was downloaded by 100000829178195 from CourseHero.com on 11-22-2021 01:40:53 GMT -06:00

https://www.coursehero.com/file/86023000/assgn8docx/
SQL SCRIPT 2: Formulate a stored procedure DISPLAYTRANS() that will display the corresponding sales
transaction based on the transaction number passed. Display transaction number, sales date, product
code, description, unit, quantity. Use TR000039 to test the output of your script.

m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh

This study source was downloaded by 100000829178195 from CourseHero.com on 11-22-2021 01:40:53 GMT -06:00

https://www.coursehero.com/file/86023000/assgn8docx/
m
er as
co
eH w
o.
rs e
SQL SCRIPT 3: Create a user-defined function GET_TOTAL_PAYMENT() that will get the total payment
ou urc
made for each transaction. A transaction number parameter will be included when the function is
called. Use TR000092 to test your function.
o

SQL SCRIPT 4: Create a stored procedure PAYMENT_SHORT that will display the transaction number,
aC s

customer name, total sales, total payment, and the difference between total sales and total payment.
vi y re

This stored procedure has no parameters.

In this procedure you will use a different set of views that you have created to extract total sales
depending on the correct unit price to be used based on effectivity date and sales date.
ed d
ar stu

Create these views first before using it inside your stored procedure.NO NEED TO DISPLAY THE CONTENT
OF THESE VIEWS.

To display output of the requirement, include GET_TOTAL_PAYMENT user-defined function that you
is

have created in item 3. TRANSNO should serve as the parameter AND NOT TR000092
Th
sh

This study source was downloaded by 100000829178195 from CourseHero.com on 11-22-2021 01:40:53 GMT -06:00

https://www.coursehero.com/file/86023000/assgn8docx/
Powered by TCPDF (www.tcpdf.org)

You might also like