我需要对这些值进行拆分,但会抛出以下错误: " String Literal Too Long"
PLSQL:
DECLARE P_NUM CLOB := '407493,407494,407492,407498,407499,407500,407501,407502,407503,411784,411785,319473,336815,319471,8380594,380600,380618,374427,374429,374431,331301,411790,411791,411793,411794,336813,359758,291179,331255,259915,269523,341804,359747,259925,292253,292258,320204,331001,331006,8380655,8380659,329328,165829,177847,374448,374459,374461,374476,374481,329324,329327,365532,257234,165833,355356,355342,355339,355330,374434,374439,374442,374445,374471,374473,374483,374484,374491,374475,374479,374480,374487,203947,329311,341817,329322,307520,329310,307519,329316,329314,329313,365533,365531,341805,54583,54581,165832,355360,376733,355334,376759,376755,376747,355351,336807,129845,329443,311822,311817,329442,354777,354772,352743,352761,352754,352746,355354,355357,355337,350647,350637,376737,376752,376750,355332,376745,376749,350635,376754,355349,355359,203945,168819,329323,329321,346006,327863,278398,363735,363732,276045,196069,276044,196067,374435,374436,374443,374432,374441,374440,374446,374447,374455,374456,261354,284810,248122,248121,248118,261357,248119,257375,325321,325322,77193,365932,329325,348249,342503,342505,326691,326694,374428,352759,352744,352752,352742,352751,357759,363736,161519,357762,24863,291182,291181,259924,357771,357773,300423,332873,332872,332886,332877,332885,332876,332878,332879,135622,327853,327864,359730,359748,359756,327866,359744,359731,327869,359752,359761,374485,374486,374437,374438,374444,374449,374450,374451,374452,374477,374478,374490,374430,374457,374474,374458,355340,355355,355358,336814,311816,329441,320878,352758,24868,24866,291177,291178,259914,259926,259913,332884,165529,345998,251302,251303,251305,278394,278395,248123,192412,336819,336818,336822,336823,319470,336821,336820,336816,319472,330997,100320,311820,319977,316231,319466,319469,319468,319467,320869,320863,320866,320865,320872,359750,359740,300426,259928,259929,259920,259917,313146,135621,327856,327859,355361,192411,129843,324106,324093,324097,142228,324103,324095,324099,327858,325307,325309,327860,325306,168817,341577,341574,351171,77192,365930,272220,272221,307529,161116,161113,350636,355333,344875,344874,359749,359743,359751,359738,359741,359746,359760,359759,359734,359739,359755,344872,359757,359732,344870,344873,344877,344871,344876,359754,352757,352747,24869,351174,351172,329452,142227,324098,330999,324092,324091,324104,324096,324094,300421,319978,129841,329439,324090,324089,331002,311814,170024,320875,328907,328906,328909,318690,354780,347762,347763,272227,272228,170031,320873,170032,320876,170026,320874,170027,328910,328914,328913,328912,354776,328911,328905,318689,328908,318688,318687,311815,311821,311819,329454,329438,329455,329435,329447,329453,329451,329448,324101,329444,324100,329449,324102,329437,329445,329446,127922,316234,316236,127921,127920,316233,127919,320871,320867,320870,347775,357954,357942,352750,347773,347784,357947,357950,347768,328924,328919,328923,328925,328920,328918,334534,357774,259916,334531,347769,272229,363738,357763,363737,161518,357764,357767,24870,24865,334127,161517,328916,311102,328922,311101,328917,328921,352763,347782,357939,347778,357944,347783,347772,357938,357940,347777,357941,347757,357951,347780,347776,347771,352745,357945,357937,357949,357946,357948,347774,357943,347758,347759,347779,259919,334532,304154,304155,313144,332881,332875,71224,275110,313143,345993,327855,346005,345975,345999,346007,325315,345985,248117,284807,312615,28567,312617,77189,302844,302845,302842,345997,346004,346012,345991,345977,345987,345992,346010,345990,345995,346011,345996,346003,325305,346000,345978,345988,345981,165527,71226,71225,330531,330530,325314,346001,327865,346009,345982,325312,345980,346013,327862,325317,345986,325308,341586,341575,341584,251304,278396,363733,363734,363731,196068,287879,348246,348251,348248,348247,342498,342502,342504,342499,342519,310266,358370,358358,355575,358360,355583,355594,362545,355580,358361,310273,355347,355345,355353,350643,350646,350652,350648,350650,355593,376743,355343,350642,350651,350644,350645,376757,350638,376744,376758,272271,307518,365933,341824,272224,272223,307522,307524,341806,341815,365530,341814,341813,329329';
SELECT *
FROM NUM_S S
JOIN (select regexp_substr(P_NUM,'[^,]+', 1, level) as CAMPO1 from dual
connect by regexp_substr(P_NUM,'[^,]+', 1, level) is not null) D
ON S.NUM = D.CAMPO1
这个想法是做一个"加入"有了这个结果,因为" IN"很迟迟...... 谢谢,
答案 0 :(得分:0)
使用dbms_lob
版instr
和subst
来处理CLOB
。请注意,dbms_lob.substr()
的第二个和第三个参数与标准substr()
相反。没试过!
... select dbms_lob.substr(P_NUM, dbms_lob.instr(',' || P_NUM || ',', ',', 1, level+1)
- dbms_lob.instr(',' || P_NUM || ',', ',', 1, level) - 1,
dbms_lob.instr(',' || P_NUM || ',', ',', 1, level)) as CAMPO1
from dual
connect by dbms_lob.instr(',' || P_NUM || ',', ',', 1, level+1) > 0
答案 1 :(得分:0)
通过将值作为CLOB传递并使用regexp_substr中的CLOB类型变量进行拆分。 然后在“ IN”子句中使用它……比“ JOIN”更好。
<?php
$filename = 'count.txt';
$ip_filename = 'ip.txt';
function hit_count(){
$ip = get_ip();
global $filename, $ip_filename;
if(!in_array($ip, file($ip_filename, FILE_IGNORE_NEW_LINES))){
$current_value = (file_exists($filename)) ? file_get_contents($filename) : 0;
file_put_contents($ip_filename, $ip."\n", FILE_APPEND);
file_put_contents($filename, ++$current_value);
}
}
function get_ip(){
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
}else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip_address = $_SERVER['REMOTE_ADDR'];
}
return $ip_address;
}
hit_count();
?>
答案 2 :(得分:-1)
旧金山! 我想,这可以解决你的问题:
SELECT *
FROM NUM_S S,
( select 407493 CAMPO1 from dual union all
select 407494 from dual union all
select 407492 from dual union all
select 407498 from dual union all
select 407499 from dual union all
select 407500 from dual union all
select 407501 from dual union all
select 407502 from dual union all
select 407503 from dual union all
select 411784 from dual union all
select 411785 from dual union all
select 319473 from dual union all
select 336815 from dual union all
select 319471 from dual union all
select 8380594 from dual union all
select 380600 from dual union all
select 380618 from dual union all
select 374427 from dual union all
select 374429 from dual union all
select 374431 from dual union all
select 331301 from dual union all
select 411790 from dual union all
select 411791 from dual union all
select 411793 from dual union all
select 411794 from dual union all
select 336813 from dual union all
select 359758 from dual union all
select 291179 from dual union all
select 331255 from dual union all
select 259915 from dual union all
select 269523 from dual union all
select 341804 from dual union all
select 359747 from dual union all
select 259925 from dual union all
select 292253 from dual union all
select 292258 from dual union all
select 320204 from dual union all
select 331001 from dual union all
select 331006 from dual union all
select 8380655 from dual union all
select 8380659 from dual union all
select 329328 from dual union all
select 165829 from dual union all
select 177847 from dual union all
select 374448 from dual union all
select 374459 from dual union all
select 374461 from dual union all
select 374476 from dual union all
select 374481 from dual union all
select 329324 from dual union all
select 329327 from dual union all
select 365532 from dual union all
select 257234 from dual union all
select 165833 from dual union all
select 355356 from dual union all
select 355342 from dual union all
select 355339 from dual union all
select 355330 from dual union all
select 374434 from dual union all
select 374439 from dual union all
select 374442 from dual union all
select 374445 from dual union all
select 374471 from dual union all
select 374473 from dual union all
select 374483 from dual union all
select 374484 from dual union all
select 374491 from dual union all
select 374475 from dual union all
select 374479 from dual union all
select 374480 from dual union all
select 374487 from dual union all
select 203947 from dual union all
select 329311 from dual union all
select 341817 from dual union all
select 329322 from dual union all
select 307520 from dual union all
select 329310 from dual union all
select 307519 from dual union all
select 329316 from dual union all
select 329314 from dual union all
select 329313 from dual union all
select 365533 from dual union all
select 365531 from dual union all
select 341805 from dual union all
select 54583 from dual union all
select 54581 from dual union all
select 165832 from dual union all
select 355360 from dual union all
select 376733 from dual union all
select 355334 from dual union all
select 376759 from dual union all
select 376755 from dual union all
select 376747 from dual union all
select 355351 from dual union all
select 336807 from dual union all
select 129845 from dual union all
select 329443 from dual union all
select 311822 from dual union all
select 311817 from dual union all
select 329442 from dual union all
select 354777 from dual union all
select 354772 from dual union all
select 352743 from dual union all
select 352761 from dual union all
select 352754 from dual union all
select 352746 from dual union all
select 355354 from dual union all
select 355357 from dual union all
select 355337 from dual union all
select 350647 from dual union all
select 350637 from dual union all
select 376737 from dual union all
select 376752 from dual union all
select 376750 from dual union all
select 355332 from dual union all
select 376745 from dual union all
select 376749 from dual union all
select 350635 from dual union all
select 376754 from dual union all
select 355349 from dual union all
select 355359 from dual union all
select 203945 from dual union all
select 168819 from dual union all
select 329323 from dual union all
select 329321 from dual union all
select 346006 from dual union all
select 327863 from dual union all
select 278398 from dual union all
select 363735 from dual union all
select 363732 from dual union all
select 276045 from dual union all
select 196069 from dual union all
select 276044 from dual union all
select 196067 from dual union all
select 374435 from dual union all
select 374436 from dual union all
select 374443 from dual union all
select 374432 from dual union all
select 374441 from dual union all
select 374440 from dual union all
select 374446 from dual union all
select 374447 from dual union all
select 374455 from dual union all
select 374456 from dual union all
select 261354 from dual union all
select 284810 from dual union all
select 248122 from dual union all
select 248121 from dual union all
select 248118 from dual union all
select 261357 from dual union all
select 248119 from dual union all
select 257375 from dual union all
select 325321 from dual union all
select 325322 from dual union all
select 77193 from dual union all
select 365932 from dual union all
select 329325 from dual union all
select 348249 from dual union all
select 342503 from dual union all
select 342505 from dual union all
select 326691 from dual union all
select 326694 from dual union all
select 374428 from dual union all
select 352759 from dual union all
select 352744 from dual union all
select 352752 from dual union all
select 352742 from dual union all
select 352751 from dual union all
select 357759 from dual union all
select 363736 from dual union all
select 161519 from dual union all
select 357762 from dual union all
select 24863 from dual union all
select 291182 from dual union all
select 291181 from dual union all
select 259924 from dual union all
select 357771 from dual union all
select 357773 from dual union all
select 300423 from dual union all
select 332873 from dual union all
select 332872 from dual union all
select 332886 from dual union all
select 332877 from dual union all
select 332885 from dual union all
select 332876 from dual union all
select 332878 from dual union all
select 332879 from dual union all
select 135622 from dual union all
select 327853 from dual union all
select 327864 from dual union all
select 359730 from dual union all
select 359748 from dual union all
select 359756 from dual union all
select 327866 from dual union all
select 359744 from dual union all
select 359731 from dual union all
select 327869 from dual union all
select 359752 from dual union all
select 359761 from dual union all
select 374485 from dual union all
select 374486 from dual union all
select 374437 from dual union all
select 374438 from dual union all
select 374444 from dual union all
select 374449 from dual union all
select 374450 from dual union all
select 374451 from dual union all
select 374452 from dual union all
select 374477 from dual union all
select 374478 from dual union all
select 374490 from dual union all
select 374430 from dual union all
select 374457 from dual union all
select 374474 from dual union all
select 374458 from dual union all
select 355340 from dual union all
select 355355 from dual union all
select 355358 from dual union all
select 336814 from dual union all
select 311816 from dual union all
select 329441 from dual union all
select 320878 from dual union all
select 352758 from dual union all
select 24868 from dual union all
select 24866 from dual union all
select 291177 from dual union all
select 291178 from dual union all
select 259914 from dual union all
select 259926 from dual union all
select 259913 from dual union all
select 332884 from dual union all
select 165529 from dual union all
select 345998 from dual union all
select 251302 from dual union all
select 251303 from dual union all
select 251305 from dual union all
select 278394 from dual union all
select 278395 from dual union all
select 248123 from dual union all
select 192412 from dual union all
select 336819 from dual union all
select 336818 from dual union all
select 336822 from dual union all
select 336823 from dual union all
select 319470 from dual union all
select 336821 from dual union all
select 336820 from dual union all
select 336816 from dual union all
select 319472 from dual union all
select 330997 from dual union all
select 100320 from dual union all
select 311820 from dual union all
select 319977 from dual union all
select 316231 from dual union all
select 319466 from dual union all
select 319469 from dual union all
select 319468 from dual union all
select 319467 from dual union all
select 320869 from dual union all
select 320863 from dual union all
select 320866 from dual union all
select 320865 from dual union all
select 320872 from dual union all
select 359750 from dual union all
select 359740 from dual union all
select 300426 from dual union all
select 259928 from dual union all
select 259929 from dual union all
select 259920 from dual union all
select 259917 from dual union all
select 313146 from dual union all
select 135621 from dual union all
select 327856 from dual union all
select 327859 from dual union all
select 355361 from dual union all
select 192411 from dual union all
select 129843 from dual union all
select 324106 from dual union all
select 324093 from dual union all
select 324097 from dual union all
select 142228 from dual union all
select 324103 from dual union all
select 324095 from dual union all
select 324099 from dual union all
select 327858 from dual union all
select 325307 from dual union all
select 325309 from dual union all
select 327860 from dual union all
select 325306 from dual union all
select 168817 from dual union all
select 341577 from dual union all
select 341574 from dual union all
select 351171 from dual union all
select 77192 from dual union all
select 365930 from dual union all
select 272220 from dual union all
select 272221 from dual union all
select 307529 from dual union all
select 161116 from dual union all
select 161113 from dual union all
select 350636 from dual union all
select 355333 from dual union all
select 344875 from dual union all
select 344874 from dual union all
select 359749 from dual union all
select 359743 from dual union all
select 359751 from dual union all
select 359738 from dual union all
select 359741 from dual union all
select 359746 from dual union all
select 359760 from dual union all
select 359759 from dual union all
select 359734 from dual union all
select 359739 from dual union all
select 359755 from dual union all
select 344872 from dual union all
select 359757 from dual union all
select 359732 from dual union all
select 344870 from dual union all
select 344873 from dual union all
select 344877 from dual union all
select 344871 from dual union all
select 344876 from dual union all
select 359754 from dual union all
select 352757 from dual union all
select 352747 from dual union all
select 24869 from dual union all
select 351174 from dual union all
select 351172 from dual union all
select 329452 from dual union all
select 142227 from dual union all
select 324098 from dual union all
select 330999 from dual union all
select 324092 from dual union all
select 324091 from dual union all
select 324104 from dual union all
select 324096 from dual union all
select 324094 from dual union all
select 300421 from dual union all
select 319978 from dual union all
select 129841 from dual union all
select 329439 from dual union all
select 324090 from dual union all
select 324089 from dual union all
select 331002 from dual union all
select 311814 from dual union all
select 170024 from dual union all
select 320875 from dual union all
select 328907 from dual union all
select 328906 from dual union all
select 328909 from dual union all
select 318690 from dual union all
select 354780 from dual union all
select 347762 from dual union all
select 347763 from dual union all
select 272227 from dual union all
select 272228 from dual union all
select 170031 from dual union all
select 320873 from dual union all
select 170032 from dual union all
select 320876 from dual union all
select 170026 from dual union all
select 320874 from dual union all
select 170027 from dual union all
select 328910 from dual union all
select 328914 from dual union all
select 328913 from dual union all
select 328912 from dual union all
select 354776 from dual union all
select 328911 from dual union all
select 328905 from dual union all
select 318689 from dual union all
select 328908 from dual union all
select 318688 from dual union all
select 318687 from dual union all
select 311815 from dual union all
select 311821 from dual union all
select 311819 from dual union all
select 329454 from dual union all
select 329438 from dual union all
select 329455 from dual union all
select 329435 from dual union all
select 329447 from dual union all
select 329453 from dual union all
select 329451 from dual union all
select 329448 from dual union all
select 324101 from dual union all
select 329444 from dual union all
select 324100 from dual union all
select 329449 from dual union all
select 324102 from dual union all
select 329437 from dual union all
select 329445 from dual union all
select 329446 from dual union all
select 127922 from dual union all
select 316234 from dual union all
select 316236 from dual union all
select 127921 from dual union all
select 127920 from dual union all
select 316233 from dual union all
select 127919 from dual union all
select 320871 from dual union all
select 320867 from dual union all
select 320870 from dual union all
select 347775 from dual union all
select 357954 from dual union all
select 357942 from dual union all
select 352750 from dual union all
select 347773 from dual union all
select 347784 from dual union all
select 357947 from dual union all
select 357950 from dual union all
select 347768 from dual union all
select 328924 from dual union all
select 328919 from dual union all
select 328923 from dual union all
select 328925 from dual union all
select 328920 from dual union all
select 328918 from dual union all
select 334534 from dual union all
select 357774 from dual union all
select 259916 from dual union all
select 334531 from dual union all
select 347769 from dual union all
select 272229 from dual union all
select 363738 from dual union all
select 357763 from dual union all
select 363737 from dual union all
select 161518 from dual union all
select 357764 from dual union all
select 357767 from dual union all
select 24870 from dual union all
select 24865 from dual union all
select 334127 from dual union all
select 161517 from dual union all
select 328916 from dual union all
select 311102 from dual union all
select 328922 from dual union all
select 311101 from dual union all
select 328917 from dual union all
select 328921 from dual union all
select 352763 from dual union all
select 347782 from dual union all
select 357939 from dual union all
select 347778 from dual union all
select 357944 from dual union all
select 347783 from dual union all
select 347772 from dual union all
select 357938 from dual union all
select 357940 from dual union all
select 347777 from dual union all
select 357941 from dual union all
select 347757 from dual union all
select 357951 from dual union all
select 347780 from dual union all
select 347776 from dual union all
select 347771 from dual union all
select 352745 from dual union all
select 357945 from dual union all
select 357937 from dual union all
select 357949 from dual union all
select 357946 from dual union all
select 357948 from dual union all
select 347774 from dual union all
select 357943 from dual union all
select 347758 from dual union all
select 347759 from dual union all
select 347779 from dual union all
select 259919 from dual union all
select 334532 from dual union all
select 304154 from dual union all
select 304155 from dual union all
select 313144 from dual union all
select 332881 from dual union all
select 332875 from dual union all
select 71224 from dual union all
select 275110 from dual union all
select 313143 from dual union all
select 345993 from dual union all
select 327855 from dual union all
select 346005 from dual union all
select 345975 from dual union all
select 345999 from dual union all
select 346007 from dual union all
select 325315 from dual union all
select 345985 from dual union all
select 248117 from dual union all
select 284807 from dual union all
select 312615 from dual union all
select 28567 from dual union all
select 312617 from dual union all
select 77189 from dual union all
select 302844 from dual union all
select 302845 from dual union all
select 302842 from dual union all
select 345997 from dual union all
select 346004 from dual union all
select 346012 from dual union all
select 345991 from dual union all
select 345977 from dual union all
select 345987 from dual union all
select 345992 from dual union all
select 346010 from dual union all
select 345990 from dual union all
select 345995 from dual union all
select 346011 from dual union all
select 345996 from dual union all
select 346003 from dual union all
select 325305 from dual union all
select 346000 from dual union all
select 345978 from dual union all
select 345988 from dual union all
select 345981 from dual union all
select 165527 from dual union all
select 71226 from dual union all
select 71225 from dual union all
select 330531 from dual union all
select 330530 from dual union all
select 325314 from dual union all
select 346001 from dual union all
select 327865 from dual union all
select 346009 from dual union all
select 345982 from dual union all
select 325312 from dual union all
select 345980 from dual union all
select 346013 from dual union all
select 327862 from dual union all
select 325317 from dual union all
select 345986 from dual union all
select 325308 from dual union all
select 341586 from dual union all
select 341575 from dual union all
select 341584 from dual union all
select 251304 from dual union all
select 278396 from dual union all
select 363733 from dual union all
select 363734 from dual union all
select 363731 from dual union all
select 196068 from dual union all
select 287879 from dual union all
select 348246 from dual union all
select 348251 from dual union all
select 348248 from dual union all
select 348247 from dual union all
select 342498 from dual union all
select 342502 from dual union all
select 342504 from dual union all
select 342499 from dual union all
select 342519 from dual union all
select 310266 from dual union all
select 358370 from dual union all
select 358358 from dual union all
select 355575 from dual union all
select 358360 from dual union all
select 355583 from dual union all
select 355594 from dual union all
select 362545 from dual union all
select 355580 from dual union all
select 358361 from dual union all
select 310273 from dual union all
select 355347 from dual union all
select 355345 from dual union all
select 355353 from dual union all
select 350643 from dual union all
select 350646 from dual union all
select 350652 from dual union all
select 350648 from dual union all
select 350650 from dual union all
select 355593 from dual union all
select 376743 from dual union all
select 355343 from dual union all
select 350642 from dual union all
select 350651 from dual union all
select 350644 from dual union all
select 350645 from dual union all
select 376757 from dual union all
select 350638 from dual union all
select 376744 from dual union all
select 376758 from dual union all
select 272271 from dual union all
select 307518 from dual union all
select 365933 from dual union all
select 341824 from dual union all
select 272224 from dual union all
select 272223 from dual union all
select 307522 from dual union all
select 307524 from dual union all
select 341806 from dual union all
select 341815 from dual union all
select 365530 from dual union all
select 341814 from dual union all
select 341813 from dual union all
select 329329 from dual) d
where S.NUM = D.CAMPO1