DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: What is the compiled error

Hybrid View

  1. #1
    Join Date
    Sep 2001
    Posts
    99
    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 /

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

  2. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    Add after text of package

    create or replace ...
    ...

    end;
    /

    SHOW ERRORS;

    and you can see with errors was in this packsge.



  3. #3
    Join Date
    Sep 2001
    Posts
    99

    how correct this error?

    thank you. I corrected all errors except that. That error is about Exception. Could you help me? sorry, I can't translate these Chinese to English.

    SQL> show errors
    PACKAGE BODY PRODUCT ³öÏÖ´*Îó:

    LINE/COL ERROR
    -------- ---------------------------------------------------
    39/6 PLS-00103: ³öÏÖ·ûºÅ "WITH"ÔÚÐèÒªÏÂÁÐ֮һʱ£º
    pragmawhen
    ·ûºÅ "whenÔÚ "WITH" ¼ÌÐø֮ǰÒѲåÈë¡£
    ocean

  4. #4
    Join Date
    Sep 2001
    Posts
    99

    ok,now I know

    the word "with" should be "when"
    thanks
    ocean

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width