select vc_sendtranno,nu_sendrecords,dt_trandatetime 
from t_tran_type where vc_shopid='002042'有数据吗

解决方案 »

  1.   

    就是哪个destshopid那里有问题,拿掉就ok,请大家帮帮我。
      

  2.   

    declare 
    tranno varchar2(50);
    srcrecords varchar2(50);
    trandatetime date;
    destshopid varchar(20);begin
    destshopid:='002042';
    select vc_sendtranno,nu_sendrecords,dt_trandatetime into tranno,srcrecords,trandatetime from t_tran_type where vc_shopid=destshopid and rownum<2;
      

  3.   

    destshopid:='002042';
    没有vc_shopid = '002042'的记录,肯定报错嘛!
    declare 
    tranno varchar2(50);
    srcrecords varchar2(50);
    trandatetime date;
    destshopid varchar(20);begin
    destshopid:='002042';
    select vc_sendtranno,nu_sendrecords,dt_trandatetime into tranno,srcrecords,trandatetime from t_tran_type where vc_shopid=destshopid and rownum<2;建议以后定义这种变量的时候请用destshopid  t_tran_type.vc_shopid%type;
      

  4.   

    有这个数据的。要是写成
    select vc_sendtranno,nu_sendrecords,dt_trandatetime into tranno,srcrecords,trandatetime from t_tran_type where vc_shopid='002042' and rownum<2;就没问题
      

  5.   

    同意bzszp(SongZip) 和GerryYang(轻尘) 的,
    destshopid是varchar2类型的,destshopid:=002042时,会自动先把002042作为number,化成2042,再转化成varchar2型,即'2042',所以实际上变成了destshopid:='2042'。应该是:declare 
    tranno varchar2(50);
    srcrecords varchar2(50);
    trandatetime date;
    destshopid varchar(20);begin
    destshopid:='002042';
    select vc_sendtranno,nu_sendrecords,dt_trandatetime 
    into tranno,srcrecords,trandatetime 
    from t_tran_type 
    where vc_shopid=destshopid and rownum<2;end;