SQL OPEN Error

I H LIM infojenama at yahoo.com
Tue Feb 14 01:57:50 CST 2006


Hi Darren and Joe,
   
  Sorry for the late reply, just back from a long break.
  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.
  Thanks again guys.
   
  cheers,
  Kim Han

Darren Reely <darren.reely at latticesemi.com> wrote:
  It doesn't seem you can be as dynamic as your looking for. I think that 
is because the compile process requires knowledge of how the cursor will 
appear.

Assuming your only using one table, you could try something like this;

sql in mydb declare mytest cursor for &
select name, ic-no from mytable &
::where

if tmp_where_cnt = 1
then sql open mytest where(where name = :tmp_a)
else sql open mytest where(where name = :tmp_a and ic_no = :tmp_b)

Darren


I H LIM wrote:
> Hi all,
> 
> I have difficulties on executing sql statement through cursor in QUICK. 
> Below is my statement :
> 
> let tmp_where_cnt = 0
> let tmp_where = "where"
> if tmp_a <> ""
> then begin
> let tmp_where = " name = '"+tmp_a+"'"
> let tmp_where_cnt = 1
> end
> 
> if tmp_b <> ""
> then begin
> if tmp_where_cnt = 1
> then let tmp_where = tmp_where + "and ic_no = '"+tmp_b+"'"
> else let tmp_where = tmp_where + "ic_no = '"+tmp_b+"'"
> end
> 
> .....
> 
> SQL OPEN "cursor_name" where ((tmp_where))
> ----------------------------------------------
> 
> I need to substitute the "WHERE" statement using the "tmp_where" field.
> Can SQL statement in Powerhouse able to be substituted as above?
> For your information, I'm running Powerhouse Web Version 8.4D1 under 
> Windows platform using Axiant 3.4D1
> 
> Thank You
> 
> Regards
> Kim Han


		
---------------------------------
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20060213/31c762bc/attachment.html


More information about the powerh-l mailing list