|
I might be trying to be too fancy here, but I thought that maybe
this would work.
I have an array of values (words) that I need to search a particular
field for in a file.... So I thought that this might work...
Exec SQL
Declare NameSet Cursor For
Select Cast(rncust As Numeric(6,0)),
Cast(rnseq As Numeric(4,0)),
Cast(rntype As Numeric(2,0)),
rnword1, rnword2, rnword3, rnword4, rnword5
From rcm002pf
Where rnword1 in(:NameString)
and rntype = (case when :type<>''
then :NumType else rntype
End)
Order by rncust, rnseq;
I build NameString from the array values. Its a character string.
Its value is like... 'word1','word2','word3'
My thinking is that NameString would just plop right inside the IN()
clause and act as the list to check. But I keep getting and sql 100
error (no results). If I put this into my favorite sql tool it works
fine. So I know that its something to do with the SQL. I thought this
would be cleaner than doing a Prepare, but maybe I'll have to do it
anyway.
Addendum from another post:
I actually have 5 different columns I need to do this with so I
was trying to be a bit more succinct and use just 1 host variable
5 times instead of 5 host variables 5 times. Plus, I only want to
include the host variable if it isn't equal to *blanks, so I guess
I'm just going to have to build and prepare the statement.
Any thoughts????
As an Amazon Associate we earn from qualifying purchases.
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.