Compilation errors for PACKAGE AUTH.TESTError: PLS-00103: Encountered the symbol ";" when expecting one of the following:
       
          ( return
Line: 24
Text: function AddMoveDataToOrignNas;
create or replace package test is
   function AddMoveDataToOrignNas;  //error
end test;
           function AddMoveDataToOrignNas is
           begin
            insert into auth_base_orignasinfo(id,ipaddr,domain,node,cityid,countyid,orderby,modifydate,enabled,moved) values(Auth_Base_Orignasinfo_SEQ.Nextval,'10.10.10.10','NB-YY-SB-1_domain','57407','3102','310205',32,sysdate,1,1);             return;
           end AddMoveDataToOrignNas;      

解决方案 »

  1.   

    包里只书写函数的说明,函数体放在包体package body里。
    create or replace package test is
      function AddMoveDataToOrignNas; //error
    end test;
    create or replace package body test is
      function AddMoveDataToOrignNas is
      begin
      insert into auth_base_orignasinfo(id,ipaddr,domain,node,cityid,countyid,orderby,modifydate,enabled,moved) values(Auth_Base_Orignasinfo_SEQ.Nextval,'10.10.10.10','NB-YY-SB-1_domain','57407','3102','310205',32,sysdate,1,1);  return;
      end AddMoveDataToOrignNas;end test;
      

  2.   

    function要有return的值。
    你還不如寫成procedure呢
      

  3.   

    我是这样写的,
    //head
    create or replace package test is
      function AddMoveDataToOrignNas; //error
    end test;
    放头上的,// body
    create or replace package body test is
      function AddMoveDataToOrignNas is
      begin
      insert into auth_base_orignasinfo(id,ipaddr,domain,node,cityid,countyid,orderby,modifydate,enabled,moved) values(Auth_Base_Orignasinfo_SEQ.Nextval,'10.10.10.10','NB-YY-SB-1_domain','57407','3102','310205',32,sysdate,1,1);  return;
      end AddMoveDataToOrignNas;end test;跟你说的一样。
      

  4.   

    create or replace package test is
      function AddMoveDataToOrignNas return number; -- 要有return類型
    end test;
    放头上的,// body
    create or replace package body test is
      function AddMoveDataToOrignNas is
      begin
      insert into auth_base_orignasinfo(id,ipaddr,domain,node,cityid,countyid,orderby,modifydate,enabled,moved) values(Auth_Base_Orignasinfo_SEQ.Nextval,'10.10.10.10','NB-YY-SB-1_domain','57407','3102','310205',32,sysdate,1,1);  return 1; -- 要return 一個值
      end AddMoveDataToOrignNas;end test;
      

  5.   

    如果只是insert,用procedure語意上好點吧