Java:Sqlexception:位置不支持的 SQL92 令牌:178
Posted
技术标签:
【中文标题】Java:Sqlexception:位置不支持的 SQL92 令牌:178【英文标题】:Java: Sqlexception : Non supported SQL92 token at position: 178 【发布时间】:2021-02-04 05:17:52 【问题描述】:对 Oracle 进行 sql 查询时出现以下错误:
CaughtExceptionType: java.sql.SQLException, CaughtExceptionMessage: Non supported SQL92 token at position: 178, StackTrace: java.sql.SQLException: Non supported SQL92 token at position: 178
at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:1306)
at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:1192)
at oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:326)
at oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:661)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
尝试点击以下查询:
SELECT PERSONID as employeeid, employeeid as employeenumber, employeetype FROM MASTERDATA.EMPLOYEE_DATA WHERE (domainprefix='TCORP' or domainprefix='CORP')
and PERSONID IN(30654,825,28538,33620,870,12938,33317,3487,32846,696,61641,27281,34926,53427,29694,59265,59698,42931,53623,37170,48909,61174,14202,27225,50375,38585,56251,30604,56292,17236,48999,59910,50173,21696,18027,55743,5363,37579,1838,61398,41250,42846,1845,56608,49717,33625,8465,54709,61564,60317,10235,35501,5059,60654,52373,38523,58838,5361,55502,10330,24606,37422,56198,41283,33794,19254,59017,50801,59545,45678,56049,25126,35400,54479,7308,6429,23022,62358,55952,28449,48274,54156,53473,53708,34612,37418,59084,55640,35407,54487,4720,4621,4631,4614,4727,24890,61465,4728,60489,40356,58959,54897,17497,38449,58056,58074,2649,36423,4843,4854,14470,4677,57956,57981,49218,24715,15620,5707,5709,51319,15256,62559,61987,27593,57661,47874,15297,5372,12885,16119,21831,46329,6902,24176,12956,31591,40545,9964,12805,57569,56107,62004,60267,39234,34769,60265,23029,48472,38061,54242,26657,34887,33762,61126,15812,7701,1938,7860,38522,22457,6304,2567,3268,53135,57359,55500,44961,56158,59224,18733,5409,12277,24935,31471,16623,49804,29478,8538,40766,58584,15404,3343,57360,41604,25946,25521,58251,53952,55851,56282,24758,60623,48798,25552,28610,53794,51585,59753,59042,59790,28233,28589,16055,15995,50502,28600,16786,25054,51962,21372,61487,25568,30872,60156,55275,16795,21900,18751,63048,15409,32526,25081,61430,58445,61799,30067,45811,61292,59036,52398,53249,21678,51329,59394,19708,47035,60748,61977,36735,50708,59255,59917,53950,15196,41728,58310,60427,61806,52192,61758,24314,15550,26803,28257,58979,47640,19722,62228,16796,63046,57263,61283,53797,15431,52974,59037,51330,51580,60424,51060,15473,60982,51746,61289,15427,58981,43327,28264,61427,15187,47851,50707,25058,61432,25986,31554,36335,55005,50754,55339,54634,28912,49382,55307,28911,15212,45470,29402,15204,61768,63042,55274,49102,15526,67322,45471,35490,55181,32859,32524,48320,23803,21367,28241,60999,15223,40872,23378,58575,24325,23425,16003,15619,55855,56931,59410,29756,48300,45806,32508,31566,51983,26812,30487,44759,56182,52204,21899,22840,10591,10582,11953,12114,60316,10548,10866,61127,12160,29267,50185,33679,35533,5452,10913,10771,55377,56798,56300,62194,38840,61604,55915,36837,55630,8295,59021,8507,49026,8746,8677,36544,62804,8397,55976,27175,49755,61815,45342,8196,42864,15569,10828,48012,53323,8443,51434,59405,25562,21011,31971,51985,31273,53796,56860,1965,56449,45650,7289,46014,63504,63471,63522,63503,63682,63703,63679,62499,64562,64169,64177,15240,64545,62529,62482,62616,64619,64852,65016,65058,65188,65191,65278,65327,65525,65613,65907,65970,65976,65978,66265,66309,66310,66347,66414,66468,66729,66750,66755,66889,66966,67215,67254,67282,67394,67395,67782,67623,67644,67749,67780,67823,67908,67933,68056,68095,68150,68229,68308,68458,68470,68481,68549,68551,68553,68606,68626,68627,68700,68711,68743,68922,68960,69058,69059,69153,69408,69431,69429,69454,69580,69650,69844,69907,69928,69987,70060,70095,70097,70099,70456,70683,70815,70821,70910,71016,71022,71066,71085,71109,71158,71201,71256,71282,71324,71352,71606,43320,71672,71678,71679,71736,71791,62489,62637,71918,71923,72031,70407,70408,70574,72203,72202,72224,72265,72329,72627,72703,72706,72708,72710,72711,72804,72758,7295,72872,72877,16011,72943,73067,73210,73358,73572,73627,73639,73720,73722,54972,73768,73938,74035,72762,74064,74176,74378,74389,74454,74530,74539,74545,74689,74879,74913,75058,75142,75236,75319,75380,75392,75423,75499,75510,75530,75533,75534,75854,75973,76049,76075,76086,76089,76164,76333,76404,76616,76624,76628,76686,76705,76890,76899,76935,76939,77099,77108,77110,77155,77185,77270,77308,77316,77344,77355,77357,77501,77512,77515,77538,77606,77623,77670,77684,77765,77771,77818,77828,77883,77904,77930,77932,77963,78009,78049,78092,78137,78139,78195,78318,78333,78334,78412,78410,78488,78523,78526,766003,766248,766252,766283,766299,766355,766360,766372,766383,766394,766406,766409,766416,766425,766429,766430,766433,766436,766455,766467,766469,766470,766471,766491,766492,766496,766499,766509,766512,766522,766523,766525,766534,766555,766565,766566,766574,766577,766583,766595,766732,766745,766754,766755,766756,766759,766761,766770,766771,766772,766779,766802,766822,766836,766853,766860,766865,766866,766868,766897,766905,766914,766917,766930,766932,766958,766959,766980,766983,766989,766998,767179,767180,767194,767197,767200,767201,767206,767207,767216,767223,767226,767227,767228,767245,767263,767269,27591,767276,767277,767282,767290,767294,767295,767309,767314,767326,767334,767360,767374,767380,767382,767388,767389,767401,767418,767419,767429,767434,767439,767440,767441,767443,767444,767445,767448,767458,767459,767460,767461,767462,767463,767464,767466,767474,767486,41301,767500,767507,767512,767521,767522,767523,767527,767528,767529,767530,767532,767558,767561,767583,767586,767588,767597,767600,767601,767602,767608,767617,767634,767659,767660,767669,767672,767683,767684,767685,767686,767687,767689,767699,767709,767724,767726,767727,767759,767767,767769,767770,767779,767783,767816,767819,767826,767832,767845,767854,767855,767856,767900,767908,767912,767919,767923,767933,767969,767970,768004,768030,768031,768032,768033,768050,768053,768054,768055,768056,768057,768058,768069,768108,768122,768134,768141,768176,768178,768196,768203,768217,768229,768276,768278,768317,768332,768375,768384,768389,768392,768393,768398,768460,768478,768482,768505,768507,768517,768533,768534,768536,768544,768546,768547,768549,768550,768551,768566,768573,768588,768589,768590,768599,768626,768628,768639,768723,768754,768756,61033,68112,68141,68966,74695,76429,76809,77978,761947,766300,766341,766342,766345,766346,766347,766359,766361,766362,766363,766364,766365,766366,766368,766369,766373,766374,766375,766379,766380,766381,766382,766384,766385,766399,766401,766407,766410,766423,766424,766426,766427,766428,766435,766438,766444,766454,766473,766480,766483,766484,766495,766497,766500,766517,766540,766543,766548,766549,766550,766551,766552,766560,766573,766584,766736,766739,766740,766750,766763,766798,766804,766806,766807,766815,766818,766823,766827,766839,766840,766842,766845,766861,766862,766863,766864,766870,766880,766881,766882,766884,766887,766888,766890,766891,766944,766948,766949,766979,766986,766987,766993,766995,767184,767186,767196,767204,767205,767208,767225,767236,767237,767238,767246,767251,767261,767264,767265,767275,767296,767310,767319,767320,767331,767345,767348,767353,767355,767369,767370,767371,767375,767390,767392,767400,767404,767411,767412,767446,767447,767454,767457,767465,767479,767484,767488,767489,767491,767492,767494,767508,767517,767536,767537,767538,767539,767540,767541,767542,767543,767544,767545,767547,767548,767551,767554,767556,767557,767559,767579,767580,767582,767587,767603,767633,767641,767648,767657,767662,767677,767678,767679,767681,767682,767693,767705,767706,767713,767717,767718,767719,767722,767750,767754,767773,767774,767776,767792,767793,767805,767806,767807,767809,767824,767825,767827,767861,767865,767885,767893,767894,767895,767902,767905,767910,767913,767915,767930,767931,767936,767940,767960,767961,767985,767986,768000,768008,768013,768026,768034,768041,768064,768065,22500,768073,768074,768077,768079,768101,768102,768103,768110,768128,768138,768139,768154,768155,768156,768159,768161,768185,768207,768208,768212,768216,768226,768239,768240,768241,768251,768252,768253,768254,768255,768256,768258,768269,768292,768293,768294,768295,768299,768301,768312,768316,768318,768320,768329,768330,768333,768352,768353,768354,768355,768358,768362,768364,768377,768378,768379,768390,768391,768402,768405,768452,768455,768456,768457,768458,768469,768470,768471,768472,768473,768474,768475,768476,768477,768481,768483,768484,768486,768493,768495,768504,768514,768515,768516,768521,768530,768531,768532,768542,768560,768565,768571,768579,768581,768582,768584,768592,768593,768595,768597,768598,768600,768601,768607,768615,768621,768632,768637,768638,768640,768641,768646,768655,768664,768665,768680,768683,768692,768697,768715,768716,768721,768725,768726,768727,768731,768732,768733,768734,768735,768739,768740,768741,768742,768751,768753,768760,768762)
当我尝试从 oracle 中点击时,我得到以下信息:
ORA-01795: maximum number of expressions in a list is 1000
当我缩短尺寸时,它会显示以下内容:
ORA-01722: invalid number
当我在每个数字周围加上引号时,它运行良好。
问题:我得到“位置不支持的 SQL92 令牌:178”的实际原因是什么?是大小还是无效数字或其他什么?
代码片段:
.setBody(constant(getEmployee() + " and PERSONID IN($exchangeProperty.commaseperatedids)" ))
.to("jdbc:masterdata?outputClass=com.fudiel.integrator.model.Employee")
【问题讨论】:
personid
是 number
吗?还是varchar2
? IN
列表中的文字有 1000 项限制 - 我不确定为什么这会导致您收到不支持的令牌错误,但我不确定花很多钱是否有意义调试的时间,因为你只是想弄清楚为什么你没有得到正确的错误。这些 ID 是从哪里来的?假设源是数据库,您可以在 IN 列表中有一个子查询,它返回任意数量的值。
将这 1000 多个值放入(临时?)表中,然后加入。
【参考方案1】:
您尝试将数字用无效引号括起来,默认情况下不支持在 Oracle “IN”子句中首次尝试使用超过 1000 个条目,因此您可能会更改应用程序以将查询拆分为多个查询他们每个人最多选择 1000 个元素。
【讨论】:
以上是关于Java:Sqlexception:位置不支持的 SQL92 令牌:178的主要内容,如果未能解决你的问题,请参考以下文章
获取异常 java.sql.SQLException: ORA-03115: 不支持的网络数据类型或表示
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK
问题Cause: java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK