Re: Why doesn't this compile!

From: Guido Konsolke <Konsolke_at_triaton.com>
Date: Fri, 10 Jan 2003 10:19:19 +0100
Message-ID: <1042189928.803125_at_news.thyssen.com>


Hi Jorge,

sorry, ain't got much time so just the most obvious: your function createDataType returns varchar2(30) but the input params are:
varchar2(50) + number(4) + number(2) = 56.

hth,
Guido

"Jorge Carvalho" <rdc02271_at_yahoo.com> schrieb im Newsbeitrag news:avlv6q$vb3$1_at_news.oninet.pt...
> Hello!
> I'm a newbie and I'm trying to create a package, but i always get a
> compilation error.
> Here is the code (i don't see where is the problem! I create the interface
> without problems, but i try to create the function createDataType2 i get a
> compilation error; apparently there is something worng with the select
> inside this function...)
> Thanks for your help and attention.
> Best Regards,
> Jorge Carvalho
> rdc02271_at_yahoo.com
>
> create or replace package body pf_pack_managementGeneral as
> function createDataType(ls_name varchar2,ln_size number,ln_decimals
 number)
> return varchar2 is
> ls_dataType varchar2(30);
> begin
> --use this to create a real data type
> --ls_name:=UPPER(ls_name); --doesn't upper exist?!
> ls_dataType:=
> CASE ls_name
> WHEN 'VARCHAR2' then 'varchar2(' || to_char(ln_size) ||')'
> WHEN 'NUMBER' then 'number(' || to_char(ln_size) || ',' ||
> to_char(ln_decimals) || ')'
> end;
> return ls_dataType;
> end createDataType;
>
> function createDataType2(ln_id number) return varchar2 is
> --ls_name varchar2(50);
> --ln_size number(4);
> --ln_decimals number(2);
> ls_name DATATYPES.RealDataTypeName%TYPE;
> ln_size PROPERTIES.Size_%TYPE;
> ln_decimals PROPERTIES.Decimals%TYPE;
>
> begin
> --use this to create a real data type
> --select * from datatypes into lr_datatype where id=:new.iddatatype;
> SELECT datatypes.RealDataTypeName,properties.Size_,properties.Decimals
> from properties,datatypes into ls_name,ln_size,ln_decimals WHERE
> properties.iddatatype=datatypes.id AND properties.id=ln_id;
> return createDataType(ls_name,ln_size,ln_decimals);
> end createDataType2;
> end pf_pack_managementGeneral;
>
> create or replace package pf_pack_managementGeneral as --package
> specification
> function createDataType(ls_name varchar2,ln_size number,ln_decimals
 number)
> return varchar2;
> function createDataType2(ln_id number) return varchar2;
> end pf_pack_managementGeneral;
>
>
>
>
>
Received on Fri Jan 10 2003 - 10:19:19 CET

Original text of this message