Baris Seker
Baris Seker

Reputation: 173

Informix ERROR: A syntax error has occurred. Error Code: -201

The only statement in my SQL code is

DEFINE p_starttime DATETIME YEAR TO SECOND;

I get this error from Informix 10.5: ERROR: A syntax error has occurred. Error Code: -201

Query = DEFINE p_starttime DATETIME YEAR TO SECOND

Anybody has a clue why this might be happening? It's such a simple statement.

Upvotes: 1

Views: 11724

Answers (1)

RET
RET

Reputation: 9188

It's not valid SQL, as simple as that. DEFINE is not a keyword you can use in a query. It is part of the Stored Procedure Language, or SPL syntax, ie:

CREATE FUNCTION foo();
    DEFINE p_starttime DATETIME YEAR TO SECOND;
    -- do stuff
    RETURN p_starttime;
END FUNCTION;

Upvotes: 2

Related Questions