Unanswered: How to replace the java logic in sql store proc?
I need a small help from you. May be big
I have a java code which they want to translate to Store Proc. Now the logic of the code is as below:
1. Make a Db connection and execute the query below, with theatre_id passed on from the java code.
2. Select * from theatre_list where unit_no = theatre_id;
3. Get the resultset (a list of records that match the criteria ) and using a while loop, iterate through the result set to check each and every row. If in any row, the field_theatre_main_phone is not populated, assign the value from field_theatre_guest_phone to it.
if (field_theatre_main_phone == null)
field_theatre_main_phone = field_theatre_guest_phone;
4. Do this validation and population till the end of resultset.
Issue is, they dont want to use cursors, and i dont get any idea on how to iterate through row by row, without a cursor. Could you please help me in this?
Believe me, I am new to informix and to advanced sql. I am only a Java fellow.
Sorry, just realised this is in the Informix forum and I don't know if Coalesce() is a valid function of this RDBMS...
If it's not then try
, CASE WHEN field_theatre_main_phone IS NULL THEN
END As phone_number
WHERE unit_no = theatre_id
Thanks for responding back immediately and apologize for the delay in replying. I am using your approach of Case When expression, and so far...good. If I run into any exception, will surely ping back. Thank you for your time n efforts.