markthegrea
markthegrea

Reputation: 3851

How do I create a specific date in HSQLDB?

I need to create a HIGH date in HSQLDB and the solution is eluding me. I need something like

Date(9999-12-31 0:0:0)

but I cannot find a function or whatever to do it. I am loding the date via Spring on startup and i need something like:

insert intoMOD (
  ITM_INST_ELECTR_MOD_STRT_TS,
  ITM_INST_ID,
  ELECTR_MOD_ID,
  ITM_INST_ELECTR_MOD_END_TS
) VALUES (
  CURRENT_DATE,
  0,
  0,
  Date(9999-12-31 0:0:0)
)

What is the way to create a specific data using SQL in Hypersonic?

Upvotes: 13

Views: 21328

Answers (2)

Thiago Santana
Thiago Santana

Reputation: 51

I was struggling with this problem and I think that I can contribute to help some other people.

Here is the insert that you need to put on your script while loading hsqldb:

insert intoMOD (
  ITM_INST_ELECTR_MOD_STRT_TS,
  ITM_INST_ID,
  ELECTR_MOD_ID,
  ITM_INST_ELECTR_MOD_END_TS
) VALUES (
  CURRENT_DATE,
  0,
  0,
  '9999-12-31'
)

HSQLDB converts the string automatically.

I tested with latest version (2.3.3).

Upvotes: 5

Jon Skeet
Jon Skeet

Reputation: 1501163

Given the user guide, I'd expect the following to work:

DATE '9999-12-31'

or, if you need more than day precision:

TIMESTAMP '9999-12-31 00:00:00'

Upvotes: 18

Related Questions