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

Bug 164164

Summary: Can not execute sql script with multiple statements
Product: [Tools] Data Tools Reporter: John Graham <jgraham>
Component: SQL Editor FrameworkAssignee: Hui Cao <hui.cao>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: hiroyuki.inaba, hung.hsi
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Sample script from BIRT test database none

Description John Graham CLA 2006-11-10 14:43:43 EST
**DTP 1.0M4 11/10 build**
Created an embedded Derby connection profile, and tried to execute the attached SQL script (from the BIRT sample database) against it. The following error was reported in the Results View:

"Syntax error: Encountered ";" at line 33, column 2."

If I select each statement individually and execute selected text, then all complete correctly. There doesn't appear to be a syntax error in the script (Derby's command line utility processes this file without error), and I have used multiple statements terminated with ; in the SQL editor before.

We are trying to create an introductory tutorial for DTP 1.0, and this is preventing using DTP tools to load the initial database.
Comment 1 John Graham CLA 2006-11-10 14:44:45 EST
Created attachment 53649 [details]
Sample script from BIRT test database
Comment 2 Hui Cao CLA 2006-11-17 12:06:13 EST
Modified Derby sql parser to correctly recognize the satement terminators. Tested using the attached sample derby script.
Comment 3 John Graham CLA 2006-12-01 12:21:21 EST
Verified in DTP 1.0RC1 12/1 build and closing.
Comment 4 Hiroyuki Inaba CLA 2007-08-29 06:39:03 EDT
A similar problem was detected. 
In SQL execution from SQL editor, two or more CREATE TABLE became execution of one. 

EX;

CREATE TABLE ..... ;
CREATE TABLE ..... ;
CREATE TABLE ..... ;

In org.eclipse.datatools.sqltools.db.generic plugin,
create_stmts method of GenericSQLParser class call "any_stmt_token()".

In any_stmt_token(),
   call "error_skiptobefore(new int[]{END, SEMICOLON, GO}, STMT_START)".

FIXED => error_skiptobefore(new int[]{END}, STMT_START_TERMINATORS)

   NOTE: STMT_START_TERMINATORS = STMT_START + TERMINATORS

The sentence ends by correcting this bug before ";". 

I think that you should apply the same correction as GenericSQLParser. 
Comment 5 Hung Hsi CLA 2007-08-29 12:10:02 EDT
Hui, please look into it.
Comment 6 Hui Cao CLA 2008-10-06 06:03:46 EDT
See 191721.