problem java select statement and fieldnames

rboeve

New Member
Hi,
Language : java 1.6,
Driver : com.ddtek.jdbc.openedge.OpenEdgeDriver
Progress Db : 10.2B

I got a succesfull query with select * from pub.vendor.
But with the query select * from pub.vendor where 'name-vendor' = '1000' there is no result. (I know it is present in the table, so ther must be a result !)
There are no errors.

I try the fliedname: `name-vendor` --> Syntax error in SQL statement at or about "`name-vendor` = '1000' " (10713)
I tyr the fieldname: name-vender --> Column "name" cannot be found or is not specified for query. (13865)

Has somebody a idea or a solution ?

Rens
 
Acccording to kbase entry P11495:

[TABLE="class: htmlDetailElementTable, width: 1332"]
[TR]
[TD]
There are two ways to reference a table or field name with dashes, hyphens or reserved words:

1) Use double quote on table names. For example:

SELECT * FROM pub."Customer-Name"

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"

2) Create a view to reflect the same table with all the fields selected. For Date Fields enclose them in single quotes. For example:

SELECT * FROM pub.invoice WHERE "invoice-date" = '1993-02-08'​
[/TD]
[/TR]
[/TABLE]
 
Back
Top