The Reporting and Analysis Department has a database containingtables that hold summarized data to make report generation simplerand more efficient. They want to schedule some jobs to run nightlyto update summary tables. Create two procedures to update thefollowing tables (assuming that existing data in the tables isdeleted before these procedures run):
BB_PROD_SALES
BB_SHOP_SALES
▼ I got an answer to this question ▼
CREATE OR REPLACE PROCEDURE PROD_SALES_SUM_SP (productID INNUMBER, num_month IN CHAR,in_year IN CHAR,total_qty INNUMBER,prod_total IN NUMBER) ASprodCount number;BEGIN SELECT COUNT(*) INTO prodCount FROM BB_PROD_SALES WHERE idproduct = productID AND MONTH = num_month AND YEAR = in_year;IF prodCount = 0 THENINSERT INTO BB_PROD_SALES (idproduct, month, year, qty, total)VALUES (productID, num_month, in_year, total_qty,prod_total);DBMS_OUTPUT.PUT_LINE('Sales details inserted successfully');ELSEUPDATE BB_PROD_SALES SET qty = total_qty, total= prod_totalWHERE idproduct = productID AND MONTH = num_month AND YEAR =in_year;DBMS_OUTPUT.PUT_LINE('Sales details inserted successfully');END IF;END;
Can I just get screenshots of thisquestion?
COLUMN_NAME 1 IDPRODUCT 2 MONTH 3 YEAR 4 QTY 5 TOTAL DATA TYPE NUMBER (2,0) Yes CHAR (3 BYTE) Yes CHAR (4 BYTE) Yes NUMBER (5,0) Yes NUMBER (6,2) Yes NULLABLE DATA_DEFAULT (null) (null) (null) (null) (null) COLUMN_ID COMMENTS 1 (null) 2 (null) 3 (null) 4 (null) 5 (null)
COLUMN_NAME 1 IDSHOPPER 2 TOTAL DATA_TYPE NULLABLE DATA_DEFAULT NUMBER (4,0) Yes (null) NUMBER (6,2) Yes (null) COLUMN_ID COMMENTS 1 (null) 2 (null)
The Reporting and Analysis Department has a database containing tables that hold summarized data to make report generati
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am