79 lines
1.2 KiB
SQL
Executable File
79 lines
1.2 KiB
SQL
Executable File
set serveroutput on size 32000
|
|
|
|
-- Question 1: Retailer detail
|
|
create or replace procedure RetailerDetail (id IN Retailers.RetailerId%TYPE) as
|
|
|
|
BEGIN
|
|
|
|
END RetailerDetail;
|
|
/
|
|
|
|
-- make test cases yourselves
|
|
BEGIN
|
|
RetailerDetail(1);
|
|
end;
|
|
/
|
|
|
|
-- Queation 2: Monthly delay report
|
|
create or replace procedure MonthlyDelayReport as
|
|
|
|
BEGIN
|
|
|
|
END MonthlyDelayReport;
|
|
/
|
|
BEGIN
|
|
MonthlyDelayReport;
|
|
End;
|
|
/
|
|
|
|
-- Question 3: Find the product with least profit in each category
|
|
create or replace procedure LeastProfitProduct as
|
|
|
|
BEGIN
|
|
|
|
END LeastProfitProduct;
|
|
/
|
|
|
|
BEGIN
|
|
LeastProfitProduct;
|
|
END;
|
|
/
|
|
|
|
-- Queation 4: New table for retailer product category distribution
|
|
create table RetailerCatergoryTable(RetailerId integer, Electronic integer, Apparel integer, Books integer, primary key(RetailerId));
|
|
create or replace procedure RetailerProductCatergory as
|
|
|
|
BEGIN
|
|
|
|
END RetailerProductCatergory;
|
|
/
|
|
|
|
BEGIN
|
|
RetailerProductCatergory;
|
|
END;
|
|
/
|
|
select * from RetailerCatergoryTable;
|
|
|
|
drop table RetailerCatergoryTable;
|
|
|
|
|
|
-- Question 5: Exception Handle
|
|
create or replace procedure CustomerProductInfo(cid IN Customers.CustomerId%TYPE, pid IN Products.ProductId%TYPE) as
|
|
|
|
BEGIN
|
|
|
|
EXCEPTION
|
|
|
|
END CustomerProductInfo;
|
|
/
|
|
|
|
BEGIN
|
|
CustomerProductInfo(1,1);
|
|
END;
|
|
/
|
|
|
|
BEGIN
|
|
CustomerProductInfo(-1,1);
|
|
END;
|
|
/
|