|
Additionally,
If this call is to be made multiple times you'd be better off using
parameter markers.
c/exec sql
c+ declare c1 cursor for DynSqlStmt
c/end-exec
c eval sql = 'SELECT DISTINCT prpoid '+
c 'FROM pmppr WHERE prhreq = '+
c '?'
c ' and prco < '' 090'''
c/exec sql
c+ Prepare DynSqlStmt from :sql
c/end-exec
c eval julianChar = %editc(julian:'Z')
c/EXEC SQL OPEN C1 using julianChar
c/END-EXEC
c dow 1=1
c/EXEC SQL
c+ FETCH next from c1 INTO :po#
c/END-EXEC
Charles Wilt
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
> -----Original Message-----
> From: Dave Boettcher [mailto:DBoettch@xxxxxxxxxxxxxxxx]
> Sent: Tuesday, December 07, 2004 4:53 PM
> To: midrange-l@xxxxxxxxxxxx
> Subject: Re: embedded sql .. error check..
>
>
> The recommended value to check is now SQLSTT (SQL State)
> something like
> this
>
> C Select
> C When SQLStt = '00000'
>
> Good
> C Exsr ProcessRow
> C When SQLStt = '02000'
> C Exsr SQLNoRow
> C When %Subst(SQLStt : 1 : 2) = '01'
> C Exsr SQLWarning
> C Other
> C Exsr SQLError
> C Endsl
>
>
>
> hth
>
> Dave Boettcher
>
> >>> thatzenbeler@xxxxxxxxxxxxx 12/07/2004 3:37:41 PM >>>
> I'm attempting to write some embedded sql skeleton code, and I want to
> make
> sure I do it right...
>
> I was wondering, if I could have someone look at this, and make any
> suggestion, that would make the process better than what I have...
>
> >From what I read from the infocenter, there are a few sql
> variables to
> check
> to make sure there were no errors... But I was wondering if sqlcod
> was
> enough...
>
> Thanks, tim
>
>
>
> c/exec sql
>
> c+ declare c1 cursor for DynSqlStmt
>
> c/end-exec
>
>
>
> c eval sql = 'SELECT DISTINCT prpoid '+
>
> c 'FROM pmppr WHERE prhreq = '+
>
> c %editc(julian:'Z') +
>
> c ' and prco < '' 090'''
>
>
>
>
>
> c/exec sql
>
> c+ Prepare DynSqlStmt from :sql
>
> c/end-exec
>
>
>
> c/EXEC SQL OPEN C1
>
> c/END-EXEC
>
>
>
> c dow 1=1
>
> c/EXEC SQL
>
> c+ FETCH next from c1 INTO :po#
>
> c/END-EXEC
>
> c if sqlcod <> 0
>
> c leave
>
> c endif
>
>
> .... work with po# here....
>
>
> c enddo
>
>
> c/EXEC SQL
>
> c+ CLOSE C1
>
> c/END-EXEC
>
>
>
> This e-mail message, including any attachments, is for the sole use of
> the
> intended recipient(s) and may contain confidential or privileged
> information. Any unauthorized review, use, disclosure or distribution
> is
> prohibited. If you are not the intended recipient, please contact the
> sender by reply e-mail and destroy the message.
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
> list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
>
>
> --
> This is the Midrange Systems Technical Discussion
> (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-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.