I have a cursor with 5 'OR' statements in the where clause. I am looking for 5 different data values. But I need to know that I am going to receive one specific one first. Say if field 5 of the 'OR' statements is the one I know I need first before I can evaluate any of the other ones. Or if field five does not exist I don't want to post process anything in that specific record return. The cursor is below. It works fine. All field names returned are part of one message. The message is id'd by the p_msg_id. I just want to know that if I need on of the five fields first, how would I go about arranging my cursor? I hope this makes sense.
CURSOR crs_Get_field_data(p_ses_id NUMBER, p_msg_id NUMBER,p_umi NUMBER,fp1 NUMBER,fp2 NUMBER,fp3 NUMBER,fp4 NUMBER,fp5 NUMBER) IS
SELECT vmd.field_name, vmd.field_data ,vmd.recorded_time ,vmd.unique_msg_id, vmd.position
FROM vw_message_data vmd
WHERE (vmd.position = fp1 OR vmd.position = fp2 OR vmd.position = fp3 OR vmd.position = fp4 OR vmd.position = fp5) AND vmd.unique_msg_id = p_umi AND vmd.msg_id = p_msg_id AND vmd.ses_id = p_ses_id
ORDER BY vmd.recorded_time,vmd.unique_msg_id,vmd.position
CURSOR crs_Get_field_data(p_ses_id NUMBER, p_msg_id NUMBER,p_umi NUMBER,fp1 NUMBER,fp2 NUMBER,fp3 NUMBER,fp4 NUMBER,fp5 NUMBER) IS
SELECT vmd.field_name, vmd.field_data ,vmd.recorded_time ,vmd.unique_msg_id, vmd.position
FROM vw_message_data vmd
WHERE (vmd.position = fp1 OR vmd.position = fp2 OR vmd.position = fp3 OR vmd.position = fp4 OR vmd.position = fp5) AND vmd.unique_msg_id = p_umi AND vmd.msg_id = p_msg_id AND vmd.ses_id = p_ses_id
ORDER BY vmd.recorded_time,vmd.unique_msg_id,vmd.position