BEGIN
DBMS_ADVISOR.quick_tune(
advisor_name => DBMS_ADVISOR.SQLACCESS_ADVISOR,
task_name => 'test_tune',
attr1 => 'SELECT SUM(TRANSACTION_QUANTITY) / :B5 * -1
FROM MTL_MATERIAL_TRANSACTIONS MMT,
(SELECT TRANSACTION_TYPE_ID,
TRANSACTION_ACTION_ID,
TRANSACTION_SOURCE_TYPE_ID
FROM MTL_TRANSACTION_TYPES
WHERE ATTRIBUTE1 IN (''CONSUMO'')) MTT
WHERE MMT.TRANSACTION_QUANTITY < 0
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.TRANSACTION_ACTION_ID = MTT.TRANSACTION_ACTION_ID
AND MMT.TRANSACTION_SOURCE_TYPE_ID = MTT.TRANSACTION_SOURCE_TYPE_ID
AND TRUNC(MMT.TRANSACTION_DATE, ''MONTH'') >= :B4
AND TRUNC(MMT.TRANSACTION_DATE, ''MONTH'') <= :B3
AND MMT.ORGANIZATION_ID = :B2
AND MMT.INVENTORY_ITEM_ID = :B1
');
END;
/
Query output advisor:
SET LONG 100000
SET PAGESIZE 50000
SELECT DBMS_ADVISOR.get_task_script('test_tune') AS script
FROM dual;
SET PAGESIZE 24
Comentários
Postar um comentário