数字或值错误:字符到数字转换错误

发布于 2024-12-25 01:37:36 字数 2092 浏览 1 评论 0原文

create or replace
procedure prdBandwidth
is
    cursor c_bandwidth is select distinct mt.name bwname,b.circuitno circuitno,subapp.customerno customerno,netinfo.bandwidthtype bandwidthtype from wom.tbltsubscriberapplication subapp,wom.tbltllnetworkinfo netinfo,wom.tblmmastertype mt,(select max(applicationdate) as maxdate,circuitno,customerno from wom.TBLTSUBSCRIBERAPPLICATION,tblmaccount where nodename='End' and accountnumber=customerno group by circuitno, customerno) b  where subapp.applicationdate=b.maxdate and  subapp.circuitno=b.circuitno and subapp.llnetworkinfoid=netinfo.id and netinfo.bandwidthtype=mt.id;
    bwtype varchar2(6);
    bwtypelen number;
    bwtypesublen number;
    bwvalue varchar2(8);
      kbpsdata number;
begin
  DBMS_OUTPUT.PUT_LINE('hhahahahah');
  for crs_bandwidth in c_bandwidth
  loop 
    bwtypelen:=length(crs_bandwidth.bwname);
    DBMS_OUTPUT.PUT_LINE('bwtypelen:::'+bwtypelen);
    bwtype:=substr(crs_bandwidth.bwname,-4,4);
    DBMS_OUTPUT.PUT_LINE('bwtype:::'+bwtype);
    bwtypesublen:=length(bwtype);
     DBMS_OUTPUT.PUT_LINE('bwtypesublen:::'+bwtypesublen);
    bwtypesublen:=bwtypesublen-1;
     DBMS_OUTPUT.PUT_LINE('bwtypesublen:::'+bwtypesublen);
    bwvalue:=substr(crs_bandwidth.bwname,bwtypesublen,bwtypesublen);
    DBMS_OUTPUT.PUT_LINE('bwvalue:::'+bwvalue);
    if bwtype='mbps' then
        DBMS_OUTPUT.PUT_LINE('bwtype in if condition:::'+bwvalue);
        bwvalue:=bwvalue*1024;
        DBMS_OUTPUT.PUT_LINE('bwtype in if condition:::'+bwvalue);
    end if;
    update TBLMLEASEDLINECUSTOMER set BANDWIDTH=bwvalue where CUSTOMERID = (select CUSTOMERID from TBLMCUSTOMER  where  accountnumber=crs_bandwidth.customerno);
    end loop;
   commit;
end;

错误从命令中的第 36 行开始:

exec prdBandwidth

错误报告:

ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "JISPBILCORBILLINWOM501.PRDBANDWIDTH", line 14
ORA-06512: at line 1
06502. 00000 -  "PL/SQL: numeric or value error%s"
*Cause:    
*Action:

这是代码

create or replace
procedure prdBandwidth
is
    cursor c_bandwidth is select distinct mt.name bwname,b.circuitno circuitno,subapp.customerno customerno,netinfo.bandwidthtype bandwidthtype from wom.tbltsubscriberapplication subapp,wom.tbltllnetworkinfo netinfo,wom.tblmmastertype mt,(select max(applicationdate) as maxdate,circuitno,customerno from wom.TBLTSUBSCRIBERAPPLICATION,tblmaccount where nodename='End' and accountnumber=customerno group by circuitno, customerno) b  where subapp.applicationdate=b.maxdate and  subapp.circuitno=b.circuitno and subapp.llnetworkinfoid=netinfo.id and netinfo.bandwidthtype=mt.id;
    bwtype varchar2(6);
    bwtypelen number;
    bwtypesublen number;
    bwvalue varchar2(8);
      kbpsdata number;
begin
  DBMS_OUTPUT.PUT_LINE('hhahahahah');
  for crs_bandwidth in c_bandwidth
  loop 
    bwtypelen:=length(crs_bandwidth.bwname);
    DBMS_OUTPUT.PUT_LINE('bwtypelen:::'+bwtypelen);
    bwtype:=substr(crs_bandwidth.bwname,-4,4);
    DBMS_OUTPUT.PUT_LINE('bwtype:::'+bwtype);
    bwtypesublen:=length(bwtype);
     DBMS_OUTPUT.PUT_LINE('bwtypesublen:::'+bwtypesublen);
    bwtypesublen:=bwtypesublen-1;
     DBMS_OUTPUT.PUT_LINE('bwtypesublen:::'+bwtypesublen);
    bwvalue:=substr(crs_bandwidth.bwname,bwtypesublen,bwtypesublen);
    DBMS_OUTPUT.PUT_LINE('bwvalue:::'+bwvalue);
    if bwtype='mbps' then
        DBMS_OUTPUT.PUT_LINE('bwtype in if condition:::'+bwvalue);
        bwvalue:=bwvalue*1024;
        DBMS_OUTPUT.PUT_LINE('bwtype in if condition:::'+bwvalue);
    end if;
    update TBLMLEASEDLINECUSTOMER set BANDWIDTH=bwvalue where CUSTOMERID = (select CUSTOMERID from TBLMCUSTOMER  where  accountnumber=crs_bandwidth.customerno);
    end loop;
   commit;
end;

Error starting at line 36 in command:

exec prdBandwidth

Error report:

ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "JISPBILCORBILLINWOM501.PRDBANDWIDTH", line 14
ORA-06512: at line 1
06502. 00000 -  "PL/SQL: numeric or value error%s"
*Cause:    
*Action:

this is the code

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2025-01-01 01:37:36

在您的 DBMS_OUTPUT.PUT_LINE 语句中,尝试使用“||”作为连接运算符,而不是“+”。

In your DBMS_OUTPUT.PUT_LINE statements, try using '||' as a concatenation operator, rather than '+'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文