Question: create a pl/sql block to determine the shipping costs of an order based on the number of items ordered and nls_territory of the customer. the







create a pl/sql block to determine the shipping costs of an order based on the number of items ordered and nls_territory of the customer. the rates applicable are shown in the table below for territories other than america, to which a flat rate of 250 is applied. test the block using order_id's 2458 and 2397; your output should resemble the screen capture shown below.

+ MESSAGES 10 MOVIE + 0 ORDER_ITEMS 0 ORDERS 1 ORDER_ID I ORDER_DATE 1 ORDER_MODE - 1 CUSTOMER_ID ORDER_STATUS ORDER_TOTAL 1 SALES_REP_ID 1 PROMOTION_ID PRODUCT_INFORMATION 1 PRODUCT_ID " PRODUCT_NAME + + + LULATIONS MESSAGES MOVIE 0 ORDER_ITEMS 1 ORDER_ID " LINE_ITEM_ID - PRODUCT_ID UNIT_PRICE QUANTITY 0 ORDERS LMP + 0 EMPLOYEE 1 + 0 EMPLOYEES 6-0 INVENTORIES - PRODUCT_ID I WAREHOUSE_ID QUANTITY_ON_HAND - JOB_HISTORY - JOBS + LOCATIONS # MESSAGES # MOVIE # E ORDER_ITEMS + 0 ORDERS DE PRODUCT_INFORMATION 0 PRODUCT_ID PRODUCT_NAME PRODUCT_DESCRIPTION I CATEGORY_ID - WEIGHT_CLASS I WARRANTY PERIOD 1 SUPPLIER_ID PRODUCT_STATUS 1 LIST_PRICE MIN_PRICE " CATALOG_URL REGIONS RENTALS # TEMP REGIONS 1 REGION_ID - REGION_NAME + RENTALS # E TEMP #-0 WAREHOUSES + # RENTALS TEMP WAREHOUSES I WAREHOUSE_ID 1 WAREHOUSE_NAME LOCATION_ID L 60 CUSTOMERS CUSTOMER_ID CUST_FIRST_NAME II CUST_LAST_NAME 1 CUST_ADDRESS 10 PHONE_NUMBERS NLS_LANGUAGE CUST NLS_TERRITORY CREDIT_LIMIT 1 CUST_EMAIL L ACCOUNT_MGR_ID 100 l work add the Check constraint Order items table as follows: NOWIT in screen capture below ALTER TABLE order_items ADD CONSTRAINT items aty ck CHECK (quantity 200 >100 >50 SHIP COST 1000 750 500 Script Oubut Task completin 6.555 seconds SLS TERRITORY IS: NERICA ORDER QUANTITY ES752 SHIPMENT PRICE :S: 250 Tee n 0.537 SLS_TERRITORY 15: ITALY ORDER QUANTITY : 42 SEMENT PRICE IS: 500 PL/SQL procedure successfully completed. PL/SQL procedure successfully completed. Page 3 of 3 To08 asnoyajem inventoy customer - order order_item product_information + MESSAGES 10 MOVIE + 0 ORDER_ITEMS 0 ORDERS 1 ORDER_ID I ORDER_DATE 1 ORDER_MODE - 1 CUSTOMER_ID ORDER_STATUS ORDER_TOTAL 1 SALES_REP_ID 1 PROMOTION_ID PRODUCT_INFORMATION 1 PRODUCT_ID " PRODUCT_NAME + + + LULATIONS MESSAGES MOVIE 0 ORDER_ITEMS 1 ORDER_ID " LINE_ITEM_ID - PRODUCT_ID UNIT_PRICE QUANTITY 0 ORDERS LMP + 0 EMPLOYEE 1 + 0 EMPLOYEES 6-0 INVENTORIES - PRODUCT_ID I WAREHOUSE_ID QUANTITY_ON_HAND - JOB_HISTORY - JOBS + LOCATIONS # MESSAGES # MOVIE # E ORDER_ITEMS + 0 ORDERS DE PRODUCT_INFORMATION 0 PRODUCT_ID PRODUCT_NAME PRODUCT_DESCRIPTION I CATEGORY_ID - WEIGHT_CLASS I WARRANTY PERIOD 1 SUPPLIER_ID PRODUCT_STATUS 1 LIST_PRICE MIN_PRICE " CATALOG_URL REGIONS RENTALS # TEMP REGIONS 1 REGION_ID - REGION_NAME + RENTALS # E TEMP #-0 WAREHOUSES + # RENTALS TEMP WAREHOUSES I WAREHOUSE_ID 1 WAREHOUSE_NAME LOCATION_ID L 60 CUSTOMERS CUSTOMER_ID CUST_FIRST_NAME II CUST_LAST_NAME 1 CUST_ADDRESS 10 PHONE_NUMBERS NLS_LANGUAGE CUST NLS_TERRITORY CREDIT_LIMIT 1 CUST_EMAIL L ACCOUNT_MGR_ID 100 l work add the Check constraint Order items table as follows: NOWIT in screen capture below ALTER TABLE order_items ADD CONSTRAINT items aty ck CHECK (quantity 200 >100 >50 SHIP COST 1000 750 500 Script Oubut Task completin 6.555 seconds SLS TERRITORY IS: NERICA ORDER QUANTITY ES752 SHIPMENT PRICE :S: 250 Tee n 0.537 SLS_TERRITORY 15: ITALY ORDER QUANTITY : 42 SEMENT PRICE IS: 500 PL/SQL procedure successfully completed. PL/SQL procedure successfully completed. Page 3 of 3 To08 asnoyajem inventoy customer - order order_item product_information
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
