× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



If you only need the first row and want to use SELECT ... INTO, why not
simply adding a FETCH FIRST ROW ONLY clause at the end of the
SELECT-Statement.
If multiple rows are found only the first one is returned, and can be
received in a host variable (no error or negative SQL code is returned)

Exec SQL Select ... into ...
From ...
Where ...
Fetch first row only;

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Dan
Gesendet: Wednesday, 20.1 2016 02:24
An: Midrange Systems Technical Discussion
Betreff: Re: Complex (for me) SQL question

In our case, the first occurrence of a duplicate for a part number made it
possible for all subsequent duplicates for that part number to occur.
Primarily because someone embedded SQL that did a SELECT ... INTO
datastructure. When more than one record was in the result set, the query
failed. They tested SQLCOD >= 0 and <> 100 to discern that query found a
record. However, when more than one record is returned, SQLCOD = -811, and
RECORD_FOUND was set to false, causing a subsequent INSERT. So, finding
when the first duplicate occurred allowed us to define a date range across
all affected part numbers and we were able to eliminate several potential
root causes.

- Dan

On Tue, Jan 19, 2016 at 7:25 PM, Michael Schutte <mschutte369@xxxxxxxxx>
wrote:

If you were looking to see when duplicates occurred, I would have
personally preferred...
select item
from file
group by item
having count(1) > 1

So if this query was running periodically, I would send off an email
as soon as at least one record was read from this.

--
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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.