请大家帮忙看看这个存储过程有什么问题,报错光标停在select title into v_title那行
===========================================================================
执行时报错为:
ORA-01403: 未找到数据
ORA-06512: 在 "SYSTEM.P_FINDBOOK", line 5
ORA-06512: 在 line 1
===========================================================================
存储过程:
create or replace procedure p_findbook (id in number, title out varchar) AS
v_id number; v_title varchar2(200);begin
select title into v_title
from system.guestbook
where id = v_id;
end p_findbook;
===========================================================================
表字段有id(number), title(varchar2(200))等等
表名字:system.guestbook

解决方案 »

  1.   

    ...把表建到system下面去了,这是很危险的行为
    你的传出参数里有title,但是过程里怎么没有相关代码
    参数的名称最好避免与表中的字段名重复
    id和title最好重新命名
    而且where id=v_id这里,v_id还没有赋值呢
      

  2.   

    这样试试create or replace procedure p_findbook (v_id in number, v_title out varchar2) AS 
    begin 
    select title into v_title 
    from system.guestbook 
    where id = v_id; 
    end p_findbook; 
      

  3.   

    create or replace procedure p_findbook (v_id in number, v_title out varchar2) AS 
    begin 
    select title into v_title 
    from system.guestbook 
    where id = v_id; 
    exception
    when no_data_found then
      v_title:=null;
    end p_findbook; 
      

  4.   

    呵呵,果然像你改的那样就可以了,谢谢wildwave!!!
    自己弄了一个多小时没弄明白。
    再次感谢!
      

  5.   

    提示的很清楚了=========================================================================== 
    执行时报错为: 
    ORA-01403: 未找到数据 
      

  6.   

    create or replace procedure p_findbook (id in number, title out varchar) AS 
    v_id number; v_title varchar2(200); begin 
    select title into v_title 
    from system.guestbook 
    where id = v_id; 
    --加例处处理
    exception 
    when others then
    v_title:=null;
    end p_findbook; 
      

  7.   

    wildwave 太牛了  看来是ORACLE高手 几乎每个帖子都有你的身影 而且分析透彻 总能解决问题,佩服