[Solved] Syntax error if query run from F5 Edit window

Creating tables and queries
Post Reply
User avatar
charlie.it
Volunteer
Posts: 417
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

[Solved] Syntax error if query run from F5 Edit window

Post by charlie.it »

Hello everyone, the query of this embedded HSQLDB database works if executed directly or if executed from the Edit window in SQL view (F5). If executed instead from the Edit window (F5) it gives me syntax error. I don't understand why, can you help me? My OS and LibreOffice versions are the ones in my signature below. Thank you.

Code: Select all

SELECT "ID", CAST( ( ( "Anni" * 12.00 + "Mesi" + DATEDIFF( 'mm', "Data_Registr", NOW( ) ) ) / 12 ) AS INTEGER ) AS "Anni attuali", MOD( "Anni" * 12.00 + "Mesi" + DATEDIFF( 'mm', "Data_Registr", NOW( ) ), 12 ) AS "Mesi Attuali" FROM "Pazienti"
 Edit: Changed subject, was Query Issue 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Attachments
Test.odb
(13.11 KiB) Downloaded 200 times
Screenshot 2023-10-27 alle 08.29.59.png
Screenshot 2023-10-27 alle 08.29.59.png (61.21 KiB) Viewed 3744 times
Last edited by charlie.it on Mon Oct 30, 2023 12:30 pm, edited 2 times in total.
charlie
Italian AOO Admin
macOS 14 Sonoma M1: Open Office 4.1.15 - LibreOffice 7.5.7.1

http://www.charlieopenoffice.altervista.org
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Query Issue

Post by Villeroy »

I can run the query in parsed mode and in direct SQL. Only the query designer has a problem with it. Just keep it in SQL view and everything should be fine.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
charlie.it
Volunteer
Posts: 417
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

Re: Query Issue

Post by charlie.it »

Thanks for your reply, my query behaves as you said. But is this normal, is there a function that the query design doesn't support? CAST? DATEDIFF? MOD? I had already used them in the past but I didn't realize that they caused problems in design mode.

Update: it seems that query design doesn't support MOD, if I erase it, all works.
charlie
Italian AOO Admin
macOS 14 Sonoma M1: Open Office 4.1.15 - LibreOffice 7.5.7.1

http://www.charlieopenoffice.altervista.org
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Query Issue

Post by UnklDonald418 »

I’ve tried right clicking on your query, selecting Edit to open in the Query Design GUI and when I press F5 it displays the results without any error messages.
SS01.png
SS01.png (21.07 KiB) Viewed 3580 times
I get the same results
Windows 10
OO 4.1.14
LO 7.4.5.1 (x64)

Linux Mint
LO 6.4.7.2

Perhaps a platform issue?
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Nick N,
Posts: 140
Joined: Wed Aug 09, 2023 2:10 pm

Re: Syntax error if query run from F5 Edit window

Post by Nick N, »

Hello Charlie,

I've tested your query on AOO 4.1.14 and did not encounter any problem either ways too.

Here is the result.

Regards

Nick
Attachments
Charlie's query.PNG
Charlie's query.PNG (3.72 KiB) Viewed 3474 times
Libre Office 6.0.7 on Ubuntu 18.04
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Syntax error if query run from F5 Edit window

Post by RPG »

I have the idea that you can solve your problems when you change 12.00 in 12.
I think the problem is in: double value's and integer values in one field.
I also agree with Villeroy.
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
User avatar
charlie.it
Volunteer
Posts: 417
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

Re: Syntax error if query run from F5 Edit window

Post by charlie.it »

Thanks @RPG, yours is the right solution, congratulations, bravo! :super:
Anyway, thanks to everyone for testing and for your suggestions.
charlie
Italian AOO Admin
macOS 14 Sonoma M1: Open Office 4.1.15 - LibreOffice 7.5.7.1

http://www.charlieopenoffice.altervista.org
Post Reply