Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 11th, 2007, 04:58 AM
mrtyler81 mrtyler81 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 9 mrtyler81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 10 sec
Reputation Power: 0
SQL error in Firebird 2.0

hi everybody



i use a software for business intelligence
this software has a warehouse built on a database
but i want to use firebird for datawarehouse

now this software i use needs some records
for expalme this query:


SELECT
concat(concat(WHTBLME.WHTBLME_CODICE,'§§'),WHTBLME.WHTBLME_DESCRIZIONE) AS D_001020_COD_TAB_ME,
concat(concat(WHTBLME.WHTBLME_DESCRIZIONE,'§§'),WHTBLME.WHTBLME_CODICE) AS K_D_001020_COD_TAB_ME,
concat(concat(WHART.WHART_CODICE,'§§'),WHART.WHART_DESCRIZIONE) AS D_001010_COD_ART,
concat(concat(WHART.WHART_DESCRIZIONE,'§§'),WHART.WHART_CODICE) AS K_D_001010_COD_ART,
sum( WHFMFAT.FMFAT_IMP_EUR ) AS M_000_001_VAL_FAT_EUR,
sum(0.0000000000) AS M_001_001_VAL_FAT_EUR
FROM
WHTBLME WHTBLME,
WHFMFAT WHFMFAT,
WHART WHART
WHERE
WHTBLME.WHTBLME_CODICE=WHFMFAT.FMFAT_TAB_ME AND WHTBLME.WHTBLME_DIT=WHFMFAT.FMFAT_DIT AND
cast(WHFMFAT.FMFAT_ART as char(15)) =WHART.WHART_CODICE AND WHART.WHART_DIT=cast(WHFMFAT.FMFAT_DIT as char(3)) AND
(WHFMFAT.FMFAT_DATE between {d '2006-01-01'} AND {d '2006-04-30'})
GROUP BY
WHTBLME.WHTBLME_CODICE,
WHTBLME.WHTBLME_DESCRIZIONE,
WHART.WHART_CODICE,
WHART.WHART_DESCRIZIONE

UNION ALL

SELECT
concat(concat(WHTBLME.WHTBLME_CODICE,'§§'),WHTBLME.WHTBLME_DESCRIZIONE) AS D_001020_COD_TAB_ME,
concat(concat(WHTBLME.WHTBLME_DESCRIZIONE,'§§'),WHTBLME.WHTBLME_CODICE) AS K_D_001020_COD_TAB_ME,
concat(concat(WHART.WHART_CODICE,'§§'),WHART.WHART_DESCRIZIONE) AS D_001010_COD_ART,
concat(concat(WHART.WHART_DESCRIZIONE,'§§'),WHART.WHART_CODICE) AS K_D_001010_COD_ART,
sum(0.0000000000) AS M_000_001_VAL_FAT_EUR,
sum( WHFMFAT.FMFAT_IMP_EUR ) AS M_001_001_VAL_FAT_EUR
FROM
WHTBLME WHTBLME,
WHFMFAT WHFMFAT,
WHART WHART
WHERE
WHTBLME.WHTBLME_CODICE=WHFMFAT.FMFAT_TAB_ME AND WHTBLME.WHTBLME_DIT=WHFMFAT.FMFAT_DIT AND
cast(WHFMFAT.FMFAT_ART as char(15)) =WHART.WHART_CODICE AND WHART.WHART_DIT=cast(WHFMFAT.FMFAT_DIT as char(3)) AND
(WHFMFAT.FMFAT_DATE between {d '2007-01-01'} AND {d '2007-04-30'})
GROUP BY
WHTBLME.WHTBLME_CODICE,
WHTBLME.WHTBLME_DESCRIZIONE,
WHART.WHART_CODICE,
WHART.WHART_DESCRIZIONE







the software didnt work because an error occurred


i pasted the query into Interbase & Firebird Sql Manager

and returns me this error

fmIBSQLScript.DataSet.SelectQuery:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 15, column 37.
'2006-01-01'.



i tried the same query with another date format, but doesnt work


by the way, the software successfull connect to the firebirdDB, indeed he let me explore the table records


please any suggest or help?


thanks a lot
Tony

Reply With Quote
  #2  
