diff --git a/PSO_12/PSO__Week_12.pdf b/PSO_12/PSO__Week_12.pdf new file mode 100644 index 0000000..748a66e Binary files /dev/null and b/PSO_12/PSO__Week_12.pdf differ diff --git a/PSO_12/answers.txt b/PSO_12/answers.txt new file mode 100644 index 0000000..e69de29 diff --git a/Project_2/answer.sql b/Project_2/answer.sql index cc6de06..7d29ffd 100755 --- a/Project_2/answer.sql +++ b/Project_2/answer.sql @@ -1,13 +1,33 @@ set serveroutput on size 32000 +-- show errors; -- Question 1: Retailer detail create or replace procedure RetailerDetail (id IN Retailers.RetailerId%TYPE) as - +retailer_id Retailers.RetailerId%TYPE; +retailer_name Retailers.RetailerName%TYPE; +retailer_address Retailers.Address%TYPE; +retailer_orders Orders.Count%TYPE; +retailer_bestseller_id Products.ProductId%TYPE; +retailer_bestseller Products.ProductName%TYPE; +retailer_bestseller_count Orders.Count%TYPE; +-- CURSOR retailer_cursor IS SELECT RetailerId FROM Retailers WHERE RetailerId=id; +-- retailer_entry retailer_cursor%ROWTYPE; +CURSOR order_cursor IS SELECT Count, OrderId FROM Orders WHERE RetailerId=id; +order_entry order_cursor%ROWTYPE; BEGIN - + SELECT RetailerName INTO retailer_name FROM Retailer WHERE RetailerId=id; + SELECT Address INTO retailer_address FROM Retailer WHERE RetailerId=id; + SELECT SUM(Count) INTO retailer_orders FROM Orders WHERE RetailerId=id; + SELECT INTO retailer_orders FROM Orders WHERE RetailerId=id; + + dbms_output.put_line('Retailer Name: ' || retailer_name); + dbms_output.put_line('Retailer Address: ' || retailer_address); + dbms_output.put_line('Retailer Total Orders: ' || retailer_orders); END RetailerDetail; / +show error procedure RetailerDetail; + -- make test cases yourselves BEGIN RetailerDetail(1); @@ -18,7 +38,7 @@ end; create or replace procedure MonthlyDelayReport as BEGIN - + END MonthlyDelayReport; / BEGIN @@ -30,7 +50,7 @@ End; create or replace procedure LeastProfitProduct as BEGIN - + END LeastProfitProduct; / @@ -44,7 +64,7 @@ create table RetailerCatergoryTable(RetailerId integer, Electronic integer, Appa create or replace procedure RetailerProductCatergory as BEGIN - + END RetailerProductCatergory; / @@ -61,9 +81,9 @@ drop table RetailerCatergoryTable; create or replace procedure CustomerProductInfo(cid IN Customers.CustomerId%TYPE, pid IN Products.ProductId%TYPE) as BEGIN - + EXCEPTION - + END CustomerProductInfo; / diff --git a/setup_instructions b/setup_instructions index 69e9ff6..939aed6 100644 --- a/setup_instructions +++ b/setup_instructions @@ -1,3 +1,4 @@ +source ~/.profile cd scripts sqlplus mocull@csora