Calculate days between ordering and shipping

Assignment Help PL-SQL Programming
Reference no: EM13201641

Question 1. Calculate the Tax on an Order

Complete the following steps to create a procedure to calculate the tax on an order. The BB_TAX table contains the states that require taxes to be submitted for Internet sales. If the state is not listed in the table, then no tax should be accessed on any order. The shopper's state and basket subtotal are the inputs into the procedure while the tax amount should be returned.

  1. Create a procedure called TAX_COST_SP to accomplish the tax calculation task. Keep in mind that the state and subtotal values are inputs into the procedure and the procedure is to return the tax amount. Review the contents of the BB_TAX table, which contains the tax rate for each state that needs to be taxed.
  2. Create a host variable named G_TAX to hold the value returned by the procedure.
  3. Invoke the procedure using the values of "VA" for the state and $100 for the subtotal.
  4. Display the tax amount returned by the procedure (it should be $4.5).

Question 2. Update the Status of an Order

Create a procedure named STATUS_SHIP_SP that allows a company to employee in the Shipping Department to update the status of an order to add shipping information. The BB_BASKETSTATUS table maintains a list of events for each order so that a shopper can see the current status, date, and comments as each stage of the order process is completed. The IDSTAGE column of the BB_BASKETSTATUS table identifies each stage and an IDSTAGE of 3 indicates the order has been shipped.

The procedure should allow the addition of a row indicating an IDSTAGE of 3, date shipped, tracking number, and shipper. The sequence BB_STATUS_SEQ is used to provide a value for the primary key column. Test the procedure with the following information:

            Basket # = 3

            Date Shipped = 20-FEB-03

            Shipper = UPS

            Tracking # = ZW2384YXK4957

Question 3. Identify Customers

The company wants to offer an incentive of free shipping to those customers who have not returned for two months. Create a procedure named PROMO_SHIP_SP that determines who these customers are and then updates the BB_PROMOLIST table accordingly. The procedure uses the following information:

  1. Date cutoff = Any customers who have not shopped on the site since this date should be included as incentive participants. Use the basket creation date to reflect shopper activity dates.
  2. Month = Three-character month (such as APR) that should be added to the promotion table to indicate which month the free shipping is available.
  3. Year = Four-digit year indicating the year the promotion is effective.
  4. PROMO_FLAG = 1 (representing free shipping).

The BB_PROMOLIST table also has a USED column, which contains a default value of "N" and is updated to a "Y" when the shopper uses the promotion. Test the procedure with a cutoff date of 15-FEB-03. Assign the free shipping for the month of APR and the year 2003.

Question 4. Calculate the Total Shopper Spending

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that accepts a shopper id as input and returns the total dollars that the shopper has spent with the company.  Use the function in a SELECT statement that shows the shopper id and total purchases for every shopper in a database.

  1. Develop and run a CREATE FUNCTION statement to create the TOT_PURCH_SF function. The function code needs a formal parameter for the shopper id and to sum the total column from the BB_BASKET table.
  2. Develop a SELECT statement using the BB_SHOPPER table to produce a list of each shopper in the database and his or her respective totals.

Question 5. Calculate Days Between  Ordering and Shipping

An analyst in the quality assurance office reviews the time lapse between receiving an order and shipping an order. Any orders that have not been shipped within a day of the order being placed are investigated. Create a function named ORD_SHIP_SF that calculates the number of days between the date the basket was created and the shipping date. The function should return a character string that indicates "OK" if the order was shipped within a day or "CHECK" if it was not. The IDSTAGE column of the BB_BASKETSTATUS table indicates the item is shipped with a value of 5 and the DTSTAGE column is the shipping date. The TDORDERED column of the BB_BASKET table is the order date. Use the function in an anonymous block that uses a host variable to receive the basket id to check basket 3.

Question 6. Perform Exception Handling with User-Defined Errors

