postgresql7.1 select survey_question__new ( :question_id, :section_id, :sort_order, :question_text, :abstract_data_type, :required_p, :active_p, :presentation_type, :presentation_options, :presentation_alignment, :user_id, :section_id ) select nextval as choice_id from survey_choice_id_sequence select case when count(*) = 0 then 0 else 1 end from survey_questions where question_id = :question_id