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



I'm testing the following query, the final form of which will be embedded
in an RPG program. When I run the query in STRSQL (after verifying that
qtemp/AR0119W does NOT exist), I get an error, SQL0601 "CA0119W in QTEMP
type *FILE already exists." The file is created, and it has data from both
select statements. If I remove the UNION and the second select statement,
I don't get the error. (But, of course, the new table doesn't have all of
the data I need it to have.)

Also, I'm not sure if the end result of this query could be duplicated with
a query that doesn't involve a UNION. The WHERE clauses are exact
opposites in the two select statements, so that every record in SfMast is
in the created table, with the values of qSelect1 and qPrvSlctd dependent
on the WHERE clause. (I probably shouldn't be writing SQL after midnight,
but here we are.)

- Dan

Create table qtemp/AR0119W as (
select cast( 'X' as char( 1)) as qSelect1,
cast( '*' as char( 1)) as qPrvSlctd,
SFM_SLSPID as q_SLSPID,
SFM_SLID as q_SLID,
SFM_SLNAME as q_SLNAME,
SFM_STATUS as q_STATUS from SfMast, SfXref
where SFX_ORGID = 'AXIP'
and SFX_PVDID = 'HARTFIELD'
and SFM_SLSPID = SFX_SLSPID
UNION
select cast( ' ' as char( 1)) as qSelect1,
cast( ' ' as char( 1)) as qPrvSlctd,
SFM_SLSPID as q_SLSPID,
SFM_SLID as q_SLID,
SFM_SLNAME as q_SLNAME,
SFM_STATUS as q_STATUS from SfMast
where not exists ( select * from SfXref
where SFX_ORGID = 'AXIP'
and SFX_PVDID = 'HARTFIELD'
and SFM_SLSPID = SFX_SLSPID )
order by Q_SLSPID
) WITH DATA

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.