PACKAGE PROBLEM
From: <agichen_at_my-dejanews.com>
Date: Mon, 29 Mar 1999 15:41:16 GMT
Message-ID: <7do6uq$av4$1_at_nnrp1.dejanews.com>
[Quoted] Hi,there,
Date: Mon, 29 Mar 1999 15:41:16 GMT
Message-ID: <7do6uq$av4$1_at_nnrp1.dejanews.com>
[Quoted] Hi,there,
[Quoted] 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 Received on Mon Mar 29 1999 - 17:41:16 CEST