Operating System - HP-UX
1753666 Members
6216 Online
108799 Solutions
New Discussion

Pro*C - PERCENT_RANK() compilation issue

 
Kumar Babu
New Member

Pro*C - PERCENT_RANK() compilation issue

Hello,

I have a pro*C compilation issue, while using PERCENT_RANK() in-built function.

Here are the details :

The Pro*C code :

================================================== ========

int srccct2_insert()
{

EXEC SQL
select * from (
select
trad_code,
comp_code,
file_code,
insp_yymm,
poly_numb,
entr_numb,
data_code,
caus_date,
insd_code,
rule_ordr,
sex_code,
entr_age,
resd_numb,
entr_name,
hire_date,
entr_date,
work_year,
hire_grad,
datt_entr,
ijry_entr,
wkdt_entr,
base_saly,
expt_amnt,
rsrv_rato,
rsrv_amnt,
PERCENT_RANK() OVER (ORDER BY base_saly) pr
FROM SRCCCT2
where trad_code = 'N' AND
comp_code = '01' AND
insp_yymm = '200403' AND
data_code = 'B' AND
hire_grad = '2' AND
base_saly > 0)
where pr > 0.05 and pr < 0.95 and base_saly > 641840;

return SUCCESS;
}

================================================== ======

I am compiling it like this :

/oracle/product/10.2.0/bin/proc iname=srascs01.pc ireclen=320 oreclen=320 sqlcheck=full userid=retr/rteru maxopencursors=32 dbms=v8 char_map=varchar2 release_cursor=yes include=/oracle/product/10.2.0/precomp/public include=/ihome/hp/../common/include include=/ihome/retr/include include=/usr/include include=/ihome/hp/portlib DEFINE=HPUX

I have put the same sql statements in the sql promt and it works fine. But in Pro*C when i compile it using above options, here is the error :

================================================== ======

Pro*C/C++: Release 10.2.0.4.0 - Production on Thu Feb 25 00:57:42 2010

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

System default option values taken from: /oracle/product/10.2.0/precomp/admin/pcscfg.cfg

Syntax error at line 192, column 28, file srascs01.pc:
Error at line 192, column 28 in file srascs01.pc
PERCENT_RANK() OVER (ORDER BY base_saly) pr
...........................1
PCC-S-02201, Encountered the symbol "(" when expecting one of the following:

, into, from,

Error at line 0, column 0 in file srascs01.pc
PCC-F-02102, Fatal error while doing C preprocessing
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
================================================== =======

The Pro*C precompiler might not be recognizing the PERCENT_RANK() function for some reason, so it is expecting "into" "from" for the SELECT statement above.

Please help me in solving this issue.

Thanks a ton in advance.

Thanks,
-Kumar