select case when email_bouncing_p = 't' then 1 else 0 end as send_p from users, parties where lower(email) = lower(:email) and party_id = user_id select case when email_bouncing_p = 't' then 1 else 0 end as send_p from users where user_id = :user_id delete from acs_mail_lite_bounce where party_id in (select party_id from acs_mail_lite_mail_log where last_mail_date < sysdate - :max_days_to_bounce) update users set email_bouncing_p = 't' where user_id in (select party_id from acs_mail_lite_bounce where bounce_count >= :max_bounce_count) delete from acs_mail_lite_bounce where bounce_count >= :max_bounce_count update acs_mail_lite_bounce set bounce_count = bounce_count + 1 where party_id = :user_id insert into acs_mail_lite_bounce (party_id, bounce_count) values (:user_id, 1)