<div>Hi Darren and Joe,</div>  <div>&nbsp;</div>  <div>Sorry for the late reply, just back from a long break.</div>  <div>Thanks for the suggestion and it does work! It appears that I can't do a dynamic string to the SQL statement and I am kind of hoping the dynamic string will work. If it does, it will save lots of time to cut down programming logics.</div>  <div>Thanks again guys.</div>  <div>&nbsp;</div>  <div>cheers,</div>  <div>Kim Han<BR><BR><B><I>Darren Reely &lt;darren.reely@latticesemi.com&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">It doesn't seem you can be as dynamic as your looking for. I think that <BR>is because the compile process requires knowledge of how the cursor will <BR>appear.<BR><BR>Assuming your only using one table, you could try something like this;<BR><BR>sql in mydb declare mytest cursor for &amp;<BR>select name, ic-no from mytable &amp;<BR>::where<BR><BR>if tmp_where_cnt =
 1<BR>then sql open mytest where(where name = :tmp_a)<BR>else sql open mytest where(where name = :tmp_a and ic_no = :tmp_b)<BR><BR>Darren<BR><BR><BR>I H LIM wrote:<BR>&gt; Hi all,<BR>&gt; <BR>&gt; I have difficulties on executing sql statement through cursor in QUICK. <BR>&gt; Below is my statement :<BR>&gt; <BR>&gt; let tmp_where_cnt = 0<BR>&gt; let tmp_where = "where"<BR>&gt; if tmp_a &lt;&gt; ""<BR>&gt; then begin<BR>&gt; let tmp_where = " name = '"+tmp_a+"'"<BR>&gt; let tmp_where_cnt = 1<BR>&gt; end<BR>&gt; <BR>&gt; if tmp_b &lt;&gt; ""<BR>&gt; then begin<BR>&gt; if tmp_where_cnt = 1<BR>&gt; then let tmp_where = tmp_where + "and ic_no = '"+tmp_b+"'"<BR>&gt; else let tmp_where = tmp_where + "ic_no = '"+tmp_b+"'"<BR>&gt; end<BR>&gt; <BR>&gt; .....<BR>&gt; <BR>&gt; SQL OPEN "cursor_name" where ((tmp_where))<BR>&gt; ----------------------------------------------<BR>&gt; <BR>&gt; I need to substitute the "WHERE" statement using the "tmp_where" field.<BR>&gt; Can SQL statement in
 Powerhouse able to be substituted as above?<BR>&gt; For your information, I'm running Powerhouse Web Version 8.4D1 under <BR>&gt; Windows platform using Axiant 3.4D1<BR>&gt; <BR>&gt; Thank You<BR>&gt; <BR>&gt; Regards<BR>&gt; Kim Han<BR></BLOCKQUOTE><BR><p>
                <hr size=1>Brings words and photos together (easily) with<br> 
<a href="http://us.rd.yahoo.com/mail_us/taglines/PMall/*http://photomail.mail.yahoo.com">PhotoMail </a> - it's free and works with Yahoo! Mail.