×
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.
Well, with your search value list being nicely formatted like that, couldn't you just use the LOCATE(Column3 , :path) > 0 in lieu of the IN(:path)... You might need to use trim(column3) if your :path string does not pad blanks in the search values list...
Hth,
-Eric DeLong
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Needles,Stephen J
Sent: Thursday, June 21, 2012 1:33 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Embedded SQL using IN and a host variable
I have a need to accept a list of values that needs to be compared to a column in a table using an embedded SQL statement in RPGLE.
The list:
'data1'
'data2'
This list is assembled so that path looks like:
'data1','data2'
When used in the SQL statement...
Select stuff from table where column3 in (:path);
I end up with an SQLCod = 100.
Running the SQL outside of the program produces the needed data.
Select * from table where column3 in ('data1','data2');
Is there a solution short of repeating the condition over and over again? Using STRIP and TRIM with the host variable had no impact.
exec sql
declare get cursor with return to client for
SELECT distinct
Column1, Column2, Column3 FROM Table WHERE
Column3 in (:path);
exec sql open get;
exec sql fetch get into :Column1, :Column2, :Column3;
if sqlcod = sqlcod;
eval sqlcod = sqlcod;
endif;
/end-free
==============================================================================
This communication, including attachments, is confidential, may be subject to legal privileges, and is intended for the sole use of the addressee. Any use, duplication, disclosure or dissemination of this communication, other than by the addressee, is prohibited. If you have received this communication in error, please notify the sender immediately and delete or destroy this communication and all copies.
As an Amazon Associate we earn from qualifying purchases.
This thread ...
AW: Embedded SQL using IN and a host variable, (continued)
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.