On occasion, some of Brewbean's customers mistakenly leave an item out of a basket already checked out, so they create a new basket containing the missing items. However, they request that the baskets be combined so that they are not charged extra shipping.  A screen has been developed to allow an employee to modify the basket id of items in the BB_BASKETITEM table to another to another existing basket to combine the baskets. A block has been constructed to support this screen and can be found at the end of this question. However, an exception needs to be added to trap the situation in which an invalid basket id is entered for the original basket. In this case, the UPDATE affects no rows but does not raise an Oracle error. The handler should display a message stating "invalid original basket id". Use a host variable named G_OLD with a value of 30 and a host variable named G_NEW with a value of 4 to provide the values to the block. First verify that no item rows exist in the BB_BASKETITEM table with a basket id of 30.

BEGIN

  UPDATE bb_basketitem

   SET idBasket = :g_new

   WHERE idBasket = :g_old;

END;

/

695_CPD3454 AssignmentDatabaseSchema.jpg

Download:- Assignment.rar

Reference no: EM13201641

Questions Cloud

What types of depository institutions are found in the us : (Depository Institutions) What is a depository institution, and what types of depository institutions are found in the United States How do they act as intermediaries between savers and borrowers Why do they play this role
What is the probability that an auto dealer need to order : The Friendly Auto Mart sold seven of these trucks and has two of the new transmissions in stock. What is the probability that the auto dealer will need to order more new transmissions?
Find the standard deviation of the sample : Suppose that the sample is enlarged to 14 measurements, by including two additional measurements having a common value of 27 each. Find the standard deviation of the sample of 14 measurements.
What problems would you expect if the country were to employ : The functional finance approach to budget deficits would set the federal budget to promote an economy operating at potential output. What problems would you expect if the country were to employ this kind of budgetary philosophy
Calculate days between ordering and shipping : Calculate the Tax on an Order, Calculate the Total Shopper Spending - Develop a SELECT statement using the BB_SHOPPER table to produce a list of each shopper in the database and his or her respective totals.
What are the lot dimensions : The total cost of the fencing along three sides comes to $2130. What are the lot's dimensions?
Use the normal approximation to the binomial : A certain flight arrives on time 66 percent of the time. Suppose 106 flights are randomly selected. Use the normal approximation to the binomial to approximate the probability that exactly 75 flights are on time.
What is the effect of an increase in fixed costs : Jones Company operates within a monopolistically competitive industry. The estimated demand for its products is given by the following inverse demand function P = 1760 - 12Q It finance department has estimated its total cost function.
How many of each kind of car are there : There are 24 cars in the theater parking lot. there are 3 times as many 4-door as 2-door cars. how many of each kind of car are there?

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Write down sql needed to create employee table

Write down SQL needed to create employee table containing the following data: employeeID, text, length of 5, primary key lastName, text, length of 25

  Add three rows to the downloads

Add three rows to the Downloads table: one row for user 1 and product 2; one for user 2 and product 1; and one for user 2 and product 2. Use the GETDATE function to insert the current date and time into the DownloadDate column.

  Script that creates and calls a stored

Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table. This stored procedure should accept five parameters

  Sql script-creating the database and inserting data

Understanding the SQL script, creating the database and inserting data and display all product information for products that contain the string ‘saw' in their description.

  Statement to display the sku, sku_description

write an sql statement to display the SKU, SKU_Description, WareHouse ID, and QuantityOnHand for all products having a QuantityOnOrder equal to 0. Sort the results in descending order by WareHouse ID and in ascending order by SKU

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

  Write a script that uses two variables

Write a script that uses two variables to store (1) the count of all of the products in the Products table and (2) the average list price for those products. If the product count is greater than or equal to

  Write sql create table statement to create pet table

Write an SQL CREATE TABLE statement to create the PET table without referential integrity constraint on OwnerID in PET.

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql block which displays last name

Write PL/SQL block which displays last name and salary of following people. Each of these can be done separately as PL/SQL, first to test and get output lines

  Create program to enter first and second number

Create a program that enters first and a second number. The first and second number that will be entered should be computed in halves, quarter, double, and square.

  Create a pl-sql block using the hr schema

Create a PL/SQL block to achieve the following using the HR schema and select the name, salary, and department of the employee with the maximum salary.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd