|
You know, as I look at this... I don't think you need the BEGIN & END. Not sure why I always thought they were needed. Maybe my Pascal experience <grin>? But the OP was missing the required THEN. IF Field1 = 2 THEN Statement1; Statement2; Statement3; Endif; IF Field1 = 3 THEN Statement4; Statement5; Statement6; Endif; Note that unlike RPGLE, the SQL IF doesn't have a semicolon on the if line. (Well technically it does as SQL sees the code like so:) IF Field1 = 2 THEN Statement1; Statement2; Statement3; Endif; Hope I didn't confuse anybody. Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121 > -----Original Message----- > From: rpg400-l-bounces@xxxxxxxxxxxx > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Wilt, Charles > Sent: Tuesday, December 20, 2005 3:56 PM > To: RPG programming on the AS400 / iSeries > Subject: RE: SQL Stored Procedure > > Opps, > > It would be better if I posted it correctly, you don't put a semicolon > after the begin > IF Field1 = 2 THEN > BEGIN > Statement1; > Statement2; > Statement3; > END; > Endif; > > IF Field1 = 3 THEN > BEGIN > Statement4; > Statement5; > Statement6; > END; > Endif; > > Charles Wilt > -- > iSeries Systems Administrator / Developer > Mitsubishi Electric Automotive America > ph: 513-573-4343 > fax: 513-398-1121 > > > > -----Original Message----- > > From: rpg400-l-bounces@xxxxxxxxxxxx > > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Wilt, Charles > > Sent: Tuesday, December 20, 2005 3:50 PM > > To: RPG programming on the AS400 / iSeries > > Subject: RE: SQL Stored Procedure > > > > Good catch Rob, > > > > I was thinking the OP was doing an external stored > procedure in RPGLE. > > Primarily because I always forget SQL has an IF statement. <grin> > > > > If the original poster is really using SQL, then he needs: > > > > IF Field1 = 2 THEN > > BEGIN; > > Statement1; > > Statement2; > > Statement3; > > END; > > Endif; > > > > IF Field1 = 3 THEN > > BEGIN; > > Statement4; > > Statement5; > > Statement6; > > END; > > Endif; > > > > But Rob's also correct, a question about stored procedures > written in > > SQL should be in MIDRANGE-L not RPG-L > > > > > > > > Charles Wilt > > -- > > iSeries Systems Administrator / Developer > > Mitsubishi Electric Automotive America > > ph: 513-573-4343 > > fax: 513-398-1121 > > > > > > > -----Original Message----- > > > From: rpg400-l-bounces@xxxxxxxxxxxx > > > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx > > > Sent: Tuesday, December 20, 2005 3:15 PM > > > To: RPG programming on the AS400 / iSeries > > > Subject: Re: SQL Stored Procedure > > > > > > I'm slightly confused, since this is the RPG list are you > > > taking a rpg > > > program and doing the create procedure on that or is the > > > whole procedure > > > in one big CREATE PROCEDURE statement with no RPG involved? > > > The reason I > > > am asking is not to play list cop. It's because the IF > > > constructs are > > > different. > > > > > > Rob Berendt > > > -- > > > Group Dekko Services, LLC > > > Dept 01.073 > > > PO Box 2000 > > > Dock 108 > > > 6928N 400E > > > Kendallville, IN 46755 > > > http://www.dekko.com > > > > -- > > This is the RPG programming on the AS400 / iSeries (RPG400-L) > > mailing list > > To post a message email: RPG400-L@xxxxxxxxxxxx > > To subscribe, unsubscribe, or change list options, > > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > > or email: RPG400-L-request@xxxxxxxxxxxx > > Before posting, please take a moment to review the archives > > at http://archive.midrange.com/rpg400-l. > > > > > > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) > mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.