About Package Problem..

From: <agichen_at_my-dejanews.com>
Date: Mon, 29 Mar 1999 15:27:06 GMT
Message-ID: <7do63v$a1b$1_at_nnrp1.dejanews.com>



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 Received on Mon Mar 29 1999 - 17:27:06 CEST

Original text of this message