SQL-statement causes stack-problem

Luukh

New Member
Today I've written a program with roughly the following syntax:

for each customer no-lock:
select count(*) into vtotal from orders
where order.cust_id = customer.cust_id.

if vtotal < 5 then next.

for each order where order.cust_id = customer.cust_id no-lock:
display order.
end.
end.

when I run the program I get an error about the -s parameter.
When I replace the select count statement with a:
for each order...
assign x = x + 1.
end.
there's no problem.

Does anybody know what the problem is?
And is this some sort of incompatibility between Progress and SQL?

TIA,
Luuk
 

Chris Kelleher

Administrator
Staff member
Luuk-

Hi there. I suspect that your problem is related to the fact that you are using FOR EACH (4GL) and SELECT (SQL) in the same block. I would recommend either using all 4GL record statements or all SQL, but I wouldn't mix and match both in the same procedure.

HTH.

-Chris

------------------
Chris Schreiber
ProgressTalk.com Manager
chris@fast4gl.com
 

zhonghong

New Member
For each is a Progress statement which acquires one row at a time, whereas select is a SQL statement usually returns a dataset, don't mix them up.

<BLOCKQUOTE><font size="1" face="Arial, Verdana">quote:</font><HR>Originally posted by Luukh:
Today I've written a program with roughly the following syntax:

for each customer no-lock:
select count(*) into vtotal from orders
where order.cust_id = customer.cust_id.

if vtotal < 5 then next.

for each order where order.cust_id = customer.cust_id no-lock:
display order.
end.
end.

when I run the program I get an error about the -s parameter.
When I replace the select count statement with a:
for each order...
assign x = x + 1.
end.
there's no problem.

Does anybody know what the problem is?
And is this some sort of incompatibility between Progress and SQL?

TIA,
Luuk
<HR></BLOCKQUOTE>
 
Top