I am also looking for a SQL equivalent to CHAIN or SETLL.

This is what I am using now, is there a better way. :)

C/EXEC SQL
C+ SELECT DISTINCT CUSTNO into :WCUSTNO  from   CUSTFILE
C+ WHERE CUSTNO = :CUSTNUM
C/END-EXEC
C                   If        SQLCOD = 0
C                   Eval      FOUND = 'Yes'
C                   EndIf

I found following in the archives. There was a reference to american.edu
but I cannot access that.

> "Walden Leverich"
>Date: Fri, 14 Nov 1997 12:23:45 -0500
>
>--------------------------------------------------------------------------------
>
>I would like to check for the existence of a record in a file using SQL.
>There could be 0, 1 or more than 1 records that match the selection
>criteria, I only care if records exist, not how many.
>
>I know that SQL has the EXISTS predicate, but I cannot use it by itself, it
>must be in the where clause of a statement. I realize that I could do a
>select count(*) where.... but this would require DB2/400 to read all the
>matching records in order to count them. In my case as soon as DB2 finds 1
>record it can stop looking.
>
>Any suggestions?
>
>-Walden
>
>PS. Yes, I know a single chain or setll would accomplish this. I am looking
>for a SQL solution.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.