create or replace package order_report is
  
  --parameter
  p_order_id number;

  --one reocord table
  cursor c_order(p_ord_id number) is
    select 
    ord.order_id order_id, 
    cus.cust_first_name || ' ' || cus.cust_last_name cust_name,
    cus.cust_street_address1 cust_street_address1,
    cus.cust_city cust_city,
    sta.state_name cust_state_name,
    cus.cust_postal_code cust_postal_code,
    to_char(ord.order_total) order_total, 
    to_char(ord.order_timestamp,'MM-DD-YYYY') order_date
  from demo_orders ord,
       demo_customers cus,
       demo_states sta
  where ord.order_id = p_ord_id
    and ord.customer_id = cus.customer_id 
    and cus.cust_state = sta.st;    

  --multi record table
  cursor c_order_items(p_ord_id number) is
   select 
    oit.order_item_id order_item_id, 
    oit.product_id product_id, 
    pro.product_name product_name,
    to_char(oit.quantity) quantity,
    to_char(oit.unit_price) unit_price, 
    to_char(oit.quantity * oit.unit_price) extended_price 
    from demo_order_items oit,
         demo_product_info pro
    where oit.order_id = p_ord_id
      and oit.product_id = pro.product_id
    ;

  -- Required procedure
  procedure genPDF;

  -- Required variable
  v_pdf blob;
end;