这套东西是从MSSQL看的,自己改成了ORACLE的,用的是8I,包如下:--个人日程管理程序包,包头scott.pa_rcgl
create or replace package scott.pa_rcgl as
 --声明引用游标类型
 type mycursor is ref cursor;
 
 --返回所有优先级的记录集
 procedure filltaskprioritybox(rdata out pa_rcgl.mycursor);
 
 --返回所有日程类型的记录集
 procedure filltasktypebox(rdata out pa_rcgl.mycursor);
 
 --返回所有日程
 procedure getallschedule(rdata out pa_rcgl.mycursor);
 
 --返回指定日期的日程,输入参数是希望查看的日期,输出参数是当天所有日程
 procedure  getschedulebyid(in_date in date,rdata out pa_rcgl.mycursor); --返回指定日程ID的日程信息
 procedure getschedulebyid(in_id in scott.task.task_id%type,rdata out pa_rcgl.mycursor);
 
 --返回除“作息”类型外的所有未完成事件
 procedure getunfinishedschedule(rdata out pa_rcgl.mycursor);
 
 --添加新日程记录
 procedure insertnewschedule(in_title in scott.task.titled%type,
                             in_detail in scott.task.detail%type,
                             in_begintime in scott.task.begintime%type,
                             in_neednotify in scott.task.neednotify%type,
                             in_notifytime in scott.task.notify%type,
                             in_finished in scott.task.finished%type, 
                             in_type in scott.task.type%type, 
                             in_priority in scott.task.priority%type);
    
 
 --根据输入的日程信息来进行修改
 procedure modifyschedule(in_id in scott.task.task_id%type,
                          in_title in scott.task.titled%type,
                          in_detail in scott.task.detail%type,
                          in_begintime in scott.task.begintime%type,
                          in_neednotify in scott.task.neednotify%type,
                          in_notifytime in scott.task.notify%type,
                          in_finished in scott.task.finished%type, 
                          in_type in scott.task.type%type, 
                          in_priority in scott.task.priority%type); --删除指定日程ID的日程信息
 procedure delschedulebyid(in_id in scott.task.task_id%type); 
 
end; 
--个人日程管理程序包,包体scott.pa_rcgl
create or replace package body scott.pa_rcgl as --返回所有优先级的记录集
 procedure filltaskprioritybox(rdata out pa_rcgl.mycursor) as
  begin
    open rdata for 
     select * from scott.priority;
  end;  --返回所有日程类型的记录集
 procedure filltasktypebox(rdata out pa_rcgl.mycursor) as
  begin
   open rdata for
    select * from scott.tasktype;
  end; --返回所有日程
 procedure getallschedule(rdata out pa_rcgl.mycursor) as
  begin
    open rdata for
     select * from scott.task;
  end; --返回指定日期的日程,输入参数是希望查看的日期,输出参数是当天所有日程
 procedure  getschedulebyid(in_date in date,rdata out pa_rcgl.mycursor) as
  begin
    open rdata for
     select * from scott.task
     where begintime=in_date
     order by begintime;
  end; --返回指定日程ID的日程信息
 procedure getschedulebyid(in_id in number,rdata out pa_rcgl.mycursor) as
  begin
   open rdata for
    select * from scott.task
    where task_id=in_id;
  end; --返回除“作息”类型外的所有未完成事件
 procedure getunfinishedschedule(rdata out pa_rcgl.mycursor) as
  begin
   open rdata for
    select * from scott.task
    where type<>1 and finished=0;
  end; --添加新日程记录(使用了序列)
 procedure insertnewschedule(in_title in scott.task.titled%type,
                             in_detail in scott.task.detail%type,
                             in_begintime in scott.task.begintime%type,
                             in_neednotify in scott.task.neednotify%type,
                             in_notifytime in scott.task.notify%type,
                             in_finished in scott.task.finished%type, 
                             in_type in scott.task.type%type, 
                             in_priority in scott.task.priority%type) as
  begin
   insert into scott.task(task_id,title,detail,begintime,neednotify,notifytime,finished,type,priority)
   values(scott.task_id_xl.nextval,in_title,in_detail,in_begintime,in_neednofity,in_notifytime,in_finished,in_type,in_priority);
   commit;
  end; --根据输入的日程信息来进行修改
 procedure modifyschedule(in_id in scott.task.task_id%type,
                          in_title in scott.task.titled%type,
                          in_detail in scott.task.detail%type,
                          in_begintime in scott.task.begintime%type,
                          in_neednotify in scott.task.neednotify%type,
                          in_notifytime in scott.task.notify%type,
                          in_finished in scott.task.finished%type, 
                          in_type in scott.task.type%type, 
                          in_priority in scott.task.priority%type) as
  begin
    update scott.task set title=in_title,detail=in_detail,begintime=in_begintime,neednotify=in_neednotify,notifytime=in_notifytime,finished=in_finished,type=in_type,priority=in_priority where task_id=in_id;
    commit;
  end;
 
 --删除指定日程ID的日程信息
 procedure delschedulebyid(in_id in number) as
  begin
    delete from scott.task where task_id=in_id;
    commit;
  end; end;
在sqlplus worksheet中运行,报告“创建的包带有编译错误”,本人能力有限找不到问题,希望高手帮下忙。

解决方案 »

  1.   

    show errors
    一下看看错在哪儿
      

  2.   

    begin 
        update scott.task set title=in_title,detail=in_detail,begintime=in_begintime,neednotify=in_neednotify,notifytime=in_notifytime,finished=in_ finished,type=in_type,priority=in_priority where task_id=in_id; 
        commit; 
      end;有两个这样的地方断开了
      

  3.   

    这么多,最好在用plsql Developer 开发工具调试一下。这么多,凭眼睛看有难度!!!
    希望你成功!!!
    或者等待高手!
      

  4.   

    感谢各位,首先,在我源程序中是没有断开的,这里显示断开是网页的问题,其次,我数据库中有个字段名字是type,是个保留字,我想出错是否和这个有关。另外,楼上说的show errors该怎么用,那个plsql Developer 开发工具又该怎么用?我的环境是2k+8i,好像没有这个工具。
      

  5.   

    在命令行窗口,或者sqlplus中执行包的编译,出错时执行show errors
      

  6.   

    plsql Developer应该已经有提示的地方了吧。你如果是在commond window里创建时候出错,出错后,敲入show errors 就可以了如果是在program window里创建的,在下部分的窗口里有错误提示。
      

  7.   

    问题找到了,原来是字段名拼错了,现在又有了新问题,改正后,在sqlplus中,包头正常编译成功,包体仍然报告有编译错误,用show errors查看,却又说没有错误,这是怎么回事?
      

  8.   

    将包头很包体分开编译试试
    错误的话再show errors
      

  9.   

    我就是包头,包体分开编译的,我用8I的sqlplus worksheet编译的,我发现一起编译的话只有包头,没有包体。分开编译的话,即使包体有编译错误也能生成。现在的情况是,编译包体,报告程序包已创建,在编译包体,报告包体有编译错误,执行show errors,报告没有错误。
      

  10.   

    用plsql developer
    File->New->Program Window->Procedure创建存储过错,编译有错误就应该报出来的
      

  11.   

    下载了一个PLSQL DEVELOPER,就是他妈的好,一下子就发现我包体里有个拼写错误,问题解决了,谢谢各位,结贴给分。