oracle8.1.6 select decode(count(*),0,0,1) from survey_questions where question_id = :question_id declare v integer; begin v := survey_question.new ( question_id => :question_id, section_id => :section_id, sort_order => :sort_order, question_text => empty_clob(), abstract_data_type => :abstract_data_type, presentation_type => :presentation_type, presentation_alignment => :presentation_alignment, presentation_options => :presentation_options, active_p => :active_p, required_p => :required_p, context_id => :section_id, creation_user => :user_id, question_html_p => :question_html_p, summary_type => :summary_type, answer_description => :answer_description, predefined_question_id => :predefined_question_id ); end; select question_id from survey_questions where question_id = :question_id for update of question_text insert into survey_question_choices(choice_id,predef_choice_id,question_id,label,numeric_value,sort_order,presentation_alignment,more_info_type) (select survey_choice_id_sequence.nextval,choice_id,:question_id,label,numeric_value,sort_order,presentation_alignment,more_info_type from survey_predef_question_choices where question_id=:predefined_question_id)