Old October 11th, 2007, 05:23 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,066 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 1 h 56 m 57 sec
Reputation Power: 281
First of all, use proper code formatting with or without syntax highlingting, then you have invalid chars in your query
sql Code:
Original - sql Code
  1. SELECT
  2. CONCAT(CONCAT(WHTBLME.WHTBLME_CODICE,'§§'),WHTBLME.WHTBLME_DESCRIZIONE) AS D_001020_COD_TAB_ME,
  3. CONCAT(CONCAT(WHTBLME.WHTBLME_DESCRIZIONE,'§§'),WHTBLME.WHTBLME_CODICE) AS K_D_001020_COD_TAB_ME,
  4. CONCAT(CONCAT(WHART.WHART_CODICE,'§§'),WHART.WHART_DESCRIZIONE) AS D_001010_COD_ART,
  5. CONCAT(CONCAT(WHART.WHART_DESCRIZIONE,'§§'),WHART.WHART_CODICE) AS K_D_001010_COD_ART,
  6. SUM( WHFMFAT.FMFAT_IMP_EUR ) AS M_000_001_VAL_FAT_EUR,
  7. SUM(0.0000000000) AS M_001_001_VAL_FAT_EUR
  8. FROM
  9. WHTBLME WHTBLME,
  10. WHFMFAT WHFMFAT,
  11. WHART WHART
  12. WHERE
  13. WHTBLME.WHTBLME_CODICE=WHFMFAT.FMFAT_TAB_ME AND WHTBLME.WHTBLME_DIT=WHFMFAT.FMFAT_DIT AND
  14. CAST(WHFMFAT.FMFAT_ART AS CHAR(15)) =WHART.WHART_CODICE AND WHART.WHART_DIT=CAST(WHFMFAT.FMFAT_DIT AS CHAR(3)) AND
  15. (WHFMFAT.FMFAT_DATE BETWEEN {d '2006-01-01'} AND {d '2006-04-30'})
  16. GROUP BY
  17. WHTBLME.WHTBLME_CODICE,
  18. WHTBLME.WHTBLME_DESCRIZIONE,
  19. WHART.WHART_CODICE,
  20. WHART.WHART_DESCRIZIONE
  21.  
  22. UNION ALL
  23.  
  24. SELECT
  25. CONCAT(CONCAT(WHTBLME.WHTBLME_CODICE,'§§'),WHTBLME.WHTBLME_DESCRIZIONE) AS D_001020_COD_TAB_ME,
  26. CONCAT(CONCAT(WHTBLME.WHTBLME_DESCRIZIONE,'§§'),WHTBLME.WHTBLME_CODICE) AS K_D_001020_COD_TAB_ME,
  27. CONCAT(CONCAT(WHART.WHART_CODICE,'§§'),WHART.WHART_DESCRIZIONE) AS D_001010_COD_ART,
  28. CONCAT(CONCAT(WHART.WHART_DESCRIZIONE,'§§'),WHART.WHART_CODICE) AS K_D_001010_COD_ART,
  29. SUM(0.0000000000) AS M_000_001_VAL_FAT_EUR,
  30. SUM( WHFMFAT.FMFAT_IMP_EUR ) AS M_001_001_VAL_FAT_EUR
  31. FROM
  32. WHTBLME WHTBLME,
  33. WHFMFAT WHFMFAT,
  34. WHART WHART
  35. WHERE
  36. WHTBLME.WHTBLME_CODICE=WHFMFAT.FMFAT_TAB_ME AND WHTBLME.WHTBLME_DIT=WHFMFAT.FMFAT_DIT AND
  37. CAST(WHFMFAT.FMFAT_ART AS CHAR(15)) =WHART.WHART_CODICE AND WHART.WHART_DIT=CAST(WHFMFAT.FMFAT_DIT AS CHAR(3)) AND
  38. (WHFMFAT.FMFAT_DATE BETWEEN {d '2007-01-01'} AND {d '2007-04-30'})
  39. GROUP BY
  40. WHTBLME.WHTBLME_CODICE,
  41. WHTBLME.WHTBLME_DESCRIZIONE,
  42. WHART.WHART_CODICE,
  43. WHART.WHART_DESCRIZIONE
Those are {d and the closing one, that's not the way to write the between

Reply With Quote
  #3  
Old October 11th, 2007, 05:57 AM
mrtyler81 mrtyler81 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 9 mrtyler81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 10 sec
Reputation Power: 0
thanks but...

now seems that there is another problem


fmIBSQLScript.DataSet.SelectQuery:
An error was found in the application program input parameters for the SQL statement. Dynamic SQL Error.
SQL error code = .804.
Function unknown.
CONCAT.




is there any list of all SQL commands that are not supported by Firebird 2.0?




thanks again buddies

Reply With Quote
  #4  
Old October 11th, 2007, 06:38 AM
mrtyler81 mrtyler81 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 9 mrtyler81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 10 sec
Reputation Power: 0
oops...

sorry

i'm really a noob



i made the correction

i used

(WHTBLME.WHTBLME_CODICE+'§§'+WHTBLME.WHTBLME_DESCRIZIONE) AS D_001020_COD_TAB_ME,
(WHTBLME.WHTBLME_DESCRIZIONE+'§§'+WHTBLME.WHTBLME_CODICE) AS K_D_001020_COD_TAB_ME,
(WHART.WHART_CODICE+'§§'+WHART.WHART_DESCRIZIONE) AS D_001010_COD_ART,
(WHART.WHART_DESCRIZIONE+'§§'+WHART.WHART_CODICE) AS K_D_001010_COD_ART,


instead of the CONCAT command


but anyway... now there is another error...

is it correct to use +???




thanks again

Reply With Quote
  #5  
Old October 11th, 2007, 06:54 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,066 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 1 h 56 m 57 sec
Reputation Power: 281
Would you mind telling us from which database are you porting this query to Firebird?
Note that the SQL standard concatenation operator is ||

Reply With Quote
  #6  
Old October 11th, 2007, 07:21 AM
mrtyler81 mrtyler81 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 9 mrtyler81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 10 sec
Reputation Power: 0
i cannot use +???

Reply With Quote
  #7  
Old October 11th, 2007, 07:23 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,066 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 1 h 56 m 57 sec
Reputation Power: 281
Did you answer my questions?

Reply With Quote
  #8  
Old October 11th, 2007, 07:51 AM
mrtyler81 mrtyler81 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 9 mrtyler81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 10 sec
Reputation Power: 0
sorry, i forgot to answer


it's a software that generates SQL queries


this queries are supported by DBmaker

Reply With Quote
  #9  
Old October 11th, 2007, 08:47 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,066 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 1 h 56 m 57 sec
Reputation Power: 281
Quote:
Originally Posted by mrtyler81
i cannot use +???
No, use the standard concatenation operator.

Reply With Quote
  #10  
Old October 11th, 2007, 11:43 AM
mrtyler81 mrtyler81 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 9 mrtyler81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 10 sec
Reputation Power: 0
really thanks a lot

i solved my problem




thaaanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > SQL error in Firebird 2.0


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump