Subject | Re: [firebird-support] Insert an ORDERED SELECT |
---|---|
Author | Martijn Tonies |
Post date | 2007-03-28T10:51:28Z |
Hi,
Unless you're using ROWS, what is the point of ORDERing?
None whatsoever. So just drop the ORDER By clause.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Hi! is there any restriction in InterBase 7.5 regarding the <select_expr> of
an INSERT statement?
I get an error in the ORDER BY part of the <select_expr>
I've read the specifications here (they are about 6.0 version) and says
nothing about the ORDER BY of the SELECT
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_download_documentation
Here's the query, if I run the SELECT part without INSERT it works fine,
but when I run this query I get the error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 16, char -1.
ORDER
If I delete the ORDER BY part it also works fine and inserts it unordered
INSERT INTO TEMPORALPRUEBA1
(TEMPORALPRUEBA1.CLIENTID, TEMPORALPRUEBA1.DATE2, TEMPORALPRUEBA1.DATE1)
SELECT
TRACTAMENTS.C_HISTORIA,
TRACTAMENTS.DATA_INGRES,
TRACTAMENTS.DATA_ALTA
FROM
TRACTAMENTS
WHERE
(TRACTAMENTS.C_HISTORIA >= 5000 And TRACTAMENTS.C_HISTORIA <= 5044)
AND
((TRACTAMENTS.C_PRESTACIO = 1004 AND
TRACTAMENTS.C_MOTIU = "2" )OR
(TRACTAMENTS.C_PRESTACIO = 2014 AND
TRACTAMENTS.C_MOTIU = "8"))
ORDER BY
TRACTAMENTS.C_HISTORIA
---------------------------------
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
[Non-text portions of this message have been removed]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
Unless you're using ROWS, what is the point of ORDERing?
None whatsoever. So just drop the ORDER By clause.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Hi! is there any restriction in InterBase 7.5 regarding the <select_expr> of
an INSERT statement?
I get an error in the ORDER BY part of the <select_expr>
I've read the specifications here (they are about 6.0 version) and says
nothing about the ORDER BY of the SELECT
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_download_documentation
Here's the query, if I run the SELECT part without INSERT it works fine,
but when I run this query I get the error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 16, char -1.
ORDER
If I delete the ORDER BY part it also works fine and inserts it unordered
INSERT INTO TEMPORALPRUEBA1
(TEMPORALPRUEBA1.CLIENTID, TEMPORALPRUEBA1.DATE2, TEMPORALPRUEBA1.DATE1)
SELECT
TRACTAMENTS.C_HISTORIA,
TRACTAMENTS.DATA_INGRES,
TRACTAMENTS.DATA_ALTA
FROM
TRACTAMENTS
WHERE
(TRACTAMENTS.C_HISTORIA >= 5000 And TRACTAMENTS.C_HISTORIA <= 5044)
AND
((TRACTAMENTS.C_PRESTACIO = 1004 AND
TRACTAMENTS.C_MOTIU = "2" )OR
(TRACTAMENTS.C_PRESTACIO = 2014 AND
TRACTAMENTS.C_MOTIU = "8"))
ORDER BY
TRACTAMENTS.C_HISTORIA
---------------------------------
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
[Non-text portions of this message have been removed]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links