Skip to main content

I am trying to add some logic to my embedded sql by using an sql variable

EXEC SQL RELAXED
    DECLARE @PARM1 AS INTEGER
    SELECT
        CUSTOMER_KEY
    INTO
        :CUSTOMER_KEY
    FROM [db_owner].[CUSTFILE]
    WHERE ( CUSTOMER_KEY = CUSTOMER-KEY)
    ORDER BY CUSTOMER_KEY
END-EXEC

The compiler reports;

-->ERROR: syntax error at AS

Compiler switches are;

ccbl32 -Di -Zd -w -Zl -Zr -Pr -Ps -La -Li -Lf 

Is there anyway around this?

I am trying to add some logic to my embedded sql by using an sql variable

EXEC SQL RELAXED
    DECLARE @PARM1 AS INTEGER
    SELECT
        CUSTOMER_KEY
    INTO
        :CUSTOMER_KEY
    FROM [db_owner].[CUSTFILE]
    WHERE ( CUSTOMER_KEY = CUSTOMER-KEY)
    ORDER BY CUSTOMER_KEY
END-EXEC

The compiler reports;

-->ERROR: syntax error at AS

Compiler switches are;

ccbl32 -Di -Zd -w -Zl -Zr -Pr -Ps -La -Li -Lf 

Is there anyway around this?

Good morning, blinkok

Does it work if you remove the "AS" ?

DECLARE @PARM1 INTEGER

See: https://bit.ly/3heDgeN

Claudio Contardi
Product Support Engineer, Senior
Micro Focus


Good morning, blinkok

Does it work if you remove the "AS" ?

DECLARE @PARM1 INTEGER

See: https://bit.ly/3heDgeN

Claudio Contardi
Product Support Engineer, Senior
Micro Focus

Unfortunatley it still abends with 'Syntax errror at int'


Unfortunatley it still abends with 'Syntax errror at int'

This is not supported.  I believe all variables need to be defined as part of the SQL DECLARE section of Working-Storage.