Information Management (Lab) Stored Procedures and UDF Assignment 7
Information Management (Lab) Stored Procedures and UDF Assignment 7
Assignment 7
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.
SQL SCRIPT 3: Create a user-defined function GET_TOTAL_PAYMENT() that will get the total payment
made for each transaction. A transaction number parameter will be included when the function is
called. Use TR000092 to test your function.
SQL SCRIPT 4: Create a stored procedure PAYMENT_SHORT that will display the transaction number,
customer name, total sales, total payment, and the difference between total sales and total
payment. 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.
Create these views first before using it inside your stored procedure.NO NEED TO DISPLAY THE CONTENT
OF THESE VIEWS.