Informix Sql Error 201
Contents |
table 201 syntax error
Informix Sql Error Codes
occurred create table reserved key word keyword Technote (troubleshooting) 4gl error codes Problem(Abstract) You get error "201: A syntax error has occurred." when trying to create
Forms Statement Error Number
a table. Symptom create table t1 ( c1 int, primary int); 201: A syntax error has occurred. Error in informix sqlcode line 1 Near character position 34 Cause This could be because you are using the following reserved words as a column name: CHECK DISTINCT FOREIGN PRIMARY UNIQUE Resolving the problem Although you can use these reserved words as an identifier, syntactic ambiguities can result finderr from using keywords as identifiers in SQL statements. The statement might fail or might not produce the expected results. However, if you must use these reserved words as column names, you can use the following workaround: Create the table without the column that has the keyword name, then ALTER TABLE to ADD the column with the reserved word. For example: create table t1 (c1 int); ALTER TABLE t1 ADD primary int; Related information Use of Keywords as Identifiers Document information More support for: Informix Servers Software version: 10.0, 11.1, 11.5, 11.7 Operating system(s): AIX, HP-UX, Linux, OS X, Solaris, Windows Reference #: 1441150 Modified date: 2014-06-26 Site availability Site assistance Contact and feedback Need support? Submit feedback to IBM Support 1-800-IBM-7378 (USA) Directory of worldwide contacts Contact Privacy Terms of use Accessibility
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 CREATE DISTINCT TYPE statement. The online log shows http://www.ibm.com/support/docview.wss?uid=swg21441150 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 by examining the data for the failed session in the assertion failure file. http://www.ibm.com/support/docview.wss?uid=swg21375543 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. The trap on -201 also traps if there is a genuine syntax error on the statement, in which case a message with the -201 error is print
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 http://stackoverflow.com/questions/22650379/syntax-error-201-why the company Business 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 Syntax error (-201) why? up vote 1 down vote favorite Why am I getting syntax error in this informix sql SPL procedure? Only message I got is that exists some error while using syntax check in server studio. create function najboljihN(n smallint) returning char(10) as jmbag, char(50) as prezime, char(50) as ime, decimal(3,2) as prosjek; define jmbag like student.jmbag; define prezime like student.prezime; define ime like student.ime; define prosjek decimal(3,2); define i integer; for i=1 to n step 1 SELECT student.jmbag, student.prezimestudent, student.imestudent, Avg(ocjena) INTO jmbag, prezime, ime, prosjek FROM student JOIN informix sql error upisanpredmet ON student.jmbag = upisanpredmet.jmbag GROUP BY student.jmbag, student.prezimestudent, student.imestudent ORDER BY ocjena, student.prezimestudent asc, student.imestudent asc; RETURN jmbag, prezime, ime, ocjena WITH RESUME; end for; end function; sql informix share|improve this question edited Apr 5 '14 at 2:43 Jonathan Leffler 440k62511824 asked Mar 26 '14 at 2:29 Error 271419 I can't find any mention of a -201 error on the Information Center pages for any DB2 platform I'm familiar with (z/OS, LUW, iSeries)... are you sure that's the message you're getting? Could you paste the full text of the error you get? –bhamby Mar 26 '14 at 4:33 @bhamby SPL is the Informix programming language; the DB2 tag does not belong here. –mustaccio Mar 26 '14 at 12:21 @mustaccio makes sense, then. :) –bhamby Mar 26 '14 at 12:50 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted You can't use the order by clause in this case. Without the order by clause you can compile your function. create function najboljihN(n smallint) returning char(10) as jmbag, char(50) as prezime, char(50) as ime, decimal(3,2) as prosjek; define jmbag like student.jmbag; define prezime like student.prezime; define ime like student.ime; define prosjek decimal(3,2); define i integer; for i = 1 to n step