Skip to main content

[Migrated content. Thread originally posted on 17 May 2006]

Hello,
Can you use the If clause in AcuSql?
I'm trying to use the following code:

EXEC SQL
IF :WS-VALUE-CHECK = 1
DECLARE COBCUR2 CURSOR FOR
SELECT PK, PREFIX, ID, SUFFIX, NAME, FARM, FARMCOUNT, DIV,
FARMSTATE, FARMCOUNTY, OPERPK, ACTIONS,PHLPK, ASNPK,
SWISSID
FROM VW_PATRONS_IN_TBL_PAYROLLDATA_1 WITH (NOLOCK)
END-EXEC

I get the following error message:

parse error at IF

[Migrated content. Thread originally posted on 17 May 2006]

Hello,
Can you use the If clause in AcuSql?
I'm trying to use the following code:

EXEC SQL
IF :WS-VALUE-CHECK = 1
DECLARE COBCUR2 CURSOR FOR
SELECT PK, PREFIX, ID, SUFFIX, NAME, FARM, FARMCOUNT, DIV,
FARMSTATE, FARMCOUNTY, OPERPK, ACTIONS,PHLPK, ASNPK,
SWISSID
FROM VW_PATRONS_IN_TBL_PAYROLLDATA_1 WITH (NOLOCK)
END-EXEC

I get the following error message:

parse error at IF
You need to use the "where" statement. Check this Tutorial for SQL syntax