Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 1 This assignment will test your knowledge and skills acquired during weeks 1 thru 3 by working with the S 1 1 _ 1
Assignment
This assignment will test your knowledge and skills acquired during weeks thru by working with the S schema.
Environment Instructionss
For these questions you must first study the S tables. Use the S schema link.
You have SELECT access on the tables:
SHCUSTOMER
SHPART
SHSALESREP
You have INSERT, UPDATE access on the tables:
SHORDERS
SHORDERPROD
SHINVOICE
SHINVPROD
Assignment Requirements
You are to create the following scripts using the S tables as described below.
Write a stored procedure in your schemathat can be used to store a new order and its products in the SHORDERS and SHORDERPROD tables
You must use IN and OUT parameters NOT DBMSOUTPUT.PUTLINE. Hints
Input parameters include
Customer number
Order date
List of
part numbers
order price
order qty
Output parameters include
Generated order no
Status string which should be one of
SUCCESS
BAD CUSTOMER for an invalid customer
BAD ORDER DATE for an order date over months in the past or one month in the future
BAD PART NUMBER for an invalid part number from the list
BAD ORDER PRICE for an order price that is nt within of the PART.unitprice
BAD ORDER QTY for an order qty of NULL, less than or greater than
DO NOT include any COMMIT in your procedure you will only COMMIT what you submit
Write a function in your schema that can be used to calculate the unshipped portion of a product on an order using SHORDERS, SHINVOICE, SHORDERPROD and SHINVPROD tables
Return value of signals no more shipment of the product on the order
Return value of positive number contains maximum allowed ship qty
Return value of signals that the product is NOT on the order
Write a stored procedure in your schema that can be used to store a new invoice and its products in the SHINVOICE and SHINVPROD tables. Use the function created in step # to validate ship qtys
You must use IN and OUT parameters NOT DBMSOUTPUT.PUTLINE Hints
Input parameters include
Order number
Invoice date
List of
part numbers
ship qty
Output parameters include
Generated invoice no
Status string which should be one of
SUCCESS
BAD ORDER for nonexistant order number
BAD INVOICE DATE for an invoice date that precedes the order date or is one month beyond it
BAD PART NUMBER for a part number NOT on the order
BAD SHIP QTY for an ship qty of NULL or exceeds the unshipped portion of the part
DO NOT include any COMMIT in your procedure you will only COMMIT what you submit
Write a testing script that uses substitution parameters to perform the following:
Using substitution variables, execute the stored procedure from step # to create:
a failed order
a correct order with at least products
Execute Sshdisplayorder to display your newly created order
Using substitution variables. execute the stored procedure from step # to create:
a failed invoice
two invoices using the newly created order and partially shipped products
Execute Sshdisplayinvoice to display your newly created invoices
NOTE: At end of each practice execution, use the ROLLBACK; command until you are ready to submit. On your last execution, then use COMMIT; to save your order and invoices in the S tables.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started