Я пытаюсь запустить следующий сценарий sql на сервере mysql через задачу ant с помощью mysql-connector-java-5.1.15, но он не будет работать, и я получаю следующую ошибку в третьей команде.Я могу заставить другие скрипты нормально работать с ant, так что это не проблема с подключением.
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'DROP TABLE IF
EXISTS `tmp_cui_desc`;
CREATE TABLE `tmp_cui_desc` (
CUI CHAR(8' at line 15
Странно, но скрипт отлично работает в рабочей среде MySql (v5.2.31), подключенной к тому же серверу.Почему это должно быть?База данных - латинская1, а система наборов символов - uft8.Может ли это быть частью проблемы?Если так, что мне нужно сделать, чтобы это исправить?
Огромная благодарность за любую помощь Роб.
USE umls;
/*
* creates a summary view of the umls_mrconso table which abstracts most of the detail from atoms to concepts
* this is a table with a single row per CUI
*
*/
/*
* Create a temporary table based on the sources of a given cui
*/
DROP TABLE IF EXISTS tmp_cui_sabs;
CREATE TABLE tmp_cui_sabs (
CUI CHAR(8) NOT NULL,
SABS VARCHAR(255),
PRIMARY KEY (CUI)
)
SELECT
u.CUI as CUI,
GROUP_CONCAT(DISTINCT u.SAB ORDER BY u.SAB ASC SEPARATOR '|') as SABS
FROM umls_mrconso u
GROUP BY u.CUI;
/*
* Create a temporary table containing the best available description for any given cui
*/
DROP TABLE IF EXISTS tmp_cui_desc;
CREATE TABLE tmp_cui_desc (
CUI CHAR(8) NOT NULL,
TERM VARCHAR(255),
PRIMARY KEY (CUI)
)
SELECT
u.CUI as CUI,
MIN(u.STR) as TERM
FROM umls_mrconso u
WHERE u.ISPREF='Y'
AND u.LAT='ENG'
AND u.TS='P'
GROUP BY u.CUI;
/*
* Create a permanent table as the join of the 2 temporary tables
* contains a preferred description, and all the sources that map to this cui,
* as well as the CUI itself.
* TODO: could be useful to include semantic type info here as well?
*/
DROP TABLE IF EXISTS bmj_cui_summary;
CREATE TABLE bmj_cui_summary (
CUI CHAR(8) NOT NULL,
TERM VARCHAR(255),
SABS VARCHAR(255),
PRIMARY KEY (CUI)
)
SELECT
sabs.CUI as CUI,
LOWER(descs.TERM) as TERM,
sabs.SABS as SABS
FROM
tmp_cui_sabs sabs,
tmp_cui_desc descs
WHERE sabs.CUI=descs.CUI;
/*
* clean up tmp tables
*/
DROP TABLE IF EXISTS tmp_cui_sabs;
DROP TABLE IF EXISTS tmp_cui_desc;