Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 无法执行H2语句_Sql_H2 - Fatal编程技术网

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

我在嵌入式数据库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.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);