Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a stored procedure that can be used to find the number of cars and total amount a customer has spent on all cars they

  • Write a stored procedure that can be used to find the number of cars and total amount a customer has spent on all cars they have bought.
  • Write an anonymous block that prompts the user to enter a city and uses the procedure created to display the number of cars and the total amount spent on cars from all the customers from that city. Store all the customers from the city with a collection/cursor and loop through and call the procedure within to display the number of cars and the money spent by the customers.
  • Create a trigger for car table that will reject inserting or updating values for carlistprice that are either negative or larger than 250000.
  • Write a script with three commands:

- INSERT: inserting a new record in car table. You will have to deal with referential integrity constraints caused by purchinvno, custname etc. Insert values for all columns in the car table and make sure that the value for carlistprice is between 1 and 249999.99.

-UPDATE: update the carlistprice to a value that is either negative or greater than 250000.

-COMMIT: Execute the script and show the response from the server.

image text in transcribed

CAR CUSTOMER custame VARCHAR220) custstreet VARCHAR2(20) NOT NULL custcity VARCHAR2(20) NOT NULL custprovince CHAR(2) NOT NULL DEFAULT ON custpostal CHAR(7) NOT NULL custhphone CHAR(13) NOT NULL thhone CHAR13) NOT NULL career CHARIS NOV custame VARCHAR2(20) SALEINV SeleinmoCHAR(6) saledate DATE NOT NULL salesman VARCHAR2(20) NOT NULL Custame VARCHAR2(20) NOT NULL carserial CHAR NOT NULL insfire CHAR(1) inscollision CHAR(1) insliability CHAR(1) insproperty CHAR(1) tax rate NUMBER(4.2) DEFAULT 13.0 licfee NUMBER(62) discount NUMBER 82) commission NUMBER(8.2) Carsalepnice NUMBER/92) carmake VARCHAR2(10) NOT NULL carmodel VARCHAR2(10) NOT NULL caryear CHAR(4) NOT NULL extcolour VARCHAR2(12) NOT NULL cartrim VARCHAR2(16) NOT NULL enginetype VARCHAR2(10) NOT NULL enginetype VARCHAR2(10) NOT NULL purchinno CHAR(6) purchcost NUMBER(92) freightcost NUMBER(92) car istorice NUMBER19.2) NOT NULL NOT NULL SERVINV servinne CHAR15) servdate DATE NOT NULL cusmame VARCHAR2/20) NOT NULL carserial CHAR( NOT NULL parts.cos NUMBER(72) laborcost NUMBER (72) tarate NUMBER(4.2) DEFAULT 13.0 CAR CUSTOMER custame VARCHAR220) custstreet VARCHAR2(20) NOT NULL custcity VARCHAR2(20) NOT NULL custprovince CHAR(2) NOT NULL DEFAULT ON custpostal CHAR(7) NOT NULL custhphone CHAR(13) NOT NULL thhone CHAR13) NOT NULL career CHARIS NOV custame VARCHAR2(20) SALEINV SeleinmoCHAR(6) saledate DATE NOT NULL salesman VARCHAR2(20) NOT NULL Custame VARCHAR2(20) NOT NULL carserial CHAR NOT NULL insfire CHAR(1) inscollision CHAR(1) insliability CHAR(1) insproperty CHAR(1) tax rate NUMBER(4.2) DEFAULT 13.0 licfee NUMBER(62) discount NUMBER 82) commission NUMBER(8.2) Carsalepnice NUMBER/92) carmake VARCHAR2(10) NOT NULL carmodel VARCHAR2(10) NOT NULL caryear CHAR(4) NOT NULL extcolour VARCHAR2(12) NOT NULL cartrim VARCHAR2(16) NOT NULL enginetype VARCHAR2(10) NOT NULL enginetype VARCHAR2(10) NOT NULL purchinno CHAR(6) purchcost NUMBER(92) freightcost NUMBER(92) car istorice NUMBER19.2) NOT NULL NOT NULL SERVINV servinne CHAR15) servdate DATE NOT NULL cusmame VARCHAR2/20) NOT NULL carserial CHAR( NOT NULL parts.cos NUMBER(72) laborcost NUMBER (72) tarate NUMBER(4.2) DEFAULT 13.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions