select count(*) as number_of_responses, max(response_id) as max_response_id from survey_responses, acs_objects where survey_id=:survey_id and creation_user=:user_id and object_id=response_id and initial_response_id is null select 1 from surveys where survey_id = :survey_id update survey_responses set finished_p='t' where response_id=:response_id select question_id from survey_questions where section_id = :section_id and active_p = 't' order by sort_order select section_id from survey_sections where survey_id=:survey_id select section_id from survey_sections where survey_id=:survey_id and rownum=1 order by sort_key select question_text, presentation_type, abstract_data_type, question_id, required_p from survey_questions where section_id=:section_id and active_p='t' order by sort_order select 'survey/'||template_file as style from survey_templates t, surveys s where s.survey_id=:survey_id and s.template=t.template_id