I want to create a package. But sql*plus propmt "warning:created package body has compiled error".I use Chinese version. I tarnslated the Chinese prompt to english. Hope you unterstand.
Please help
thanks
SQL> create or replace package body product
2 as
3 function addType(typeid in varchar2,typename in varchar2,typedescribe in varchar2)
4 return varchar2
5 as
6 maxTypeid varchar2(28);
7 subTypeid varchar2(2);
8 subTypeint int;
9 begin
10 if length(typeid) > 28 then
11 return '-1'; --typeid²ÎÊý³¤¶È±ØÐëСÓÚµÈÓÚ28
12 end if;
13 if length(typename) > 50 then
14 retrun '-2'; --typename²ÎÊý³¤¶È±ØÐëСÓÚµÈÓÚ50
15 end if;
16 if length(typename) = 0 then
17 return '-3'; --typename²ÎÊý³¤¶È²»ÄܵÈÓÚ0
18 end if;
19 if length(typedescribe) > 100 then
20 return '-4'; --typedescribe²ÎÊý³¤¶È²»ÄÜ´óÓÚ100
21 end if;
22 select max(kind_id) into maxTypeid from prod_kind where kind_id like typeid || '__';
23 if maxTypeid is null then
24 maxTypeid := typeid || '01';
25 else begin
26 subTypeid := substr(maxTypeid,length(maxTypeid)-1);
27 subTypeint := to_number(subTypeid);
28 if subTypeint = 99 then
29 return '-5'; --À*±ðÒѾ*´ïµ½×î´ó£¬²»ÄÜÌ*¼ÓÀ*±ð
30 end if;
31 subTypeid := to_char(subTypeint + 1);
32 maxTypeid := substr(maxTypeid,1,length(maxTypeid)-2) || subTypeid;
33 end;
34 end if;
35 insert into prod_kind (kind_id,kind_name,describe) values (maxTypeid,typename,typedescribe);
36 commit;
37 return maxTypeid;
38 exception
39 with OTHERS then
40 begin
41 return '-6'; --δ֪´*Îó£¬Ì*¼ÓÀ*±ðʧ°Ü
42 end;
43 end;
44 end;
45 /

¾¯¸æ: ´´½¨µÄ°üÌå´øÓб*Òë´*Îó¡£