SQL Query过于复杂,但看起来非常简单

时间:2012-06-14 16:58:45

标签: sql long-integer

我最近通过SAS / KXen开发了一个模型,并在SQL中导出了这个得分代码脚本。但是,我得到一个“这个表达式输入不正确,或者它太复杂而无法评估。例如,数字表达式可能包含太多复杂的元素。尝试通过将表达式的一部分分配给变量来简化表达式。”错误3071)“  错误代码,但这个脚本看起来很简单(只是很多情况下)。有什么想法来纠正这个问题?谢谢你:

- KXEN分析框架 - IXI Corp - Equifax_US_Amendment 1_2011_06_30 - Itam Media - - 版权所有KXEN(c)1999-2011 - 模型内置于5.1.4 - 型号名称为auto_digital_targets_model:自动触发(已添加月份) - 型号版本为1

SELECT $Key, "rr_auto", CAST( (CASE 
WHEN "rr_auto" <= -1.077823785821e0 THEN 6.05306179145e-3
WHEN "rr_auto" <= -7.882377294631e-2 THEN 6.05306179145e-3
WHEN "rr_auto" <= -7.782378582091e-2 THEN  ( 1.353029818544e-3*"rr_auto"+6.159712720187e-3 ) 
WHEN "rr_auto" <= -2.27776053868e-2 THEN  ( 2.457958732379e-5*"rr_auto"+6.056327680634e-3 ) 
WHEN "rr_auto" <= -2.27225048152e-2 THEN  ( 2.453076886879e1*"rr_auto"+5.648081862521e-1 ) 
WHEN "rr_auto" <= -2.239074958722e-2 THEN  ( 4.074267027032e0*"rr_auto"+9.998502008548e-2 ) 
WHEN "rr_auto" <= -2.122812183221e-2 THEN  ( 3.317444508635e-1*"rr_auto"+1.618709683277e-2 ) 
WHEN "rr_auto" <= -1.93194152634e-2 THEN  ( 2.02071555915e-1*"rr_auto"+1.343438352374e-2 ) 
WHEN "rr_auto" <= -1.880207986003e-2 THEN  ( 2.750673996089e0*"rr_auto"+6.26719178928e-2 ) 
WHEN "rr_auto" <= -1.629110457901e-2 THEN  ( 5.667204500391e-1*"rr_auto"+2.160902706983e-2 ) 
WHEN "rr_auto" <= -1.422586845977e-2 THEN  ( 8.377498048977e-1*"rr_auto"+2.602439734411e-2 ) 
WHEN "rr_auto" <= -1.272245032419e-2 THEN  ( 1.150811683736e0*"rr_auto"+3.047797758284e-2 ) 
WHEN "rr_auto" <= -1.040443748766e-2 THEN  ( 4.840967408216e-1*"rr_auto"+2.199572317408e-2 ) 
WHEN "rr_auto" <= -9.092699548129e-3 THEN  ( 8.554623797399e-1*"rr_auto"+2.585957746292e-2 ) 
WHEN "rr_auto" <= -7.776715513431e-3 THEN  ( 8.499508924389e-1*"rr_auto"+2.580946310972e-2 ) 
WHEN "rr_auto" <= -7.067411649177e-3 THEN  ( 1.57692895964e0*"rr_auto"+3.146297199262e-2 ) 
WHEN "rr_auto" <= -6.189206328952e-3 THEN  ( 1.028690319931e0*"rr_auto"+2.758833836143e-2 ) 
WHEN "rr_auto" <= -5.106390124994e-3 THEN  ( 8.343071599086e-1*"rr_auto"+2.638525893334e-2 ) 
WHEN "rr_auto" <= -4.068712552393e-3 THEN  ( 9.084700249121e-1*"rr_auto"+2.676396419647e-2 ) 
WHEN "rr_auto" <= -3.236476389088e-3 THEN  ( 1.132730121325e0*"rr_auto"+2.767641630835e-2 ) 
WHEN "rr_auto" <= -2.311112848156e-3 THEN  ( 9.162096194071e-1*"rr_auto"+2.697565065093e-2 ) 
WHEN "rr_auto" <= -1.484466429351e-3 THEN  ( 1.025622271342e0*"rr_auto"+2.722851673069e-2 ) 
WHEN "rr_auto" <= -6.582919879849e-4 THEN  ( 1.026794442297e0*"rr_auto"+2.723025679085e-2 ) 
WHEN "rr_auto" <= -2.372768614338e-4 THEN  ( 2.014918874085e0*"rr_auto"+2.788074106867e-2 ) 
WHEN "rr_auto" <= 7.348116300255e-4 THEN  ( 3.779561021206e-1*"rr_auto"+2.749231131023e-2 ) 
WHEN "rr_auto" <= 1.466972506743e-3 THEN  ( 5.018115401022e-1*"rr_auto"+2.740130213251e-2 ) 
WHEN "rr_auto" <= 1.773626724415e-3 THEN  ( 2.860591190964e0*"rr_auto"+2.394106082303e-2 ) 
WHEN "rr_auto" <= 2.233186453451e-3 THEN  ( 1.908810320657e0*"rr_auto"+2.562915529258e-2 ) 
WHEN "rr_auto" <= 3.00010379386e-3 THEN  ( 6.854086624086e-1*"rr_auto"+2.83612270689e-2 ) 
WHEN "rr_auto" <= 3.936044386394e-3 THEN  ( 5.616294374467e-1*"rr_auto"+2.873257635351e-2 ) 
WHEN "rr_auto" <= 4.478472197817e-3 THEN  ( 1.672101099827e0*"rr_auto"+2.436172170527e-2 ) 
WHEN "rr_auto" <= 5.028307559689e-3 THEN  ( 1.649574041524e0*"rr_auto"+2.446260828431e-2 ) 
WHEN "rr_auto" <= 5.850721137488e-3 THEN  ( 7.37321002719e-1*"rr_auto"+2.904968801315e-2 ) 
WHEN "rr_auto" <= 6.001886640999e-3 THEN  ( 4.011383482005e0*"rr_auto"+9.894094200759e-3 ) 
WHEN "rr_auto" <= 6.746515643618e-3 THEN  ( 1.653178226231e-1*"rr_auto"+3.297770584155e-2 ) 
WHEN "rr_auto" <= 7.617596362912e-3 THEN  ( 1.413192172072e-1*"rr_auto"+3.313961256843e-2 ) 
WHEN "rr_auto" <= 7.733833416175e-3 THEN  ( 7.936496738217e0*"rr_auto"-2.62408254121e-2 ) 
WHEN "rr_auto" <= 8.391316551827e-3 THEN  ( 1.403100618187e0*"rr_auto"+2.428730648814e-2 ) 
WHEN "rr_auto" <= 9.277818407042e-3 THEN  ( 7.717893009392e-1*"rr_auto"+2.95848332808e-2 ) 
WHEN "rr_auto" <= 9.921191372171e-3 THEN  ( 1.063446374344e0*"rr_auto"+2.68788948332e-2 ) 
WHEN "rr_auto" <= 1.04156843028e-2 THEN  ( 1.800201154244e0*"rr_auto"+1.956941703499e-2 ) 
WHEN "rr_auto" <= 1.158256334531e-2 THEN  ( 7.628783379167e-1*"rr_auto"+3.037383363673e-2 ) 
WHEN "rr_auto" <= 1.235526014615e-2 THEN  ( 1.739757568828e0*"rr_auto"+1.905907783277e-2 ) 
WHEN "rr_auto" <= 1.344232502489e-2 THEN  ( 1.236637420602e0*"rr_auto"+2.527525311767e-2 ) 
WHEN "rr_auto" <= 1.446073277534e-2 THEN  ( 1.408996524257e0*"rr_auto"+2.295834774894e-2 ) 
WHEN "rr_auto" <= 1.670931082955e-2 THEN  ( 6.381512876404e-1*"rr_auto"+3.410532701834e-2 ) 
WHEN "rr_auto" <= 1.773094271753e-2 THEN  ( 3.091367987252e0*"rr_auto"-6.886208815554e-3 ) 
WHEN "rr_auto" <= 2.149117445603e-2 THEN  ( 8.399057113687e-1*"rr_auto"+3.303431731419e-2 ) 
WHEN "rr_auto" <= 2.399923014126e-2 THEN  ( 1.887927909042e0*"rr_auto"+1.051109991042e-2 ) 
WHEN "rr_auto" <= 2.403763415355e-2 THEN  ( 1.232951466039e2*"rr_auto"-2.903167468286e0 ) 
WHEN "rr_auto" <= 6.240324243199e-2 THEN  ( 1.235421072765e-4*"rr_auto"+6.055195607717e-2 ) 
WHEN "rr_auto" <= 6.340324247949e-2 THEN  ( 4.739767868535e-3*"rr_auto"+6.026388866803e-2 ) 
WHEN "rr_auto" <= 1.062403242432e0 THEN 6.05644052721e-2
WHEN "rr_auto" > 1.062403232432e0 THEN 6.05644052721e-2
WHEN "rr_auto" >= 1.562403222432e0 THEN 6.05644052721e-2
ELSE 0.0e0
END)  AS FLOAT )
AS PROBA0 
FROM 
(
SELECT $Key, 
( 5.881871083571e-3 + 
CAST( (CASE 
WHEN ( "Comp360" IS NULL ) THEN 4.935327682215e-3
WHEN "Comp360" < 1.418e3 THEN -9.487857723034e-3
WHEN "Comp360" <= 3.73200624627e4 THEN  ( 3.909023382895e-8*"Comp360"-9.543287674603e-3 ) 
WHEN "Comp360" <= 3.735600000001e4 THEN  ( 8.871132410687e-5*"Comp360"-3.318796594523e0 ) 
WHEN "Comp360" <= 4.329428094367e4 THEN  ( 5.757205724121e-7*"Comp360"-2.640298888932e-2 ) 
WHEN "Comp360" <= 5.366200000001e4 THEN  ( 2.151378961397e-7*"Comp360"-1.079182119937e-2 ) 
WHEN "Comp360" <= 5.5568715698e4 THEN  ( 9.963450072002e-7*"Comp360"-5.27129571931e-2 ) 
WHEN "Comp360" <= 7.363500000001e4 THEN  ( 4.97528001222e-8*"Comp360"-1.120439560443e-4 ) 
WHEN "Comp360" <= 7.456136504401e4 THEN  ( 2.470352068076e-7*"Comp360"-1.463893397232e-2 ) 
WHEN "Comp360" <= 1.0e6 THEN  ( 3.909023382895e-8*"Comp360"+8.657270670023e-4 ) 
WHEN "Comp360" >= 1.0e6 THEN 3.995596089595e-2
ELSE 3.0421122029e-3
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "DSIIndex" IS NULL ) THEN -1.22528641747e-3
WHEN "DSIIndex" < 1.0e0 THEN -4.347321884497e-3
WHEN "DSIIndex" <= 6.493600083397e1 THEN  ( 1.895933608395e-7*"DSIIndex"-4.347511477858e-3 ) 
WHEN "DSIIndex" <= 6.500000001e1 THEN  ( 2.415957577851e-2*"DSIIndex"-1.573161432703e0 ) 
WHEN "DSIIndex" <= 1.172985795211e2 THEN  ( 2.975408294321e-5*"DSIIndex"-4.723022491584e-3 ) 
WHEN "DSIIndex" <= 2.1100000001e2 THEN  ( 9.399555019836e-6*"DSIIndex"-2.335465279553e-3 ) 
WHEN "DSIIndex" <= 2.289725274846e2 THEN  ( 4.820657323843e-5*"DSIIndex"-1.052374612368e-2 ) 
WHEN "DSIIndex" <= 2.6700000001e2 THEN  ( 1.09151102402e-5*"DSIIndex"-1.985025587747e-3 ) 
WHEN "DSIIndex" <= 2.677330000448e2 THEN  ( 5.566210791432e-4*"DSIIndex"-1.476885192848e-1 ) 
WHEN "DSIIndex" <= 1.00000000001e3 THEN  ( 1.895933608395e-7*"DSIIndex"+1.286551717494e-3 ) 
WHEN "DSIIndex" >= 9.9999999999e2 THEN 1.476145078333e-3
ELSE 1.342517033075e-3
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "Bal_RetailCredit_New" IS NULL ) THEN 3.435891076066e-4
WHEN "Bal_RetailCredit_New" < 0.0e0 THEN -1.027663996908e-3
WHEN "Bal_RetailCredit_New" <= 2.097900028037e1 THEN  ( 1.695549928681e-8*"Bal_RetailCredit_New"-1.027663996908e-3 ) 
WHEN "Bal_RetailCredit_New" <= 2.100000001e1 THEN  ( 2.950669720501e-2*"Bal_RetailCredit_New"-6.200483169289e-1 ) 
WHEN "Bal_RetailCredit_New" <= 1.017480518373e2 THEN  ( 7.690605743411e-6*"Bal_RetailCredit_New"-5.691783444176e-4 ) 
WHEN "Bal_RetailCredit_New" <= 1.7000000001e2 THEN  ( 1.075773997763e-5*"Bal_RetailCredit_New"-8.812532774423e-4 ) 
WHEN "Bal_RetailCredit_New" <= 7.17208026001e2 THEN  ( 1.35662785556e-6*"Bal_RetailCredit_New"+7.169357833101e-4 ) 
WHEN "Bal_RetailCredit_New" <= 5.47378e5 THEN  ( 1.69554992868e-8*"Bal_RetailCredit_New"+1.677759549427e-3 ) 
WHEN "Bal_RetailCredit_New" >= 5.47378e5 THEN 1.095882683804e-2
ELSE 3.435891076066e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "Bal_OtherNonMortgage_New" IS NULL ) THEN 6.49070492785e-4
WHEN "Bal_OtherNonMortgage_New" < 0.0e0 THEN -9.492489235445e-4
WHEN "Bal_OtherNonMortgage_New" <= 3.196800042199e1 THEN  ( -2.865089974917e-8*"Bal_OtherNonMortgage_New"-9.492489235445e-4 ) 
WHEN "Bal_OtherNonMortgage_New" <= 3.200000001e1 THEN  ( 4.305535039747e-2*"Bal_OtherNonMortgage_New"-1.37734362408e0 ) 
WHEN "Bal_OtherNonMortgage_New" <= 3.949024186059e3 THEN  ( 3.230840719637e-7*"Bal_OtherNonMortgage_New"+4.17249948639e-4 ) 
WHEN "Bal_OtherNonMortgage_New" <= 3.917056e6 THEN  ( -2.865089974917e-8*"Bal_OtherNonMortgage_New"+1.806259859012e-3 ) 
WHEN "Bal_OtherNonMortgage_New" >= 3.917056e6 THEN -1.104209189089e-1
ELSE 6.49070492785e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "HH_AutoFin" IS NULL ) THEN 1.488472474192e-4
WHEN "HH_AutoFin" < 0.0e0 THEN -4.710736071749e-3
WHEN "HH_AutoFin" <= 9.990000138746e0 THEN  ( 1.201538430985e-4*"HH_AutoFin"-4.710736071749e-3 ) 
WHEN "HH_AutoFin" <= 1.000000001e1 THEN  ( 6.400562921613e-2*"HH_AutoFin"-6.429266432734e-1 ) 
WHEN "HH_AutoFin" <= 1.392892551578e1 THEN  ( 2.827546681306e-4*"HH_AutoFin"-5.697897793341e-3 ) 
WHEN "HH_AutoFin" <= 2.200000001e1 THEN  ( 1.586846072613e-4*"HH_AutoFin"-3.969735157996e-3 ) 
WHEN "HH_AutoFin" <= 2.792193557951e1 THEN  ( 1.726678673103e-4*"HH_AutoFin"-4.277366879072e-3 ) 
WHEN "HH_AutoFin" <= 3.300000001e1 THEN  ( 1.915716060023e-4*"HH_AutoFin"-4.805195852855e-3 ) 
WHEN "HH_AutoFin" <= 3.306700001318e1 THEN  ( 5.533049130884e-3*"HH_AutoFin"-1.81073954174e-1 ) 
WHEN "HH_AutoFin" <= 1.0000000001e2 THEN  ( 1.201538430985e-4*"HH_AutoFin"-2.085745675522e-3 ) 
WHEN "HH_AutoFin" >= 9.999999999e1 THEN 9.929638634331e-3
ELSE 1.488472474192e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "HH_AutoBnk" IS NULL ) THEN -1.614032285829e-4
WHEN "HH_AutoBnk" < 0.0e0 THEN -1.838399331938e-3
WHEN "HH_AutoBnk" <= 1.298700017737e1 THEN  ( 1.815003168977e-4*"HH_AutoBnk"-1.838399331938e-3 ) 
WHEN "HH_AutoBnk" <= 1.300000001e1 THEN  ( -6.04737135335e-2*"HH_AutoBnk"+7.85890873095e-1 ) 
WHEN "HH_AutoBnk" <= 1.583695456651e1 THEN  ( -9.644126182477e-5*"HH_AutoBnk"+9.863335632526e-4 ) 
WHEN "HH_AutoBnk" <= 2.000000001e1 THEN  ( 5.242714728826e-5*"HH_AutoBnk"-1.371288666771e-3 ) 
WHEN "HH_AutoBnk" <= 2.424793984083e1 THEN  ( 5.500665361205e-5*"HH_AutoBnk"-1.422878793247e-3 ) 
WHEN "HH_AutoBnk" <= 2.800000001e1 THEN  ( 1.936191250225e-5*"HH_AutoBnk"-5.58567255531e-4 ) 
WHEN "HH_AutoBnk" <= 3.570272726119e1 THEN  ( 1.025214008351e-4*"HH_AutoBnk"-2.887032928851e-3 ) 
WHEN "HH_AutoBnk" <= 4.100000001e1 THEN  ( 1.450836551356e-5*"HH_AutoBnk"+2.552724657839e-4 ) 
WHEN "HH_AutoBnk" <= 4.10590000128e1 THEN  ( -1.48117517394e-2*"HH_AutoBnk"+6.081319367672e-1 ) 
WHEN "HH_AutoBnk" <= 1.0000000001e2 THEN  ( 1.815003168977e-4*"HH_AutoBnk"-7.475999454305e-3 ) 
WHEN "HH_AutoBnk" >= 9.999999999e1 THEN 1.067403223547e-2
ELSE -1.614032285829e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "HH_FMOther" IS NULL ) THEN -1.069677183384e-4
WHEN "HH_FMOther" < 0.0e0 THEN 1.484348281833e-3
WHEN "HH_FMOther" <= 1.398600019024e1 THEN  ( -5.691356379979e-5*"HH_FMOther"+1.484348281833e-3 ) 
WHEN "HH_FMOther" <= 1.400000001e1 THEN  ( -1.381375944085e-2*"HH_FMOther"+1.938875971978e-1 ) 
WHEN "HH_FMOther" <= 1.728919387302e1 THEN  ( -1.15466926935e-4*"HH_FMOther"+2.111502003043e-3 ) 
WHEN "HH_FMOther" <= 2.800000001e1 THEN  ( -6.243543751057e-5*"HH_FMOther"+1.194630301539e-3 ) 
WHEN "HH_FMOther" <= 3.189892742845e1 THEN  ( -7.208279176467e-5*"HH_FMOther"+1.464756220654e-3 ) 
WHEN "HH_FMOther" <= 3.600000001e1 THEN  ( -7.062423979564e-5*"HH_FMOther"+1.418229977258e-3 ) 
WHEN "HH_FMOther" <= 3.606400001304e1 THEN  ( -9.354834814612e-4*"HH_FMOther"+3.255316267722e-2 ) 
WHEN "HH_FMOther" <= 1.0000000001e2 THEN  ( -5.691356379979e-5*"HH_FMOther"+8.684171640062e-4 ) 
WHEN "HH_FMOther" >= 9.999999999e1 THEN -4.822939215973e-3
ELSE -1.069677183384e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "HH_MortgageCredit" IS NULL ) THEN -1.456794544127e-5
WHEN "HH_MortgageCredit" < 0.0e0 THEN -8.384990197329e-4
WHEN "HH_MortgageCredit" <= 2.297700030612e1 THEN  ( 1.325824884976e-5*"HH_MortgageCredit"-8.384990197329e-4 ) 
WHEN "HH_MortgageCredit" <= 2.300000001e1 THEN  ( 2.714272371401e-3*"HH_MortgageCredit"-6.28997013134e-2 ) 
WHEN "HH_MortgageCredit" <= 3.589630763069e1 THEN  ( 1.807532725954e-5*"HH_MortgageCredit"-8.871692981523e-4 ) 
WHEN "HH_MortgageCredit" <= 5.600000001e1 THEN  ( 1.524051891743e-5*"HH_MortgageCredit"-7.854101458584e-4 ) 
WHEN "HH_MortgageCredit" <= 6.37657348849e1 THEN  ( 1.838988781184e-5*"HH_MortgageCredit"-9.617748039452e-4 ) 
WHEN "HH_MortgageCredit" <= 7.000000001e1 THEN  ( 2.122077144275e-5*"HH_MortgageCredit"-1.142288179015e-3 ) 
WHEN "HH_MortgageCredit" <= 7.003000001142e1 THEN  ( 1.667940733899e-3*"HH_MortgageCredit"-1.16412685551e-1 ) 
WHEN "HH_MortgageCredit" <= 1.0000000001e2 THEN  ( 1.325824884976e-5*"HH_MortgageCredit"-5.352711205967e-4 ) 
WHEN "HH_MortgageCredit" >= 9.999999999e1 THEN 7.905537643791e-4
ELSE -1.456794544127e-5
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "HH_1stMortgageCredit_NL12" IS NULL ) THEN -3.851479335309e-4
WHEN "HH_1stMortgageCredit_NL12" < 0.0e0 THEN -5.924051677173e-4
WHEN "HH_1stMortgageCredit_NL12" <= 5.994000087248e0 THEN  ( 1.328845709937e-4*"HH_1stMortgageCredit_NL12"-5.924051677173e-4 ) 
WHEN "HH_1stMortgageCredit_NL12" <= 6.00000001e0 THEN  ( -5.29232194671e-2*"HH_1stMortgageCredit_NL12"+3.174258865351e-1 ) 
WHEN "HH_1stMortgageCredit_NL12" <= 6.094000014465e0 THEN  ( -3.253631499761e-3*"HH_1stMortgageCredit_NL12"+1.940835873104e-2 ) 
WHEN "HH_1stMortgageCredit_NL12" <= 1.0000000001e2 THEN  ( 1.328845709937e-4*"HH_1stMortgageCredit_NL12"-1.229070219259e-3 ) 
WHEN "HH_1stMortgageCredit_NL12" >= 9.999999999e1 THEN 1.205938688011e-2
ELSE -3.851479335309e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "AvgMoB_TotalAllCredit" IS NULL ) THEN -7.682563890863e-5
WHEN "AvgMoB_TotalAllCredit" < 2.0e0 THEN 4.813545150812e-3
WHEN "AvgMoB_TotalAllCredit" <= 7.392800093697e1 THEN  ( -6.861529764345e-5*"AvgMoB_TotalAllCredit"+4.950775746099e-3 ) 
WHEN "AvgMoB_TotalAllCredit" <= 7.400000001e1 THEN  ( 2.788005779118e-3*"AvgMoB_TotalAllCredit"-2.062335098648e-1 ) 
WHEN "AvgMoB_TotalAllCredit" <= 9.715412288377e1 THEN  ( -5.973247057019e-5*"AvgMoB_TotalAllCredit"+4.499120612198e-3 ) 
WHEN "AvgMoB_TotalAllCredit" <= 1.0700000001e2 THEN  ( -1.949069486607e-5*"AvgMoB_TotalAllCredit"+5.894661907816e-4 ) 
WHEN "AvgMoB_TotalAllCredit" <= 1.07316000025e2 THEN  ( 1.46200109428e-3*"AvgMoB_TotalAllCredit"-1.579301552478e-1 ) 
WHEN "AvgMoB_TotalAllCredit" <= 4.2300000001e2 THEN  ( -6.861529764345e-5*"AvgMoB_TotalAllCredit"+6.329473490782e-3 ) 
WHEN "AvgMoB_TotalAllCredit" >= 4.2299999999e2 THEN -2.26947974124e-2
ELSE -7.682563890863e-5
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "NA_AutoBank" IS NULL ) THEN 2.903024345148e-4
WHEN "NA_AutoBank" < 0.0e0 THEN -3.829896504652e-3
WHEN "NA_AutoBank" <= 1.298700116737e-1 THEN  ( -3.169363530011e-4*"NA_AutoBank"-3.829896504652e-3 ) 
WHEN "NA_AutoBank" <= 1.3000001e-1 THEN  ( 1.294408334764e1*"NA_AutoBank"-1.684919183051e0 ) 
WHEN "NA_AutoBank" <= 2.091882296263e-1 THEN  ( 2.093307254777e-2*"NA_AutoBank"-4.909647289856e-3 ) 
WHEN "NA_AutoBank" <= 3.2000001e-1 THEN  ( 1.053502926052e-2*"NA_AutoBank"-2.734499126998e-3 ) 
WHEN "NA_AutoBank" <= 3.849008699287e-1 THEN  ( 1.821171845231e-2*"NA_AutoBank"-5.191039668372e-3 ) 
WHEN "NA_AutoBank" <= 4.7000001e-1 THEN  ( 1.045997845179e-2*"NA_AutoBank"-2.207388276225e-3 ) 
WHEN "NA_AutoBank" <= 5.308603385687e-1 THEN  ( 1.475209472318e-2*"NA_AutoBank"-4.224682923781e-3 ) 
WHEN "NA_AutoBank" <= 5.7000001e-1 THEN  ( 3.611812983299e-2*"NA_AutoBank"-1.556706334239e-2 ) 
WHEN "NA_AutoBank" <= 6.744300149602e-1 THEN  ( 1.333868417139e-2*"NA_AutoBank"-2.582779315276e-3 ) 
WHEN "NA_AutoBank" <= 1.0500000001e2 THEN  ( -3.169363530011e-4*"NA_AutoBank"+6.626980902726e-3 ) 
WHEN "NA_AutoBank" >= 1.0499999999e2 THEN -2.665133616239e-2
ELSE 2.903024345148e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "Cty" IS NULL ) THEN -1.782382804934e-3
WHEN "Cty" < 0.0e0 THEN 1.962640547298e-4
WHEN "Cty" > 1.9e1 THEN -6.707198221185e-3
WHEN ABS( "Cty" - 0.0e0 ) < 10e-9 THEN 1.962640547298e-4
WHEN ABS( "Cty" - 1.0e0 ) < 10e-9 THEN -1.335104218808e-4
WHEN ABS( "Cty" - 2.0e0 ) < 10e-9 THEN -4.632848984915e-4
WHEN ABS( "Cty" - 3.0e0 ) < 10e-9 THEN -7.930593751021e-4
WHEN ABS( "Cty" - 4.0e0 ) < 10e-9 THEN -1.122833851713e-3
WHEN ABS( "Cty" - 5.0e0 ) < 10e-9 THEN -1.452608328323e-3
WHEN ABS( "Cty" - 6.0e0 ) < 10e-9 THEN -1.782382804934e-3
WHEN ABS( "Cty" - 7.0e0 ) < 10e-9 THEN -2.318538385233e-3
WHEN ABS( "Cty" - 8.0e0 ) < 10e-9 THEN -2.648312861844e-3
WHEN ABS( "Cty" - 9.0e0 ) < 10e-9 THEN -2.978087338455e-3
WHEN ABS( "Cty" - 1.0e1 ) < 10e-9 THEN -3.307861815065e-3
WHEN ABS( "Cty" - 1.1e1 ) < 10e-9 THEN -3.637636291676e-3
WHEN ABS( "Cty" - 1.2e1 ) < 10e-9 THEN -3.967410768287e-3
WHEN ABS( "Cty" - 1.3e1 ) < 10e-9 THEN -4.297185244897e-3
WHEN ABS( "Cty" - 1.4e1 ) < 10e-9 THEN -4.626959721508e-3
WHEN ABS( "Cty" - 1.5e1 ) < 10e-9 THEN -4.956734198119e-3
WHEN ABS( "Cty" - 1.6e1 ) < 10e-9 THEN -5.286508674729e-3
WHEN ABS( "Cty" - 1.7e1 ) < 10e-9 THEN -6.047649267963e-3
WHEN ABS( "Cty" - 1.8e1 ) < 10e-9 THEN -6.377423744574e-3
WHEN ABS( "Cty" - 1.9e1 ) < 10e-9 THEN -6.707198221185e-3
WHEN "Cty" >= 0.0e0 AND "Cty" <= 6.0e0 THEN -4.75035309443e-3
WHEN "Cty" >= 7.0e0 AND "Cty" <= 1.6e1 THEN -4.956734198119e-3
WHEN "Cty" >= 1.7e1 AND "Cty" <= 1.9e1 THEN -5.388100314742e-3
ELSE -4.956734198119e-3
END) AS FLOAT )+
CAST( (CASE 
WHEN ( "Den" IS NULL ) THEN -1.370866855927e-3
WHEN "Den" < 0.0e0 THEN 1.187397664919e-4
WHEN "Den" > 1.9e1 THEN -4.731455220138e-3
WHEN ABS( "Den" - 0.0e0 ) < 10e-9 THEN 1.187397664919e-4
WHEN ABS( "Den" - 1.0e0 ) < 10e-9 THEN -1.222356536684e-4
WHEN ABS( "Den" - 2.0e0 ) < 10e-9 THEN -3.632110738288e-4
WHEN ABS( "Den" - 3.0e0 ) < 10e-9 THEN -6.041864939891e-4
WHEN ABS( "Den" - 4.0e0 ) < 10e-9 THEN -8.451619141494e-4
WHEN ABS( "Den" - 5.0e0 ) < 10e-9 THEN -1.08613733431e-3
WHEN ABS( "Den" - 6.0e0 ) < 10e-9 THEN -1.370866855927e-3
WHEN ABS( "Den" - 7.0e0 ) < 10e-9 THEN -1.611842276087e-3
WHEN ABS( "Den" - 8.0e0 ) < 10e-9 THEN -1.852817696247e-3
WHEN ABS( "Den" - 9.0e0 ) < 10e-9 THEN -2.170563863785e-3
WHEN ABS( "Den" - 1.0e1 ) < 10e-9 THEN -2.411539283945e-3
WHEN ABS( "Den" - 1.1e1 ) < 10e-9 THEN -2.652514704105e-3
WHEN ABS( "Den" - 1.2e1 ) < 10e-9 THEN -2.893490124266e-3
WHEN ABS( "Den" - 1.3e1 ) < 10e-9 THEN -3.285602699176e-3
WHEN ABS( "Den" - 1.4e1 ) < 10e-9 THEN -3.526578119336e-3
WHEN ABS( "Den" - 1.5e1 ) < 10e-9 THEN -3.767553539497e-3
WHEN ABS( "Den" - 1.6e1 ) < 10e-9 THEN -4.008528959657e-3
WHEN ABS( "Den" - 1.7e1 ) < 10e-9 THEN -4.249504379817e-3
WHEN ABS( "Den" - 1.8e1 ) < 10e-9 THEN -4.490479799978e-3
WHEN ABS( "Den" - 1.9e1 ) < 10e-9 THEN -4.731455220138e-3
WHEN "Den" >= 0.0e0 AND "Den" <= 5.0e0 THEN -1.32711275447e-3
WHEN "Den" >= 6.0e0 AND "Den" <= 8.0e0 THEN -1.370866855927e-3
WHEN "Den" >= 9.0e0 AND "Den" <= 1.2e1 THEN -1.447637603304e-3
WHEN "Den" >= 1.3e1 AND "Den" <= 1.9e1 THEN -1.598774758054e-3
ELSE -1.370866855927e-3
END) AS FLOAT )+
CAST( (CASE 
WHEN ( "OM_Score_CompBank" IS NULL ) THEN 2.067576391454e-3
WHEN "OM_Score_CompBank" < -1.83990421043e1 THEN 5.862160932523e-3
WHEN "OM_Score_CompBank" <= 5.407811559579e1 THEN  ( -7.321353908529e-5*"OM_Score_CompBank"+4.515101944288e-3 ) 
WHEN "OM_Score_CompBank" <= 5.41506643682e1 THEN  ( -8.486274509202e-3*"OM_Score_CompBank"+4.594775855165e-1 ) 
WHEN "OM_Score_CompBank" <= 5.988691655253e1 THEN  ( -1.796170279856e-4*"OM_Score_CompBank"+9.666564312643e-3 ) 
WHEN "OM_Score_CompBank" <= 6.60103895187e1 THEN  ( -1.66585554025e-4*"OM_Score_CompBank"+8.88614951914e-3 ) 
WHEN "OM_Score_CompBank" <= 6.608293388151e1 THEN  ( -7.954749568922e-3*"OM_Score_CompBank"+5.229858897002e-1 ) 
WHEN "OM_Score_CompBank" <= 1.38554748887e2 THEN  ( -7.321353908529e-5*"OM_Score_CompBank"+2.150865434479e-3 ) 
WHEN "OM_Score_CompBank" >= 1.38554748867e2 THEN -7.99321808788e-3
ELSE 8.430977645999e-4
END) AS FLOAT)+
CAST( (CASE 
WHEN ( "month" IS NULL OR "month" = ''  ) THEN -2.771172542423e-3
WHEN "month" IN('01', '02', '03', '04', '05')  THEN 2.624553958278e-3
WHEN "month" IN('06', '12')  THEN 3.782250849016e-4
ELSE -2.771172542423e-3
END) AS FLOAT )
) AS "rr_auto"
FROM $Dataset
) TMPTABLE0

1 个答案:

答案 0 :(得分:1)

您可以创建一组临时表/表变量,在里面抛出比较和计算常量,然后查询这些表中的值。我想这也会更容易阅读。