日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

list agg cause ORA-06502 PL/SQL: numeric or value error

發布時間:2024/4/17 数据库 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 list agg cause ORA-06502 PL/SQL: numeric or value error 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

http://www.idb-stock.net/idb/2011/07/05/204.html

ora-06502錯誤主要是指數據字或值錯誤,包括以下子類型:字符到數據值的轉換錯誤、字符串緩沖區太小、數值精度太高等。

對空集合的調用,會報ora-06502錯誤

view plaincopy to clipboardprint?
  • declare??
  • ??type?cnt_typ?is?table?of?number?index?by?binary_integer; ??
  • ??v_cnt1?cnt_typ; ??
  • begin??
  • ??select?1?bulk?collect ??
  • ????into?v_cnt1 ??
  • ????from?dual ??
  • ???where?1?>?20; ??
  • ??for?i?in?v_cnt1.first?..?v_cnt1.last??
  • ??loop ??
  • ????dbms_output.put_line(v_cnt1(i)); ??
  • ??end?loop; ??
  • end; ??
  • /??
  • declaretype cnt_typ is table of number index by binary_integer;v_cnt1 cnt_typ; beginselect 1 bulk collectinto v_cnt1from dualwhere 1 > 20;for i in v_cnt1.first .. v_cnt1.lastloopdbms_output.put_line(v_cnt1(i));end loop; end; /

    dw@dw>declare2 type cnt_typ is table of number index by binary_integer;3 v_cnt1 cnt_typ;4 begin5 select 1 bulk collect6 into v_cnt17 from dual8 where 1 > 20;9 for i in v_cnt1.first .. v_cnt1.last10 loop11 dbms_output.put_line(v_cnt1(i));12 end loop;13 end;14 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 9

    對變量賦值時,值的長度超過了變量定義的長度,會報ora-06502錯誤

    view plaincopy to clipboardprint?
  • declare??
  • ??v_name?varchar2(3); ??
  • begin??
  • ??v_name?:=?'Frank'; ??
  • end; ??
  • / ??
  • ??
  • declare??
  • ??v_n?number(2); ??
  • begin??
  • ??v_n?:=?100; ??
  • end; ??
  • /??
  • declarev_name varchar2(3); beginv_name := 'Frank'; end; /declarev_n number(2); beginv_n := 100; end; /

    dw@dw>declare2 v_name varchar2(3);3 begin4 v_name := 'Frank';5 end;6 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 4dw@dw>declare2 v_n number(2);3 begin4 v_n := 100;5 end;6 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: number precision too large ORA-06512: at line 4

    字符轉換為數字時,也會報ORA-06502字符到數據值的轉換錯誤

    view plaincopy to clipboardprint?
  • declare??
  • ??v_n?number(2)?; ??
  • begin??
  • ??v_n?:=?'a'; ??
  • end; ??
  • /??
  • declarev_n number(2) ; beginv_n := 'a'; end; /

    dw@dw>declare2 v_n number(2) ;3 begin4 v_n := 'a';5 end;6 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at line 4dw@dw>

    ORA-06502: PL/SQL: numeric or value errorstring
    Cause: An arithmetic, numeric, string, conversion, or constraint error occurred. For example, this error occurs if an attempt is made to assign the value NULL to a variable declared NOT NULL, or if an attempt is made to assign an integer larger than 99 to a variable declared NUMBER(2).
    Action: Change the data, how it is manipulated, or how it is declared so that values do not violate constraints.

    轉載請注明:本文來自iDB Stock:http://www.idb-stock.net/idb/2011/07/05/204.html

    ===========

    ?

    for r_rec in (
    ? ??--loanxid is null
    ? ??select portfolioCusip,portfolioname,facilityCusip,FACILITYNAME, TRADECCY,loanxid, sum(nvl(CommitmentAmount,0)) position,0.0 apolloWAVGPrice, --sum(commitmentamount*WTAVGPURCHASEPRICE)/sum(commitmentamount) apolloWAVGPrice,
    ? ??lv,lvname,
    ? ??sum(nvl(notionalAmount,0)) notional
    ? ??/*
    ? ??from GCD.PtrsPositionExtTMP tmp
    ? ??group by portfolioCusip,facilityCusip,FIRMACCOUNTCD,TRADECCY,loanxid
    ? ??*/
    ? ??from GCD.PtrsPositionExt? tmp
    ? ??where tmp.portfolioCusip in (select portfolioCusip from trustee_daily_position_recon where reporttype=p_reporttype and asofdate=p_date)
    ? ??and (loanxid is null or loanxid not like 'LX%') -- we have other values :NOUKMARK,NOLXBOND,NOTLOANX,NOLXMARK
    ? ??--group by portfolioCusip,facilityCusip, TRADECCY,loanxid
    ? ??group by portfolioCusip,portfolioname,facilityCusip,? FACILITYNAME ,TRADECCY,loanxid, lv,lvname
    ? ??
    ? ??union
    ? ??
    ? ??--loanxid is not null
    ? ??select portfolioCusip,portfolioname,
    ? ??'' facilityCusip,
    ? ??'' FACILITYNAME,
    ? ??'' TRADECCY,
    ????? (select listagg(facilitycusip,'|') within group (order by loanxid) from loanfacility where loanxid=tmp.loanxid group by loanxid) facilityCusip,
    ????? (select listagg(facilityname,'|') within group (order by loanxid) from loanfacility where loanxid=tmp.loanxid group by loanxid) FACILITYNAME,
    ????? (select? listagg(globalccy, '|') within group(order by tt.loanxid)from (select distinct globalccy, loanxid from loanfacility? ) tt? where tt.loanxid=tmp.loanxid group by tt.loanxid) TRADECCY,
    ????? loanxid, sum(nvl(CommitmentAmount,0)) position,0.0 apolloWAVGPrice, --sum(commitmentamount*WTAVGPURCHASEPRICE)/sum(commitmentamount) apolloWAVGPrice,
    ? ??lv,lvname,
    ? ??sum(nvl(notionalAmount,0)) notional
    ? ??/*
    ? ??from GCD.PtrsPositionExtTMP tmp
    ? ??group by portfolioCusip,facilityCusip,FIRMACCOUNTCD,TRADECCY,loanxid
    ? ??*/
    ? ??from GCD.PtrsPositionExt? tmp
    ? ??where tmp.portfolioCusip in (select portfolioCusip from trustee_daily_position_recon where reporttype=p_reporttype and asofdate=p_date)
    ????? and loanxid is not null and loanxid like 'LX%'
    ? ??--group by portfolioCusip,facilityCusip, TRADECCY,loanxid
    ? ??group by portfolioCusip,portfolioname,? loanxid, lv,lvname
    ? ?) loop
    ? ??--dbms_output.put_line('for:'||r_rec.portfolioCusip||r_rec.facilityCusip);
    ? ??update trustee_daily_position_recon recon set apolloPosition=r_rec.position,? --facilityCusip=r_rec.facilityCusip,FACILITYNAME=r_rec.FACILITYNAME,
    ? ??apolloWAVGPrice=r_rec.apolloWAVGPrice, apolloNotional=r_rec.notional,
    ? ??APOLLOLOANXID=r_rec.loanxid
    ? ??where recon.portfolioCusip=r_rec.portfolioCusip
    ? ??and (?(recon.facilityCusip=r_rec.facilityCusip and recon.trusteeIdentifierType not in ('LOANX_ID','LOANX_IDC') )
    ? ????or (recon.trusteeIdentifier=r_rec.loanxid and recon.trusteeIdentifierType in ('LOANX_ID','LOANX_IDC'))
    ? ???)
    ? ??and recon.lv=r_rec.lvname
    ??and reporttype=p_reporttype and asofdate=p_date;
    ? ??--and recon.Currency=r_rec.Currency;
    ? ??
    ? ??
    ? ??--dbms_output.put_line('after update:'||r_rec.portfolioCusip||r_rec.facilityCusip);
    ? ??select count(*) cnt into cntTmp from trustee_daily_position_recon recon
    ? ??where recon.portfolioCusip=r_rec.portfolioCusip
    ? ??--and ( recon.facilityCusip=r_rec.facilityCusip or ((recon.trusteeIdentifier=r_rec.loanxid or recon.trusteeIdentifier=r_rec.facilityCusip) and recon.facilityCusip is null))
    ? ??and (?(recon.facilityCusip=r_rec.facilityCusip and recon.trusteeIdentifierType not in ('LOANX_ID','LOANX_IDC') )
    ? ????or (recon.trusteeIdentifier=r_rec.loanxid and recon.trusteeIdentifierType in ('LOANX_ID','LOANX_IDC'))
    ? ???)
    ? ??and recon.lv=r_rec.lvname;
    ? ??--dbms_output.put_line('before insert:'||r_rec.portfolioCusip||r_rec.facilityCusip||'+'||cntTmp);
    ? ??if (cntTmp = 0) then
    ? ???--dbms_output.put_line('insert:'||r_rec.portfolioCusip||r_rec.facilityCusip);
    ? ???insert into trustee_daily_position_recon (recordId,portfolioCusip,portfolioName,facilitycusip,FACILITYNAME,apolloLoanXID,trusteePosition,apolloPosition,Currency,apolloWAVGPrice,lv,asofdate,reporttype,trusteeNotional,apolloNotional,trusteeWAVGPrice)
    ? ???values(GCD.trusteeRecon_Seq.nextval, r_rec.portfolioCusip,r_rec.portfolioName,r_rec.facilityCusip,r_rec.FACILITYNAME,r_rec.loanxid,0,r_rec.position, r_rec.Tradeccy,r_rec.apolloWAVGPrice,r_rec.lvname,p_date,p_reporttype,0,r_rec.notional,0);
    ? ??end if;
    ? ??--dbms_output.put_line('after insert:'||r_rec.portfolioCusip||r_rec.facilityCusip);
    ? ?end loop;

    ?

    list agg 函數也會導致這個問題,目前原因未明。

    總結

    以上是生活随笔為你收集整理的list agg cause ORA-06502 PL/SQL: numeric or value error的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。