Re: PACKAGE PROBLEM

From: Valeri Sorokine <vsorokin_at_dd.ru>
Date: Mon, 29 Mar 1999 20:54:32 +0400
Message-ID: <36FFB048.E070CDF6_at_dd.ru>


Try to rename column name COUNT in your table or use "COUNT" instead of COUNT in your select statement ...

There is a group function COUNT

Hope this helps.

agichen_at_my-dejanews.com wrote:
>
> Hi,there,
>
> I have a table "sample" as follows,
>
> count varchar2(2) name ( varchar2(10))
> 01 MARY
> 02 JACK
> 03 KEVIN
>
> I try to write a function get_name in package de_code like this,
>
> CREATE OR REPLACE PACKAGE DE_CODE
> as
> function get_name(cnt in varchar2) return varchar2;
> PRAGMA restrict_references (get_name, WNDS,WNPS);
> end;
>
> /
>
> CREATE OR REPLACE PACKAGE BODY DE_CODE
> AS
>
> function get_name(cnt in varchar2) return varchar2 is
> tmpVar varchar2(10):='UNKNOW';
> 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 create it, and execute
> 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>
>
> What's wrong ?? Any idea,
>
> Agi Chen
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

-- 
Valeri Sorokine
ProSoft, Russia, Moscow, Information Systems Division
Phone: +7 (095) 234 0636 (6 lines) FAX: +7 (095) 234 0640
E-mail: vsorokin_at_dd.ru OR vsorokin_at_prosoft.ru
http://www.dd.ru
Received on Mon Mar 29 1999 - 18:54:32 CEST

Original text of this message