oracle 8.1.6 declare begin ec_reinst_gift_cert_on_order (:order_id); end; select ec_order_cost(:order_id) from dual update ec_orders set order_state='authorized', authorized_date=sysdate where order_id=:order_id update ec_financial_transactions set authorized_date=sysdate where transaction_id=:transaction_id update ec_orders set order_state='confirmed', confirmed_date=sysdate where order_id=:order_id select ec_order_cost(:order_id) from dual insert into ec_financial_transactions (transaction_id, order_id, transaction_amount, transaction_type, inserted_date) values (:transaction_id, :order_id, :total_amount, 'charge', sysdate) select ec_order_amount_owed(:order_id) from dual select gift_certificate_id, gift_certificate_amount_left(gift_certificate_id) as amount_available from ec_gift_certificates_approved where user_id = :user_id and sysdate - expires < 0 and amount_remaining_p = 't' and gift_certificate_amount_left(gift_certificate_id) > 0 order by expires insert into ec_gift_certificate_usage (gift_certificate_id, order_id, amount_used, used_date) values (:gift_certificate_id, :order_id, least(to_number(:amount_available), to_number(:amount_owed)), sysdate) select item_id from ec_items i, ec_products p where i.order_id = :order_id and i.product_id = p.product_id and p.no_shipping_avail_p = 't' and rownum=1 update ec_items set item_state = 'to_be_shipped' where ec_items.order_id = :order_id and exists (select product_id from ec_products p where ec_items.product_id=p.product_id and p.no_shipping_avail_p = 'f') update ec_items set item_state = 'shipped', shipment_id = :shipment_id where ec_items.order_id = :order_id and exists (select product_id from ec_products p where ec_items.product_id=p.product_id and p.no_shipping_avail_p = 't')