hi -
i'm new to Informix 4GL (7.3) and i've built a 4GL program but need some help with it.
i have a cursor scanning through a temp table i loaded (temp_tab).
from within the cursor loop, i want to feed a query with one of the values grabbed by the cursor, and if there's a result > 0, set a flag to 1, otherwise set it to 0.
my question is, "what's the syntax for detecting the presence of a query result?"
here's the pertinent code:
define r_s record
col1 char (16),
col2 char (30),
col3 char (4),
col4 decimal (18,6)
end record
let q = "select * from temp_tab"
prepare ex_q from q
declare q_curs cursor for ex_q
foreach q_curs into r_s.*
#query goes here:
select distinct myname from mytable
where yourname = 'r_s.col1'
and myname[1,3] = "val"
#how do i detect the record count resulting from
#the above query?
if #query_result > 0 then
let col5 = "1"
else
let col5 = "0"
end if
insert into newtable
(col1,col2,col3,col4,col5)
values
(
r_s.col1,
r_s.col2,
r_s.col3,
r_s.col4,
col5
)
end foreach
i'm new to Informix 4GL (7.3) and i've built a 4GL program but need some help with it.
i have a cursor scanning through a temp table i loaded (temp_tab).
from within the cursor loop, i want to feed a query with one of the values grabbed by the cursor, and if there's a result > 0, set a flag to 1, otherwise set it to 0.
my question is, "what's the syntax for detecting the presence of a query result?"
here's the pertinent code:
define r_s record
col1 char (16),
col2 char (30),
col3 char (4),
col4 decimal (18,6)
end record
let q = "select * from temp_tab"
prepare ex_q from q
declare q_curs cursor for ex_q
foreach q_curs into r_s.*
#query goes here:
select distinct myname from mytable
where yourname = 'r_s.col1'
and myname[1,3] = "val"
#how do i detect the record count resulting from
#the above query?
if #query_result > 0 then
let col5 = "1"
else
let col5 = "0"
end if
insert into newtable
(col1,col2,col3,col4,col5)
values
(
r_s.col1,
r_s.col2,
r_s.col3,
r_s.col4,
col5
)
end foreach