you'll need to use dynamic sql to execute statements with analytics in them.
It's a limitation of the pro*c syntax checking.
Main Topics
Browse All TopicsI have a proc*c program i add on a request a analytic function using over ( order by 1 ) .
When i compile i have this output .( sorry fo the english speakers )
proc sqlcheck=syntax userid=ter/ter MODE=ORACLE CODE=ANSI_C LINES=NO INCLUDE=/util/include INCLUDE=/glv_projets/ncgtp
Pro*C/C++: Release 9.2.0.4.0 - Production on Je Jul 31 15:08:00 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Valeurs des options système par défaut extraites de : /moteurs/oracle/product/09
PCC-I-02106, Nom utilisateur réservé ` SQLCHECK = FULL; nom utilisateur non pris en compte.
Erreur de syntaxe en ligne 2295, colonne 22, fichier ./bfter_traitement_p1p3_.p
Erreur à la ligne 2295, colonne 22 dans le fichier ./bfter_traitement_p1p3_.p
count(*) over (order by 1) nombre_p3_resultants
.....................1
PCC-S-02201, Symbole "over" rencontré à la place d'un des symboles suivants :
) * + - / | at, day, hour, minute, month, second, year,
my pcscfg.cfg is:
sys_include=(/usr/include,
ltype=short
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi DrSQK: This is the request is:
SELECT t3a.libelle_oremie, a.SEGMENT, a.num_p3, SUM (a.nb_uo),
SUM (a.tarif * a.nb_uo),count(*) over ( order by 1) nombre_totale
FROM ter_detail_p3_facture a, ter_ref_tr3a t3a
WHERE a.date_jour >= TO_DATE ('01/06/2008', 'dd/mm/yyyy')
AND a.date_jour <= TO_DATE ('30/06/2008', 'dd/mm/yyyy')
AND a.code_tct IN (SELECT DISTINCT code_tct
FROM ter_ref_tct
WHERE client = 'TER Bourgogne')
AND t3a.code_localite_tt0020 = a.tt0020
AND t3a.region_ter = 'AU03'
AND t3a.num_ordre = (SELECT MAX (num_ordre)
FROM ter_ref_tr3a
WHERE a.tt0020 = code_localite_tt0020)
GROUP BY t3a.libelle_oremie, a.num_p3, a.SEGMENT
ah ok, but I'd really be surprised if that worked, that seems like it's just moving the problem around.
plus, I don't think it will anyway. the pro*c compiler doesn't like the "over" clause.
like I said at the beginning, it's a syntax limitation of the pre compiler itself. You have to use dynamic sql to get analytics to work so the statement won't be parsed until runtime and then by the db server, not the proc pre compiler.
I REALLY, REALLY wish the unified parser had been introduced earlier and was universal and it would be nice if really were "unified" too.
I've run into this limitation in pro*c and pl/sql too on lots of occasions in db versions 8 through 11.
Even in 11 the syntax isn't fully shared between sql and pl/sql. But at least the pro*c compiler is more up-to-date.
DrSQL,
This is the result of your request:
libelle_oremie segment num_p3 sum_nb_uo sum_ab_no_tarif nombre_totale
RIOM A 1 0 0 3146
RIOM A 2 0 0 3146
RIOM A 3 0 0 3146
RIOM A 4 0 0 3146
RIOM A 5 0 0 3146
RIOM A 6 0 0 3146
RIOM A 7 0 0 3146
RIOM A 8 4 23.92 3146
RIOM A 9 0 0 3146
RIOM A 10 0 0 3146
RIOM A 11 0 0 3146
RIOM A 12 0 0 3146
RIOM A 13 0 0 3146
DOMPIERRE SEPT FONS C 1 0 0 3146
DOMPIERRE SEPT FONS C 2 0 0 3146
DOMPIERRE SEPT FONS C 3 0 0 3146
DOMPIERRE SEPT FONS C 4 0 0 3146
DOMPIERRE SEPT FONS C 5 0 0 3146
DOMPIERRE SEPT FONS C 6 0 0 3146
DOMPIERRE SEPT FONS C 7 0 0 3146
DOMPIERRE SEPT FONS C 8 234 1464.84 3146
DOMPIERRE SEPT FONS C 9 0 0 3146
DOMPIERRE SEPT FONS C 10 0 0 3146
DOMPIERRE SEPT FONS C 11 0 0 3146
DOMPIERRE SEPT FONS C 12 0 0 3146
DOMPIERRE SEPT FONS C 13 0 0 3146
SAINT GERMAIN DES FOSSES B 1 0 0 3146
SAINT GERMAIN DES FOSSES B 2 0 0 3146
SAINT GERMAIN DES FOSSES B 3 0 0 3146
SAINT GERMAIN DES FOSSES B 4 0 0 3146
SAINT GERMAIN DES FOSSES B 5 0 0 3146
SAINT GERMAIN DES FOSSES B 6 0 0 3146
SAINT GERMAIN DES FOSSES B 7 0 0 3146
SAINT GERMAIN DES FOSSES B 8 4 24.04 3146
SAINT GERMAIN DES FOSSES B 9 0 0 3146
SAINT GERMAIN DES FOSSES B 10 0 0 3146
SAINT GERMAIN DES FOSSES B 11 0 0 3146
SAINT GERMAIN DES FOSSES B 12 0 0 3146
SAINT GERMAIN DES FOSSES B 13 0 0 3146
And this is the result of mine:
libelle_oremie segment num_p3 sum(a.nb_uo) sum(a.tarif*a.nb_uo) nombre_totale
RIOM A 1 0 0 39
RIOM A 2 0 0 39
RIOM A 3 0 0 39
RIOM A 4 0 0 39
RIOM A 5 0 0 39
RIOM A 6 0 0 39
RIOM A 7 0 0 39
RIOM A 8 4 23.92 39
RIOM A 9 0 0 39
RIOM A 10 0 0 39
RIOM A 11 0 0 39
RIOM A 12 0 0 39
RIOM A 13 0 0 39
DOMPIERRE SEPT FONS C 1 0 0 39
DOMPIERRE SEPT FONS C 2 0 0 39
DOMPIERRE SEPT FONS C 3 0 0 39
DOMPIERRE SEPT FONS C 4 0 0 39
DOMPIERRE SEPT FONS C 5 0 0 39
DOMPIERRE SEPT FONS C 6 0 0 39
DOMPIERRE SEPT FONS C 7 0 0 39
DOMPIERRE SEPT FONS C 8 234 1464.84 39
DOMPIERRE SEPT FONS C 9 0 0 39
DOMPIERRE SEPT FONS C 10 0 0 39
DOMPIERRE SEPT FONS C 11 0 0 39
DOMPIERRE SEPT FONS C 12 0 0 39
DOMPIERRE SEPT FONS C 13 0 0 39
SAINT GERMAIN DES FOSSES B 1 0 0 39
SAINT GERMAIN DES FOSSES B 2 0 0 39
SAINT GERMAIN DES FOSSES B 3 0 0 39
SAINT GERMAIN DES FOSSES B 4 0 0 39
SAINT GERMAIN DES FOSSES B 5 0 0 39
SAINT GERMAIN DES FOSSES B 6 0 0 39
SAINT GERMAIN DES FOSSES B 7 0 0 39
SAINT GERMAIN DES FOSSES B 8 4 24.04 39
SAINT GERMAIN DES FOSSES B 9 0 0 39
SAINT GERMAIN DES FOSSES B 10 0 0 39
SAINT GERMAIN DES FOSSES B 11 0 0 39
SAINT GERMAIN DES FOSSES B 12 0 0 39
SAINT GERMAIN DES FOSSES B 13 0 0 39
your current code probably looks something like
EXEC SQL DECLARE your_cursor CURSOR FOR
select ......;
EXEC SQL OPEN your_cursor;
then fetch, process and close.
instead, change it to...
strcpy(sql_string,"select.
EXEC SQL PREPARE sql_statement FROM :sql_string;
EXEC SQL DECLARE your_cursor CURSOR FOR sql_statement;
EXEC SQL OPEN your_cursor;
then fetch, process and close.
basically you just add 1 line, the "prepare" and move the sql text into a c string instead of embedding it in the declare.
Business Accounts
Answer for Membership
by: DrSQLPosted on 2008-07-31 at 07:29:34ID: 22130022
Can you show us the full SQL? It may be pointing at the "over", but it might be confused by something else.
Good luck!