I have this table
我有这个表
-- table T_TIME_LAPSE H2 Database Engine
CREATE TABLE IF NOT EXISTS t_time_lapse (
id bigint PRIMARY KEY,
name varchar(50) NOT NULL,
description varchar(200) NOT NULL,
sunday boolean DEFAULT NULL,
monday boolean DEFAULT NULL,
tuesday boolean DEFAULT NULL,
wednesday boolean DEFAULT NULL,
thursday boolean DEFAULT NULL,
friday boolean DEFAULT NULL,
saturday boolean DEFAULT NULL,
init_period date NOT NULL ,
end_period date NOT NULL ,
init_time time DEFAULT NULL,
end_time time DEFAULT NULL,
company_id bigint DEFAULT NULL,
);
Where I try to insert values of TIME Type (* the date data type. The format is yyyy-MM-dd.Mapped to java.sql.Date, with the time set to 00:00:00 (or to the next possible time if midnight doesn't exist for the given date and timezone due to a daylight saving change).)
在这里我尝试插入时间类型的值(*日期数据类型)。yyyy-MM-dd格式。映射到java.sql。日期,时间被设定为00:00(或者如果由于夏令时的改变,指定的日期和时区没有午夜的话,可以选择下一个可能的时间)。
-- table t_time_lapse
insert into T_TIME_LAPSE (ID, NAME, DESCRIPTION, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY, INIT_PERIOD, END_PERIOD, INIT_TIME, END_TIME, COMPANY_ID)
values (1777,'key', 'key', 1,1,1,1,1,1,1,CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, PARSEDATETIME('12:22','HH:mm'), PARSEDATETIME('16:22','HH:mm'), 1);
but I got this error
但是我得到了这个错误
Function "PARSEDATETIME" not found; SQL statement:
1 个解决方案
#1
2
You have an error in your Syntax you miss the ''
in your query
你的语法有错误,你错过了“在你的查询”
PARSEDATETIME('16:22', 'HH:MM'), 1)
//---------------------^-----^
Check the syntax how it should be your date with H2 parsedatetime
检查语法如何使用H2 parsedatetime作为您的日期
so your query should end like this :
所以你的查询应该这样结束:
..., PARSEDATETIME('12:22', 'HH:mm'), PARSEDATETIME('16:22', 'HH:mm'), 1));
#1
2
You have an error in your Syntax you miss the ''
in your query
你的语法有错误,你错过了“在你的查询”
PARSEDATETIME('16:22', 'HH:MM'), 1)
//---------------------^-----^
Check the syntax how it should be your date with H2 parsedatetime
检查语法如何使用H2 parsedatetime作为您的日期
so your query should end like this :
所以你的查询应该这样结束:
..., PARSEDATETIME('12:22', 'HH:mm'), PARSEDATETIME('16:22', 'HH:mm'), 1));