Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319927

Summary: Query Builder generates invalid Oracle syntax causing ora-00933 (AS keyword is not supported by Oracle)
Product: [Tools] Data Tools Reporter: Frits Jalvingh <jal>
Component: SQL Query BuilderAssignee: Brian Payton <bpayton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bpayton, lchan
Version: 1.8   
Target Milestone: 1.8.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Patch for plugin o.e.d.sqltools.sqlbuilder none

Description Frits Jalvingh CLA 2010-07-14 17:56:45 EDT
Build Identifier: 20100617-1415

Select "DataSet" in Data Explorer; create a new one on a data source connected to an Oracle (10g in my case) database.
Create a query using a table alias using the query builder
The generated SQL looks like:
SELECT NAAM, SYST_ID, IND_GEBLOKKEERD, ADMN_ID, CLUS_ID, COMT_ID,
  VLTA_ID, ID
  FROM DEMO.GEBRUIKERS AS GEBR
This SQL is invalid for Oracle- it does not support the 'as' keyword. The query causes the error:

A BIRT exception occurred.
  Plug-in Provider:Eclipse.org
  Plug-in Name:BIRT Data Engine
  Plug-in ID:org.eclipse.birt.data
  Version:2.6.0.v20100524
  Error Code:odaconsumer.CannotGetResultSetMetaData
  Error Message:Cannot get the result set metadata.
    org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1: ORA-00933: SQL command not properly ended

Whatever you do- since the query is always regenerated the as will reappear..

Reproducible: Always

Steps to Reproduce:
See description
Comment 1 Linda Chan CLA 2010-07-21 19:43:28 EDT
Created attachment 174931 [details]
Proposed patch
Comment 2 Brian Payton CLA 2010-07-27 15:24:11 EDT
Created attachment 175346 [details]
Patch for plugin o.e.d.sqltools.sqlbuilder

Fix looks OK.  I reworked patch slightly so all "if"s have brackets and to move the "new VendorHelper" out of the if-test.  (Simple if-tests make debugging easier.)
Comment 3 Brian Payton CLA 2010-07-27 16:32:00 EDT
Checked in fix, tagged to v201007280345.