SQL OPEN Error
Darren Reely
darren.reely at latticesemi.com
Thu Feb 9 16:01:46 CST 2006
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
More information about the powerh-l
mailing list