Re: About Package Problem..

From: James <james_lorenzen_at_allianzlife.com>
Date: Tue, 30 Mar 1999 13:50:31 GMT
Message-ID: <7dqkr4$eoh$1_at_nnrp1.dejanews.com>


"count" is a reserved word in SQL. Replace the "c" with a "k" (for korrect phonics) and give it a go.

HTH
    James

In article <7do63v$a1b$1_at_nnrp1.dejanews.com>,   agichen_at_my-dejanews.com wrote:
> Hi,there,
>
> I have a table "sample" as follows.
> count (varchar2(2)) name (varchar2(10))
> 01 Kevin
> 02 Mary
> 03 Jack
>
> I try to write a package named "de_code" as follows.
>
> CREATE OR REPLACE PACKAGE de_code
> as
> function get_name(cnt in varchar2) return varchar2;
> PRAGMA restrict_references (get_no, WNDS,WNPS);
> end;
>
> /
>
> CREATE OR REPLACE PACKAGE BODY de_code
> AS
>
> function get_name(cnt in varchar2) return varchar2 is
> tmpVar varchar2(10);
> cursor c is
> select name
> from sample
> where count= cnt;
>
> begin
> open c;
> fetch c into tmpVar;
> close c;
>
> return (tmpVar);
> end;
>
> end;
>
> /
> after i execute the command like follows,......
>
> SQL> select count,de_code.get_name(count) from sample;
> ERROR:
> ORA-00934: group function is not allowed here
> ORA-06512: at "ADMIN.DE_CODE", line 7
> ORA-06512: at "ADMIN.DE_CODE", line 12
> ORA-06512: at line 1
>
> no rows selected
>
> SQL>
>
> How to modify the package or function ? Where's wrong ?
>
> ps.I used Personal Oracle 7.3.3
>
> Best Regards
> Agi Chen agi_at_mail.taicom.com.tw
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Mar 30 1999 - 15:50:31 CEST

Original text of this message