Consultor Eletrônico



Kbase 19846: SQL-92 SQL Exception 1 SQLState=42000 ErrorCode=20003
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/31/2004
Status: Verified

FACT(s) (Environment):

Progress 9.1x

SYMPTOM(s):

The running of SQL-92 statements that use SQL reserved words

The running of SQL-92 statements that have a hyphen in the table name.

=== SQL Exception 1 ===
SQLState=42000
ErrorCode=-20003
[JDBC Progress Driver]:Syntax error (7587)

CAUSE:

The following example illustrates how the use of SQL Reserved Words
in SQL-92 statements can cause an exception.
First connect to the SQL-92 server with the SQL Explorer tool
(see: Progress Solution 18757 for instructions.) Once you
have a connection, enter the following SQL-92 statements with these steps:

1) Select * from pub.Order
2) Insert into pub.customer (Number) values (1)
3) Select * from pub.order-line


NOTE: The Number field was created in the Customer table for this example.

FIX:

All reserved words or hyphenated fields must be enclosed in quotation marks.

The first statement selects from the Order table. Order is a SQL Reserved Word and needs to be in quotes (for example, Select * from pub."Order")

The second statement inserts a new record into the Customer table
and inserts the value 1 into the Number field. The word Number is
also a SQL Reserved Word that must be in quotes. For example:

Insert into pub.customer ("Number") values (1)

The third statement selects all records from the order-line table. SQL-92 does not allow dashes in the field or table name and hence it must be enclosed in the double quotes.
For Example:

Select * from pub."order-line"