View previous topic :: View next topic
|
Author |
Message |
kalaikala
New User
Joined: 21 Jul 2007 Posts: 27 Location: Chennai
|
|
|
|
Hi priyesh,
I have used the below CURSOR declaration with "WITH CLAUSE".
If i use this query in SPUFI its working fine. But in application program i am getting pre-compiler error message as below:
"INVALID,KEYWORD "ORDER"; VALID SYMBOLS ARE: ) UNION EXCEPT"
QUERY:
DECLARE ACCOUNT-CURSOR CURSOR FOR
WITH POS_Name1
(Column_1,Column_2,Column_3) AS
(SELECT Column_1,Column_2,Column_3
FROM Table1 T1
WHERE Column_4 = 'XXXXXXXX'
AND Column_3 <> 0)
,Pos_Name2(V_Col1) AS
(SELECT V1.V_Col1
FROM View1 V1
WHERE V1.V_Col2 = 'YY'
AND v1.V_Col3 = 'XXXXXXXX'
AND v1.V_Col4 = 1
ORDER BY v1.V_Col5 DESC
,v1.V_Col6 DESC
FETCH FIRST ROW ONLY)
SELECT T1.Column_1,T1.Column_2,T1.Column_3,v1.V_Col1
FROM POS_Name1 T1,POS_Name2 V1
Can any you help me in this. |
|
Back to top |
|
|
manikumar_711 Currently Banned New User
Joined: 11 Sep 2007 Posts: 7 Location: Chennai
|
|
|
|
Hi kalaikala ,
I heared ur name in somewhere else. can you check your query again. some small mistakes u did it. syntax, , : like this .
Thanks & Regards,
MANIKUMAR |
|
Back to top |
|
|
kalaikala
New User
Joined: 21 Jul 2007 Posts: 27 Location: Chennai
|
|
|
|
Hi Mani,
If i remove below code then its working fine.
ORDER BY v1.V_Col5 DESC
,v1.V_Col6 DESC
FETCH FIRST ROW ONLY |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
WITH clause is used to construct and MQT ...
use ORDER BY v1.V_Col5 DESC
,v1.V_Col6 DESC
FETCH FIRST ROW ONLY)
in your select clause ... |
|
Back to top |
|
|
ascelepius
New User
Joined: 16 Jun 2008 Posts: 35 Location: bangalore
|
|
|
|
Correction ashimer, thats a CTE(Common Table Expression) not an MQT...
regards,
asci(i) |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
You are right asci ... Sorry for the typo ... |
|
Back to top |
|
|
|