Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> PLSQL breaks Re: what is the SQL equivalent of 'continue' and 'break' in C ?

PLSQL breaks Re: what is the SQL equivalent of 'continue' and 'break' in C ?

From: Ed Prochak <edprochak_at_gmail.com>
Date: 10 Aug 2006 12:06:39 -0700
Message-ID: <1155236799.488703.96740@h48g2000cwc.googlegroups.com>

happyardy_at_gmail.com wrote:
[]
> Daniel,
> I try to stay away from GOTO. GOTOs are not evils and are helpful
> sometimes but still I dont like to use them. I avoid them as much as
> possible.
> I was trying to find out if SQL has any keyword that is equivalent of
> 'continue' in C. C has GOTO too and I have always wanted to avoid that.
> thanks
> - Ardy

you keep asking about SQL, but discussing procedural programming.

keep in mind
SQL is a NON-procedural language. break and continue make no sense in a language without loop constructs.

PL/SQL is a procedural language that include SQL statements. Rather than using a C programming mentality, learn to program in PL/SQL (It's very similar to ADA). PL/SQL uses the EXCEPTION model to provide structured programming. It is actually very nice. Learn that model rather than thinking in C and trying to emulate CONTINUE commands. Also you might avoid the continue simply by reversing the result of your if condition.

in C where you have

if ( condition) continue;
  other statements to skip when condition is true

consider using

if (! condition )
{ other statements to skip when condition is true }

no need for the continue.

Trust me. While C and PL/SQL are both procedural languages, they do have different programming models. You will be best served by learning PL/SQL model as if it is unrelated to C.

HTH,
  ed Received on Thu Aug 10 2006 - 14:06:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US