postgresql7.1
select ec_order_cost(:order_id) as total_amount,
creditcard_id,
case when extract(day from current_timestamp - confirmed_date) > 1 then 0 when extract(hour from current_timestamp - confirmed_date)/24 < 0.95 then 1 else 0 end as youth
from ec_orders
where order_id = :order_id
select transaction_amount as total_amount,
creditcard_id,
case when extract(day from current_timestamp - inserted_date) > 1 then 0 when extract(hour from current_timestamp-inserted_date)/24 < 0.95 then 1 else 0 end as youth
from ec_financial_transactions
where transaction_id = :transaction_id
insert into ec_cybercash_log ([join [ad_ns_set_keys -exclude "cc_time" $bind_vars] ", "], cc_time, txn_attempted_time)
values ([join [ad_ns_set_keys -exclude "cc_time" -colon $bind_vars] ", "], to_date(:cc_time, 'YYYYMMDDHH24MISS'), current_timestamp)
select to_char(:n_hours_to_add / 24 + to_date(:the_date, 'YYYY-MM-DD HH24:MI:SS'), 'YYYYMMDDHH24MISS')