oracle8.1.6 select site_node.url(node_id) from site_nodes, apm_packages where object_id=package_id and package_key='[spam_package_key]' begin :1 := spam.new ( spam_id => :spam_id, send_date => to_date(:send_date, 'yyyy-mm-dd hh:mi:ss AM'), title => :subject, sql_query => :sql, html_text => :html, plain_text => :plain, creation_user => [ad_get_user_id], creation_ip => '[ad_conn peeraddr]', context_id => :context_id, approved_p => :approved_p ); end; begin :1 := acs_mail_queue_message.new ( body_id => :body_id, context_id => :context_id, creation_date => :creation_date, creation_user => :creation_user, creation_ip => :creation_ip ); end; select spam_id from spam_messages where sysdate >= send_date and approved_p = 't' and sent_p = 'f'