select 1 from survey_sections where section_id = :section_id
select question_id, question_text, abstract_data_type,
presentation_type, required_p, predefined_question_id
from survey_questions
where section_id = :section_id
and active_p = 't'
order by sort_order
select attachment_answer
from survey_question_responses where question_id=:question_id and response_id=:response_id and attachment_answer is not null
select count(*) from survey_responses
where response_id=:response_id
delete from survey_question_responses where question_id in
(select question_id from survey_questions where
section_id=:section_id)
and response_id=:response_id and attachment_answer is null
select action_type, tcl, table_name, column_name, key_name
from survey_predefined_questions
where predefined_question_id=:predefined_question_id
insert into survey_question_responses (response_id, question_id, choice_id)
values (:response_id, :question_id, :response_value)
insert into survey_question_responses (response_id, question_id, choice_id)
values (:response_id, :question_id, :response_value)
insert into survey_question_responses (response_id, question_id, varchar_answer)
values (:response_id, :question_id, :response_value)
insert into survey_question_responses (response_id, question_id, boolean_answer)
values (:response_id, :question_id, :response_value)
insert into survey_question_responses (response_id, question_id, number_answer)
values (:response_id, :question_id, :response_value)
insert into survey_question_responses (response_id, question_id, date_answer)
values (:response_id, :question_id, :response_value)
select item_id as old_item from cr_revisions where revision_id=:old_revision_id
update survey_question_responses
set attachment_answer=:revision_id,
attachment_file_name=:filename, attachment_file_type=:mime_type,
attachment_file_extension=:file_extension
where question_id=:question_id and response_id=:response_id
update cr_items
set name=:unique_name
where item_id=:old_item
insert into survey_question_responses
(response_id, question_id, attachment_answer,attachment_file_name,attachment_file_type,attachment_file_extension)
values
(:response_id, :question_id, :revision_id,:filename,:mime_type,:file_extension)
update survey_responses set finished_p='t' where
survey_id=:survey_id and response_id=:response_id
select type from survey_sections where section_id = :section_id
select name from survey_sections where section_id = :section_id