'CONTINUE' keyword in Oracle 10g PL/SQL

后端 未结 9 2172
失恋的感觉
失恋的感觉 2020-12-14 06:00

I\'m migrating a TSQL stored procedure to PL/SQL and have encountered a problem - the lack of a CONTINUE keyword in Oracle 10g.

I\'ve read that Oracle 11g has this a

9条回答
  •  爱一瞬间的悲伤
    2020-12-14 06:47

    This isn't exactly an answer to the question, but nevertheless worth noting:

    The continue statement in PL/SQL and all other programming languages which use it the same way, can easily be misunderstood.

    It would have been much wiser, clearer and more concise if the programming language developers had called the keyword skip instead.

    For me, with a background of C, C++, Python, ... it has always been clear what `continue' means.

    But without that historical background, you might end intepreting this code

    for i in .. tab_xy.count loop
        CONTINUE WHEN some_condition(tab_xy(i));
        do_process(tab_xy(i));
    end loop;
    

    like this:

    Loop through the records of the table tab_xy.

    Continue if the record fulfills some_condition, otherwise ignore this record.

    Do_process the record.

    This interpretation is completely wrong, but if you imagine the PL/SQL code as a kind of cooking receipt and read it aloud, this can happen.

    In fact it happened to a very experienced development co-worker just yesterday.

提交回复
热议问题