16.01.2011, 23:31 | #1 |
Участник
|
Загадочное условие (0=1) в запросах
Добрый день всем.
Сегодня открывал склад в 2009-й аксапте. Обратил внимание, что на оракл уходят запросы в которых есть условие (0=1) Никак не смог осилить весь смысл этого. Зачем ? Последний раз я видел такие условия в трешке и вызвано это было то ли ограничениями прав доступа то ли RLS - в общем из лукапа лезло. А здесь открытие склада. Права админские, т.е. ограничений и RLS нет. Запросы такого вида : Цитата:
CREATE GLOBAL TEMPORARY TABLE "ax_tmp_227593_3073189_15049" ON COMMIT DELETE ROWS AS SELECT A.TRANSRECID AS f1,A.INVENTTRANSID AS f2,A.ITEMID AS f3,A.SETTLETRANSID AS f4,A.QTYSETTLED AS f5,A.COSTAMOUNTSETTLED AS f6,A.COSTAMOUNTADJUSTMENT AS f7,A.BALANCESHEETACCOUNT AS f8,A.OPERATIONSACCOUNT AS f9,A.SETTLEMODEL AS f10,A.DIMENSION AS f11,A.DIMENSION2_ AS f12,A.DIMENSION3_ AS f13,A.DIMENSION4_ AS f14,A.BALANCESHEETPOSTING AS f15,A.OPERATIONSPOSTING AS f16,A.ITEMGROUPID AS f17,A.SETTLETYPE AS f18,A.MARKUPCODE_RU AS f19,TO_DATE('2010-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') AS f20,N'22У000017210' AS f21,0 AS f22,0 AS f23,0 AS f24,N'22' AS DATAAREAID,1 AS RECVERSION,0 AS RECID FROM INVENTSETTLEMENT A WHERE ((SUBSTR(NLS_LOWER(A.DATAAREAID),1,4)=NLS_LOWER(N'XX')) AND ((((((((SUBSTR(NLS_LOWER(A.VOUCHER),1,20)=NLS_LOWER(N'XXXXXXX')) AND (A.TRANSDATE=TO_DATE('2010-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS'))) AND (A.INVENTTRANSCURRENCY_RU=0)) AND (SUBSTR(NLS_LOWER(A.ITEMID),1,20)=NLS_LOWER(N'YYYYYYYY'))) AND (A.CANCELLED=0)) AND (A.TRANSRECID<>0)) AND (A.SETTLEMODEL=7)) AND (0=1))) AND EXISTS (SELECT 'x' FROM INVENTTRANS B WHERE ((SUBSTR(NLS_LOWER(B.DATAAREAID),1,4)=NLS_LOWER(N'XX')) AND ((B.RECID=A.TRANSRECID) AND (B.STATUSISSUE=2))))
Цитата:
CREATE GLOBAL TEMPORARY TABLE "AX_TMP_157017_3063940_7706" ON COMMIT DELETE ROWS AS
SELECT A.TRANSRECID AS F1,A.INVENTTRANSID AS F2,A.ITEMID AS F3,A.SETTLETRANSID AS F4,A.QTYSETTLED AS F5,A.COSTAMOUNTSETTLED AS F6,A.COSTAMOUNTADJUSTMENT AS F7,A.BALANCESHEETACCOUNT AS F8,A.OPERATIONSACCOUNT AS F9,A.SETTLEMODEL AS F10,A.DIMENSION AS F11,A.DIMENSION2_ AS F12,A.DIMENSION3_ AS F13,A.DIMENSION4_ AS F14,A.BALANCESHEETPOSTING AS F15,A.OPERATIONSPOSTING AS F16,A.ITEMGROUPID AS F17,A.SETTLETYPE AS F18,A.MARKUPCODE_RU AS F19,TO_DATE('2010-12-17 00:00:00','YYYY-MM-DD HH24:MI:SS') AS F20,N'15КОР0062907' AS F21,0 AS F22,0 AS F23,0 AS F24,N'15' AS DATAAREAID,1 AS RECVERSION,0 AS RECID FROM INVENTSETTLEMENT A WHERE ((SUBSTR(NLS_LOWER(DATAAREAID),1,4)=NLS_LOWER(N'XX')) AND ((((((((SUBSTR(NLS_LOWER(VOUCHER),1,20)=NLS_LOWER(N'XXXXXXX')) AND (TRANSDATE=TO_DATE('2010-12-17 00:00:00','YYYY-MM-DD HH24:MI:SS'))) AND (INVENTTRANSCURRENCY_RU=0)) AND (SUBSTR(NLS_LOWER(ITEMID),1,20)=NLS_LOWER(N'YYYYYYYYYY'))) AND (CANCELLED=0)) AND (TRANSRECID<>0)) AND (SETTLEMODEL<>7)) AND (0=1))) \Classes\InventCostClosingCancel_WorkInvent\duplicateSettlements Строка 66 X++: // Now duplicate all the ones that are physical value and where the transaction is still // not financially updated // First of all, duplicate all the settlements not type physical value inventSettlement.skipDataMethods(true); insert_recordset inventSettlement ( #InventSettlementFields ) select #InventSettlementFieldsChanged from cancelSettlenent index hint DateVoucherIdx where cancelSettlenent.Voucher == cancelClosing.Voucher && cancelSettlenent.TransDate == cancelClosing.TransDate // <GEEU> && cancelSettlenent.InventTransCurrency_RU == inventTransCurrency // </GEEU> && cancelSettlenent.ItemId == itemId && cancelSettlenent.Cancelled == NoYes::No && cancelSettlenent.TransRecId != 0 && cancelSettlenent.SettleModel == InventSettleModel::PhysicalValue exists join inventTrans index hint RecId where inventTrans.RecId == cancelSettlenent.TransRecId && inventTrans.StatusIssue == StatusIssue::Deducted; |
|