Home » Developer & Programmer » Precompilers, OCI & OCCI » Pro *C compiler error when using NULLS LAST... Help needed
Pro *C compiler error when using NULLS LAST... Help needed [message #218194] Wed, 07 February 2007 04:13 Go to next message
krishna.piska
Messages: 4
Registered: February 2007
Junior Member
Hi

I am a newbie here and need some help in a problem that I am facing...

I have the following query:
Select * from Employee Order by JOIN_DATE DESC NULLS LAST;

I want the sorting to be done in descending order but want the NULLS to be considered last.

This query works fine when running in SQL editor (Toad). But when I put it in a ppc file and compile it I get the following error:
Pro*C/C++: Release 10.2.0.2.0 - Production on Wed Feb 7 12:11:18 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

System default option values taken from: /oravl01/oracle/10.2.0.2/precomp/admin/pcscfg.cfg

Syntax error at line 425, column 25, file dbscore_gt_gl_Codes.pc:
Error at line 425, column 25 in file dbscore_gt_gl_Codes.pc
NR_PARAM_4_ID DESC NULLS FIRST;
........................1
PCC-S-02201, Encountered the symbol "NULLS" when expecting one of the following:

; , for, order,


Is there a limitation in Pro *C that it doesn't identify NULLS LAST option in ORDER BY clause?
Can someone please enlighten me in this regard?

Thanks in advance
Krishna
Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218201 is a reply to message #218194] Wed, 07 February 2007 05:00 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Quote:
I have the following query:
Select * from Employee Order by JOIN_DATE DESC NULLS LAST;


Ok that's fine, but if you

Select * from Employee Order by JOIN_DATE DESC NULLS FIRST
That will fail..

And according to your error
Quote:
Syntax error at line 425, column 25, file dbscore_gt_gl_Codes.pc:
Error at line 425, column 25 in file dbscore_gt_gl_Codes.pc
NR_PARAM_4_ID DESC NULLS FIRST;


You have DESC NULLS FIRST....can you verfiy this ?
Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218203 is a reply to message #218201] Wed, 07 February 2007 05:09 Go to previous messageGo to next message
krishna.piska
Messages: 4
Registered: February 2007
Junior Member
My mistake...

I was trying with DESC NULLS FIRST also and copied that error when posting it here.

Basically I get the same error when I use LAST or FIRST...
The error when I use DESC NULLS LAST is below:
Pro*C/C++: Release 10.2.0.2.0 - Production on Wed Feb 7 13:09:02 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

System default option values taken from: /oravl01/oracle/10.2.0.2/precomp/admin/pcscfg.cfg

Syntax error at line 425, column 25, file dbscore_gt_gl_Codes.pc:
Error at line 425, column 25 in file dbscore_gt_gl_Codes.pc
NR_PARAM_4_ID DESC NULLS LAST;
........................1
PCC-S-02201, Encountered the symbol "NULLS" when expecting one of the following:

; , for, order,
Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218211 is a reply to message #218203] Wed, 07 February 2007 05:50 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Is that the completr error code, you dont get
PCC-F-02102, Fatal error while doing C preprocessing
*** Error exit code 1
as well ?

I might be the syntax, since the precompiler parser doesnt understand all sql constructions.

Have a look on metalink also read into
Pro*C Precompilers Programmers Guide.

[Updated on: Wed, 07 February 2007 05:51]

Report message to a moderator

Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218212 is a reply to message #218211] Wed, 07 February 2007 05:58 Go to previous messageGo to next message
krishna.piska
Messages: 4
Registered: February 2007
Junior Member
I get the fatal error also but I did not list it out here...

Here is the complete error:
Syntax error at line 425, column 25, file dbscore_gt_gl_Codes.pc:
Error at line 425, column 25 in file dbscore_gt_gl_Codes.pc
NR_PARAM_4_ID DESC NULLS LAST;
........................1
PCC-S-02201, Encountered the symbol "NULLS" when expecting one of the following:

; , for, order,

Syntax error at line 0, column 0, file dbscore_gt_gl_Codes.pc:
Error at line 0, column 0 in file dbscore_gt_gl_Codes.pc
PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the following:

; : an identifier, end-exec, random_terminal

Error at line 0, column 0 in file dbscore_gt_gl_Codes.pc
PCC-F-02102, Fatal error while doing C preprocessing


I tried removing the NULLS LAST part and it compiles without any error. So I dont think there are any syntax problems apart from NULLS LAST.

I did not understand when you said "Have a look on metalink". Can you elaborate?

Thanks for the help...
Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218268 is a reply to message #218212] Wed, 07 February 2007 09:59 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Metalink well thats Oracle's Web support service.
With alot of information which might help you.
Metalink
A must have ... almost Wink

If you have a DBA they probably have an account there.

Quote:
I tried removing the NULLS LAST and it compiles without any error


Well like i mentioned in the previous post, the precompiler parser doesnt understand all sql constructions.


Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218660 is a reply to message #218268] Fri, 09 February 2007 03:51 Go to previous messageGo to next message
krishna.piska
Messages: 4
Registered: February 2007
Junior Member
Found out some info. Thought I would post here.

It is a limitation in Pro C 9.0.1. It doesn't recognize the new constructs introduced in Oracle 9i.

Either I have to upgrade the Pro C or use dynamic statements so that the pre-compiler doesn't give me the syntax errors...

The solution I am going for is to use NVL in the ORDER BY clause for the column. Replace the NULL value with a value that I know will come last when ordering by descending...

Thanks again for the help.
icon14.gif  Re: Pro *C compiler error when using NULLS LAST... Help needed [message #218673 is a reply to message #218660] Fri, 09 February 2007 04:48 Go to previous message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

No Message Body
Previous Topic: libwtc9.so, needed by libclntsh.so, not found (try using -rpath or -rpath)
Next Topic: OCI profiler
Goto Forum:
  


Current Time: Wed Dec 11 22:59:33 CST 2024