oracle8.1.6 declare begin ec_reinst_gift_cert_on_order (:order_id); end; select ec_order_cost(:order_id) from dual update ec_financial_transactions set authorized_date=sysdate where transaction_id=:transaction_id select ec_order_cost(:order_id) from dual select ec_transaction_id_sequence.nextval 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 gift_certificate_id from ec_gift_certificates_approved where user_id=:user_id and sysdate - expires < 0 and amount_remaining_p = 't' order by expires select ec_gift_certificate_balance(:user_id) from dual select ec_order_amount_owed(:order_id) from dual select gift_certificate_amount_left(:gift_certificate_id) from dual insert into ec_gift_certificate_usage (gift_certificate_id, order_id, amount_used, used_date) VALUES (:gift_certificate_id, :order_id, least(to_number(:gift_certificate_amount_left), to_number(:amount_owed)), sysdate) select ec_gift_certificate_balance(:user_id) from dual select ec_order_amount_owed(:order_id) from dual