Sql 无法执行H2语句
我在嵌入式数据库H2中执行此SQL H2语句,但出现错误:Sql 无法执行H2语句,sql,h2,Sql,H2,我在嵌入式数据库H2中执行此SQL H2语句,但出现错误: Factory method 'dataSource' threw exception; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #13 of class path resource [db/H2.data.sq
Factory method 'dataSource' threw exception; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #13 of class path resource [db/H2.data.sql]: insert into T_DEVICE_EVENT (ID, DEVICE_ID, LATITUDE, LONGITUDE, MESSAGE, DATE_RECEIVED, RSSI, BATTERY, ALARM, PROCESSED) values (1,1,50.834015,4.377885,'71',CURRENT_TIMESTAMP(),70,50,0,1); nested exception is java.sql.SQLSyntaxErrorException: unexpected token: ( required: )
桌子
CREATE TABLE IF NOT EXISTS t_device_event (
id bigint PRIMARY KEY,
device_id bigint NOT NULL,
latitude decimal NULL,
longitude decimal NULL,
message varchar(100) ,
date_received timestamp,
rssi float,
battery int,
alarm boolean,
processed boolean,
FOREIGN KEY (device_id) REFERENCES public.t_device(id));
“71”似乎是个问题。您可能需要“71”。问题在当前\u TIMESTAMP()上,您必须删除括号:
insert into T_DEVICE_EVENT (ID, DEVICE_ID, LATITUDE, LONGITUDE, MESSAGE, DATE_RECEIVED, RSSI, BATTERY, ALARM, PROCESSED) values (1,1,50.834015,4.377885,'71',CURRENT_TIMESTAMP,70,50,0,1);