[Solved] [HSQLDB] SQL statement vs Wrong data type

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
oonk
Posts: 23
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

[Solved] [HSQLDB] SQL statement vs Wrong data type

Post by oonk »

What is the mistake in SQL ?
Screenshot_20191101_111827.jpg
Screenshot_20191101_111956.jpg
Screenshot_20191101_114600.jpg
Last edited by Hagar Delest on Fri Nov 01, 2019 12:16 pm, edited 1 time in total.
Reason: tagged solved
| Fedora 31 Workstation Cinnamon of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded Firebird |
FJCC
Moderator
Posts: 9278
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: BASIC|HSQLDB| SQL statement vs Wrong data type

Post by FJCC »

Your last image seems to show that EffectiveDate is being passed as the string '10/08/2019' and that is not a valid date format for HSQLDB, if I remember correctly. I think it must have the format 2019-10-08 or maybe 2019-10-08 00:00:00. I see that in your code you try to set the format but the error message suggests that is not working as expected.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
oonk
Posts: 23
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

Re: BASIC|HSQLDB| SQL statement vs Wrong data type

Post by oonk »

FJCC wrote:Your last image seems to show that EffectiveDate is being passed as the string '10/08/2019' and that is not a valid date format for HSQLDB, if I remember correctly. I think it must have the format 2019-10-08 or maybe 2019-10-08 00:00:00. I see that in your code you try to set the format but the error message suggests that is not working as expected.
That works with embedded Firebird of LibreOffice Base.

Thank you so much for your recommendation.
Finally, I found the way for HSQLDB.

Code: Select all

'	https://stackoverflow.com/questions/13141328/how-do-i-create-a-specific-date-in-hsqldb
'       HSQLDB converts the string automatically.
	Dim fed As String			: fed = Year(ed) & "-" & Month(ed) & "-" & Day(ed)
That's ok.
| Fedora 31 Workstation Cinnamon of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded Firebird |
Ratslinger
Posts: 34
Joined: Sun Mar 01, 2015 3:34 am

Re: [Solved] [HSQLDB] SQL statement vs Wrong data type

Post by Ratslinger »

This was also posted and answered here -> https://ask.libreoffice.org/en/question ... data-type/
LibreOffice 7.0.2.2
OpenOffice 4.0.1
Ubuntu Mate 20.04.1
Mint 20.3
Post Reply