<br><font size=2 face="sans-serif">Hi Peter,</font>
<br>
<br><font size=2 face="sans-serif">Thanks a lot that works</font>
<br>
<br><font size=2 face="sans-serif">Best regards,<br>
<br>
Frank<br>
<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Peter Bateman <peterbateman808@hotmail.com></b>
</font>
<br><font size=1 face="sans-serif">Sent by: powerh-l-bounces+frank.huizinga=eu.averydennison.com@lists.sowder.com</font>
<p><font size=1 face="sans-serif">04-04-2008 14:30</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif"><frank.huizinga@eu.averydennison.com>,
<powerh-l@lists.sowder.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">RE: Cursor with WHERE . . IN</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 face="Tahoma"> Hi Frank:<br>
<br>
<br>
PowerHouse needs to pad out to the size of the column
in the IN predicate otherwise you<br>
would not get a match.<br>
<br>
<br>
I think you need multiple HOST variables to do what
you want.<br>
<br>
</font><font size=2 face="Courier New">CURSOR product
IN lilybase &
<br>
WHERE (product.prod_code IN (:FIRST , :SECOIND,
:THIRD, :FORTH ) & </font><font size=2 face="Tahoma"> <br>
<br>
</font><font size=2 face="Courier New">FIRST , SECOIND,
THIRD, FORTH </font><font size=2 face="Tahoma"> etc represent one
value to included<br>
in the IN predicate.<br>
<br>
<br>
Regards,<br>
Peer Bateman <br>
<br>
<br>
<br>
<br>
</font>
<br>
<hr><font size=2 face="Tahoma">To: powerh-l@lists.sowder.com<br>
Subject: Cursor with WHERE . . IN<br>
From: Frank.Huizinga@eu.averydennison.com<br>
Date: Fri, 4 Apr 2008 10:26:21 +0200<br>
<br>
</font><font size=2 face="sans-serif"><br>
Hi All,</font><font size=2 face="Tahoma"> <br>
</font><font size=2 face="sans-serif"><br>
I'm facing a problem with using embedded SQL WHERE .. IN</font><font size=2 face="Tahoma">
<br>
</font><font size=2 face="sans-serif"><br>
When I'm only selecting one product it works fine (although I should than
use WHERE . . =)</font><font size=2 face="Tahoma"> </font><font size=2 face="sans-serif"><br>
When I want to retrieve multiple products it fails. The examples below
explains what is happening in the background. Has any one a solution to
this?</font><font size=2 face="Tahoma"> <br>
</font><font size=2 face="sans-serif"><br>
Selecting one product:</font><font size=2 face="Tahoma"> <br>
<br>
SCREEN in
<br>
SET LIST SQL
<br>
<br>
TEMPORARY t_prod_array CHARACTER SIZE 256 &
<br>
INITIAL "DA7022000"
<br>
<br>
CURSOR product IN lilybase &
<br>
WHERE (product.prod_code IN (:TRUNC(t_prod_array))) & </font><font size=2 face="Verdana">
</font><font size=2 face="Tahoma"><br>
PRIMARY KEY prod_code OCCURS 5
<br>
<br>
SKIP TO 3
<br>
<br>
ALIGN (1,,4) (,,30)
<br>
CLUSTER OCCURS WITH qad_product
<br>
FIELD prod_code DISPLAY
<br>
FIELD prod_desc1 DISPLAY
<br>
<br>
BUILD
<br>
</font><font size=2 face="sans-serif"><br>
Resulting DMAPIFIL content:</font><font size=2 face="Tahoma"> <br>
<br>
prepare r1 from <br>
"SELECT * FROM LILY.PRODUCT where PRODUCT.PROD_CODE IN (:phE1
)" <br>
in t1; <br>
describe input r1; <br>
declare c1 cursor for r1 read write, keep; </font><font size=2 color=blue face="Tahoma"><br>
open c1 parm phE1:"DA7022000 ";</font><font size=2 face="Tahoma">
<br>
</font><font size=2 face="sans-serif"><br>
The phE1 variable is padded with blanks to the size of prod_code CHAR(18)</font><font size=2 face="Tahoma">
</font><font size=2 face="sans-serif"><br>
but the record is retieved.</font><font size=2 face="Tahoma"> <br>
<br>
</font><font size=2 face="sans-serif"><br>
Selection of multiple products</font><font size=2 face="Tahoma"> <br>
<br>
SCREEN in
<br>
SET LIST SQL
<br>
<br>
TEMPORARY t_prod_array CHARACTER SIZE 256 &
<br>
INITIAL "DA7022000,DA7021980"
<br>
<br>
CURSOR product IN lilybase &
<br>
WHERE (product.prod_code IN (:TRUNC(t_prod_array))) &
<br>
PRIMARY KEY prod_code OCCURS 5
<br>
<br>
SKIP TO 3
<br>
<br>
ALIGN (1,,4) (,,30)
<br>
CLUSTER OCCURS WITH product
<br>
FIELD prod_code DISPLAY
<br>
FIELD prod_desc1 DISPLAY
<br>
<br>
BUILD
<br>
</font><font size=2 face="sans-serif"><br>
Resulting DMAPIFIL content:</font><font size=2 face="Tahoma"> <br>
<br>
prepare r1 from <br>
"select * from LILY.PRODUCT where PRODUCT.PROD_CODE IN (:phE1 )"
<br>
in t1; <br>
describe input r1; <br>
declare c1 cursor for r1 read write, keep; <br>
open c1 parm phE1:"DA7022000,DA702198"; <br>
</font><font size=2 face="sans-serif"><br>
The phe1 parameter is truncated to the size of the attribute prod_code
which is CHAR(18)</font><font size=2 face="Tahoma"> </font><font size=2 face="sans-serif"><br>
and 'No records found matching . . ' is issued</font><font size=2 face="Tahoma">
<br>
<br>
</font><font size=2 face="sans-serif"><br>
Thanks in advance</font><font size=2 face="Tahoma"> <br>
</font><font size=2 face="sans-serif"><br>
Best regards,<br>
<br>
Frank</font><font size=2 face="Tahoma"><br>
<br>
- -----------------------------------------------------------------<br>
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any computer.</font>
<br><font size=2 face="Tahoma"><br>
</font>
<hr><font size=2 face="Tahoma">You could win $1000 a day, now until May
12th, just for signing in to Windows Live Messenger. </font><a href=http://g.msn.ca/ca55/211 target=_new><font size=2 color=blue face="Tahoma"><u>Check
out SignInAndWIN.ca to learn more!</u></font></a><font size=2><tt>-- <br>
= = = = = = = = = = = = = = = = = = = = = = = = = = = =<br>
Mailing list: powerh-l@lists.sowder.com<br>
Subscribe: &quot;subscribe&quot; in message body to powerh-l-request@lists.sowder.com<br>
Unsubscribe: &quot;unsubscribe &lt;password&gt;&quot; in
message body to powerh-l-request@lists.sowder.com<br>
http://lists.sowder.com/mailman/listinfo/powerh-l<br>
This list is closed, thus to post to the list you must be a subscriber.<br>
Add 'site:lists.sowder.com powerh-l' to your search terms to search the
list archive at Google.</tt></font>
<br>
<BR>
- -----------------------------------------------------------------<BR>
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.<BR>