오라클 버젼 9.0.1 사용중인데여...
전에 9i 부터는 ProC와 PL/SQL에서 Analytic Function 사용할수 있다고
들은거 같은데....
안되네여... 계속 Analytic Function 절에.. 컴파일 에러
오라클9i 관련자료를 알고계시거나... 아시는 분은 답변좀 부탁드립니다.
에러내역이나 코드를 올려주시지요..^^;;
에러코드야.. 당연 Syntex Error져...
Syntax error at line 42, column 35, file TEST.pc:
Error at line 42, column 35 in file TEST.pc
SELECT ID, COUNT(*) OVER () CNT
..................................1
PCC-S-02201, Encountered the symbol "(" when expecting one of the following:
관련자료 :
Problem Description -------------------
Trying to use new sql syntax features introduced in 9i fails in pro*c programs and getting the corresponding precompilation errors:
------- EXEC SQL DECLARE c1 CURSOR FOR select job,SUM(CASE WHEN job='CLERK' then sal else sal*10 end) from emp group by job; ------- $ proc iname=programname.pc PCC-S-02201, Encountered the symbol "WHEN" when expecting one of the following:( ) * + - / . @ | at, day, hour, minute, month, second, year,
Solution Description --------------------
There are two solutions: 1- use dynamic sql methods; following is an example with dynamic sql method 3 (see pro*c dynamic sql samples: sample6.pc sample7.pc and sample8.pc from $ORACLE_HOME/precomp/demo/proc) ------------------- /* in your pc program */ VARCHAR dynstmt[80]; ... ... ... void main() { ... ... strcpy((char *)dynstmt.arr, "select job,SUM(CASE WHEN job='CLERK' then sal else sal*10 end) from emp group by job"); dynstmt.len = (unsigned short)strlen((char *)dynstmt.arr); EXEC SQL PREPARE S FROM :dynstmt; EXEC SQL DECLARE C CURSOR FOR S; ... ... ... } ------------------- 2- Apply Pro*c patchset 9.0.1.3 or upgrade to 9.2.0.1 or higher
제가 맞게 찾았는지 모르지만..훔..저도 pro*c는
잘 하는 편이 아니라..;; 암튼..제가 해보기로
PL/SQL 에서는 analytic function 아주 잘 돌아가구요
pro*c 에서 위에 자료에 의하면
Dynamic sql 을 이용해서 하시거나
pro*c 패치셋(9.0.1.3) 을 적용시켜야 할것 같습니다.
훔냐냐..
감사함다.. 도움이 마니 되었슴다..
그런데 지금 사용중인 오라클의 정확한 버젼이
9.0.1.3 이고.. ProC도 컴파일시 확인해보면
Pro*C/C++: Release 9.0.1.3.0 이라고 나오는데..
9.0.1.3.0 버젼에서 사용이 안되니....
Dynamic SQL을 사용하지 않는다면
오라클을 9.2.0.1로 올리는 방법밖에 없다는.....