Informix Error 201
on), keywords misspelled (such as sql 2014 VALEUS for VALUES), keywords misused (such as SET in an INSERT sql 2012 statement or INTO in a subquery), keywords out of sequence (such as a condition of "value IS NOT" instead of "NOT value IS"), or a reserved word used as an identifier. Database servers that provide full NIST compliance do not reserve any words; queries that work with these database servers might fail and return error -201 when they are used with earlier versions of IBM Informix database servers.
The cause of this error might be an attempt to use round-robin syntax with CREATE INDEX or ALTER FRAGMENT INIT on an index. You cannot use round-robin indexes. The error may also occur if an SQL statement uses double quotation marks around input strings and the environment variable DELIMIDENT is set. If DELIMIDENT is set, strings that are surrounded by double quotation marks are regarded as SQL identifiers rather than string literals. For more information on the usage of DELIMIDENT, see the IBM Informix Guide to SQL: Reference.even when your syntax is correct. Technote (troubleshooting) Problem(Abstract) You are trapping for syntax errors (SQL -201). You execute the CREATE DISTINCT TYPE statement or the CREATE DATABASE statement. The engine traps on a -201 error, indicating a problem with SQL syntax, but there are no syntax errors in the statement. Symptom You set a trap for a syntax error on your instance with the following command: onmode -I 201 You execute the http://www.oninit.com/errorcode/pda.php?id=201 CREATE DISTINCT TYPE statement. The online log shows there is an assert failure and an assert fail file is created. However, the SQL statement succeeds and the -201 error is not printed to the computer terminal. You are using IDS 11.5 or a later version. You experience the same problem executing CREATE DATABASE. You can determine the problem http://www.ibm.com/support/docview.wss?uid=swg21375543 by examining the data for the failed session in the assertion failure file. Expect to see the information as follows, depending on which SQL statement generates the assertion: You execute CREATE DISTINCT TYPE The failed session data in the assertion failure file shows CREATE DISTINCT TYPE in the SQL Stmt type field and -201 in the SQL ERR field. The SQL statement data shows your statement and a CREATE DOMAIN statement: Current SQL statement : create distinct type mytype as int Last parsed SQL statement : create domain tmpdom mytype You execute CREATE DATABASE The failed session data in the assertion failure file shows CREATE DISTINCT TYPE in the SQL Stmt type field and -201 in the SQL ERR field. The SQL statement data shows the following statements: Current SQL statement : create distinct type informix.IDSSECURITYLABEL as varchar(128); Last parsed SQL statement : create domain tmpdom idssecuritylabel Cause The product is working as designed. Resolving the problem The CREATE DATABASE statement succeeds and the CREATE DISTINCT TYPE statement succeeds.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business http://stackoverflow.com/questions/11251060/informix-error-a-syntax-error-has-occurred-error-code-201 Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Informix ERROR: A syntax error has occurred. Error Code: -201 up vote 1 down vote favorite The only statement in my SQL code informix error 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. informix share|improve this question asked Jun 28 '12 at 18:50 Baris Seker 9818 You need to explain what you are trying to do. You can only define variables informix error 201 in the context of a stored procedure. You need to explain which language or program you are using to access the database. The CREATE FUNCTION statement might have failed for many different reasons. (Also, as a matter of interest, there never was a version 10.5 of Informix; the versions went 9.40, 10.00, 11.10, 11.50, 11.70. Which version of what are you using, on which platform?) –Jonathan Leffler Jun 29 '12 at 16:34 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote 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; share|improve this answer answered Jun 28 '12 at 21:35 RET 7,84212027 This gives an error too: ERROR: A syntax error has occurred. Error Code: -201 Query = CREATE FUNCTION foo() –Baris Seker Jun 29 '12 at 7:26 Sorry, that was never meant to be a runnable stored procedure. I didn't have access to an Informix instance when I wrote it. It probably should say CREATE FUNCTION foo() RETURNING DATETIME YEAR TO SECOND; .... The salient point is that DEFINE cannot be used in SQL. –RET Jun