Suggest me a good text on SQL/PLSQL book
Please, someone suggest me a good text book on SQL/PLSQL and DataWare housing...I entered this field... Thanks in advance.
For pl/sql, I would recommend Steven Feuerstein: http://amzn.com/0596514468
For the storage of data (at least the features of Oracle support), I think that the Oracle manuals are very good:
http://www.Oracle.com/pls/db112/to_toc?pathname=server.112/e16579/TOC.htm
http://www.Oracle.com/pls/db112/to_toc?pathname=server.112/e16541/TOC.htm
Tags: Database
Similar Questions
-
Subquery Factoring - cardinality estimate good but bad sql response times
This is Exadata 11.2.0.4.0 database, all tables have statistics of up to date. Cardinality estimation is good compared to the actual cardinality. It is a way to tune this sql to reduce its response time.
Sorry for the long sql and the execution plan.
WITH SUBWITH0 AS (SELECT D1.c1 AS c1 FROM ( (SELECT D1.c1 AS c1 FROM (SELECT DISTINCT T7171.CH_ID_SYM AS c1 FROM DW.TM_R_REP T7171 WHERE ( T7171.CHILD_REP_ID = 939 ) ) D1 UNION SELECT D1.c1 AS c1 FROM (SELECT DISTINCT T7167.MEMBER_KEY_SYM AS c1 FROM DW.PC_T_REP T7167 WHERE ( T7167.ANCESTOR_KEY = 939 ) ) D1 ) ) D1 ), SUBWITH1 AS (SELECT D1.c1 AS c1 FROM ( (SELECT D1.c1 AS c1 FROM (SELECT DISTINCT T7171.CH_ID_SYM AS c1 FROM DW.TM_R_REP T7171 WHERE ( T7171.CHILD_REP_ID = 939 ) ) D1 UNION SELECT D1.c1 AS c1 FROM (SELECT DISTINCT T7167.MEMBER_KEY_SYM AS c1 FROM DW.PC_T_REP T7167 WHERE ( T7167.ANCESTOR_KEY = 939 ) ) D1 ) ) D1 ), SUBWITH2 AS (SELECT DISTINCT T7171.CH_ID_SYM AS c1 FROM ( DW.PC_T_REP T7167 LEFT OUTER JOIN DW.TM_R_REP T7171 ON T7167.ANCESTOR_KEY = T7171.CHILD_REP_ID AND T7167.SALESYEARMONTH = T7171.SALES_YEAR_MONTH) LEFT OUTER JOIN DW.TM_REP T6715 ON T7171.CHILD_REP_ID_N = T6715.REP_ID WHERE ( CASE WHEN T7171.CHILD_REP_ID_N LIKE '9999%' THEN concat(concat('UNASSIGNED', lpad(' ', 2)), CAST(T7167.TERRITORY_ID AS VARCHAR ( 20 ) )) ELSE concat(concat(concat(concat(T6715.FIRST_NAME, lpad(' ', 2)), T6715.MIDDLE_NAME), lpad(' ', 2)), T6715.LAST_NAME) END = 'JOES CRAMER' AND T7171.SALES_YEAR_MONTH BETWEEN '201505' AND '201505' AND T7171.CH_ID_SYM IN (SELECT DISTINCT D1.c1 AS c1 FROM SUBWITH0 D1 ) ) ), SUBWITH3 AS (SELECT MEMBER_KEY_SYM AS c1 FROM DW.PC_T_REP T7167 WHERE ( IS_LEAF = 1 ) ), SAWITH0 AS (SELECT DISTINCT CASE WHEN T7171.CHILD_REP_ID_N LIKE '9999%' THEN concat(concat('UNASSIGNED', lpad(' ', 2)), CAST(T7167.TERRITORY_ID AS VARCHAR ( 20 ) )) ELSE concat(concat(concat(concat(T6715.FIRST_NAME, lpad(' ', 2)), T6715.MIDDLE_NAME), lpad(' ', 2)), T6715.LAST_NAME) END AS c1, T6715.REP_NUM AS c2, T7171.SALES_YEAR_MONTH AS c3, T7315.MONTH_NUMERIC AS c4, CASE WHEN T7171.CH_ID_SYM IN (SELECT D1.c1 AS c1 FROM SUBWITH3 D1 ) THEN 1 ELSE 0 END AS c5, CAST(T7171.PARENT_REP_ID AS CHARACTER ( 30 ) ) AS c6, T7171.CH_ID_SYM AS c7, T7171.PARENT_REP_ID_SYM AS c8 FROM DW.TIM_MON T7315 , ( ( DW.PC_T_REP T7167 LEFT OUTER JOIN ( (SELECT TO_NUMBER(TO_CHAR(L_OPP.CloseDate,'YYYYMM')) AS Sales_Year_Month, Tm_Rep.Rep_Id AS Rep_Id, L_OPP.Account_Name__C AS Account_Name__C, L_OPP.Closedate AS Closedate, L_OPP.Forecastcategory AS Forecastcategory, L_OPP.Forecastcategoryname AS Forecastcategoryname, L_User.NAME AS Opp_Owner_S_Sales_Org__C, L_OPP.Opportunity_Id__C AS Opportunity_Id__C, L_OPP.Renewal_Date__C AS Renewal_Date__C, L_OPP.Total_Incremental__C AS Total_Incremental__C, L_OPP.Offer_Code__C AS Offer_Code__C, L_OPP.ID AS Opportunity_ID, L_OPP.TERRITORYID AS TERRITORYID, L_OPP.ACCOUNTID AS ACCOUNTID, L_OPP.OWNERID AS OWNERID, L_OPP.TOTAL_RENEWAL__C AS TOTAL_RENEWAL__C, L_OPP.NAME AS NAME, L_OPP.STAGENAME AS STAGE_NAME, L_OPP.STAGE_DESCRIPTION__C AS STAGE_DESCRIPTION, NVL( CASE WHEN L_OPP.Forecastcategory = 'Closed' AND( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN L_OPP.Total_Incremental__C END , 0) AS Closed_Oppurtunity, CASE WHEN L_OPP.Forecastcategory = 'Closed' AND ( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN 'Closed_Oppurtunity_Drill' END AS Closed_Oppurtunity_Drill, NVL( CASE WHEN L_OPP.Forecastcategoryname IN ('Pipeline', 'Potential', 'Commit') AND ( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN L_OPP.Total_Incremental__C END , 0) AS OPEN_Oppurtunity, CASE WHEN L_OPP.Forecastcategoryname IN ('Pipeline', 'Potential', 'Commit') AND ( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN 'OPEN_Oppurtunity_Drill' END AS OPEN_Oppurtunity_Drill, NVL( CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year1_Closed_Opp, CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN 'Renewal_Year1_Closed_Opp_Drill' END AS Renewal_Year1_Closed_Opp_Drill, NVL( CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year1_OPEN_Opp, CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN 'Renewal_Year1_OPEN_Opp_Drill' END AS Renewal_Year1_OPEN_Opp_Drill, NVL( CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year2_Closed_Opp, CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN 'Renewal_Year2_Closed_Opp_Drill' END AS Renewal_Year2_Closed_Opp_Drill, NVL( CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year2_OPEN_Opp, CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN 'Renewal_Year2_OPEN_Opp_Drill' END AS Renewal_Year2_OPEN_Opp_Drill FROM DW.OPP_C_DIM RIGHT OUTER JOIN RT.L_OPP ON (TO_CHAR(OPP_C_DIM.OFFER_CODE) =TO_CHAR(L_OPP.Offer_Code__C) AND (TO_CHAR(L_OPP.CloseDate,'YYYYMM')) = TO_CHAR(OPP_C_DIM.PERIOD)) LEFT OUTER JOIN RT.L_User ON (L_OPP.Ownerid=L_User.Id) LEFT OUTER JOIN DW.Tm_Rep ON (Tm_Rep.Rep_Num='0' ||L_User.Rep_Employee_Number__C) )) T774110 ON T7167.MEMBER_KEY = T774110.Rep_Id AND T7167.SALESYEARMONTH = T774110.Sales_Year_Month) LEFT OUTER JOIN DW.TM_R_REP T7171 ON T7167.ANCESTOR_KEY = T7171.CHILD_REP_ID AND T7167.SALESYEARMONTH = T7171.SALES_YEAR_MONTH) LEFT OUTER JOIN DW.TM_REP T6715 ON T7171.CHILD_REP_ID_N = T6715.REP_ID WHERE ( T774110.Sales_Year_Month = T7315.YEAR_MONTH AND T7171.CH_ID_SYM IN (SELECT DISTINCT D1.c1 AS c1 FROM SUBWITH2 D1 ) AND T7171.SALES_YEAR_MONTH BETWEEN '201505' AND '201505' AND T7171.CH_ID_SYM IN (SELECT DISTINCT D1.c1 AS c1 FROM SUBWITH1 D1 ) ) ), SAWITH1 AS (SELECT SUM(T774110.Renewal_Year2_OPEN_Opp) AS c9, SUM(T774110.Renewal_Year2_Closed_Opp) AS c10, SUM(T774110.Renewal_Year1_OPEN_Opp) AS c11, SUM(T774110.Renewal_Year1_Closed_Opp) AS c12, SUM(T774110.OPEN_Oppurtunity) AS c13, SUM(T774110.Closed_Oppurtunity) AS c14, T7315.MONTH_NUMERIC AS c15, T7171.CH_ID_SYM AS c16 FROM DW.TIM_MON T7315 , ( RT.L_ACCOUNT T765190 LEFT OUTER JOIN ( DW.PC_T_REP T7167 LEFT OUTER JOIN ( (SELECT TO_NUMBER(TO_CHAR(L_OPP.CloseDate,'YYYYMM')) AS Sales_Year_Month, Tm_Rep.Rep_Id AS Rep_Id, L_OPP.Account_Name__C AS Account_Name__C, L_OPP.Closedate AS Closedate, L_OPP.Forecastcategory AS Forecastcategory, L_OPP.Forecastcategoryname AS Forecastcategoryname, L_User.NAME AS Opp_Owner_S_Sales_Org__C, L_OPP.Opportunity_Id__C AS Opportunity_Id__C, L_OPP.Renewal_Date__C AS Renewal_Date__C, L_OPP.Total_Incremental__C AS Total_Incremental__C, L_OPP.Offer_Code__C AS Offer_Code__C, L_OPP.ID AS Opportunity_ID, L_OPP.TERRITORYID AS TERRITORYID, L_OPP.ACCOUNTID AS ACCOUNTID, L_OPP.OWNERID AS OWNERID, L_OPP.TOTAL_RENEWAL__C AS TOTAL_RENEWAL__C, L_OPP.NAME AS NAME, L_OPP.STAGENAME AS STAGE_NAME, L_OPP.STAGE_DESCRIPTION__C AS STAGE_DESCRIPTION, NVL( CASE WHEN L_OPP.Forecastcategory = 'Closed' AND( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN L_OPP.Total_Incremental__C END , 0) AS Closed_Oppurtunity, CASE WHEN L_OPP.Forecastcategory = 'Closed' AND ( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN 'Closed_Oppurtunity_Drill' END AS Closed_Oppurtunity_Drill, NVL( CASE WHEN L_OPP.Forecastcategoryname IN ('Pipeline', 'Potential', 'Commit') AND ( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN L_OPP.Total_Incremental__C END , 0) AS OPEN_Oppurtunity, CASE WHEN L_OPP.Forecastcategoryname IN ('Pipeline', 'Potential', 'Commit') AND ( OPP_C_DIM.OPPORTUNITIES_GROUP IS NULL ) THEN 'OPEN_Oppurtunity_Drill' END AS OPEN_Oppurtunity_Drill, NVL( CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year1_Closed_Opp, CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN 'Renewal_Year1_Closed_Opp_Drill' END AS Renewal_Year1_Closed_Opp_Drill, NVL( CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year1_OPEN_Opp, CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL1' THEN 'Renewal_Year1_OPEN_Opp_Drill' END AS Renewal_Year1_OPEN_Opp_Drill, NVL( CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year2_Closed_Opp, CASE WHEN L_OPP.Forecastcategory = 'Closed' AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN 'Renewal_Year2_Closed_Opp_Drill' END AS Renewal_Year2_Closed_Opp_Drill, NVL( CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN L_OPP.TOTAL_RENEWAL__C END , 0) AS Renewal_Year2_OPEN_Opp, CASE WHEN L_OPP.Forecastcategory IN ('Pipeline', 'Forecast', 'BestCase') AND OPP_C_DIM.OPPORTUNITIES_GROUP ='RENEWAL2' THEN 'Renewal_Year2_OPEN_Opp_Drill' END AS Renewal_Year2_OPEN_Opp_Drill FROM DW.OPP_C_DIM RIGHT OUTER JOIN RT.L_OPP ON (TO_CHAR(OPP_C_DIM.OFFER_CODE) =TO_CHAR(L_OPP.Offer_Code__C) AND (TO_CHAR(L_OPP.CloseDate,'YYYYMM')) = TO_CHAR(OPP_C_DIM.PERIOD)) LEFT OUTER JOIN RT.L_User ON (L_OPP.Ownerid=L_User.Id) LEFT OUTER JOIN DW.Tm_Rep ON (Tm_Rep.Rep_Num='0' ||L_User.Rep_Employee_Number__C) )) T774110 ON T7167.MEMBER_KEY = T774110.Rep_Id AND T7167.SALESYEARMONTH = T774110.Sales_Year_Month) ON T765190.ID = T774110.ACCOUNTID) LEFT OUTER JOIN DW.TM_R_REP T7171 ON T7167.ANCESTOR_KEY = T7171.CHILD_REP_ID AND T7167.SALESYEARMONTH = T7171.SALES_YEAR_MONTH WHERE ( T774110.Sales_Year_Month = T7315.YEAR_MONTH AND T7171.CH_ID_SYM IN (SELECT DISTINCT D1.c1 AS c1 FROM SUBWITH2 D1 ) AND T7171.SALES_YEAR_MONTH BETWEEN '201505' AND '201505' AND T7171.CH_ID_SYM IN (SELECT DISTINCT D1.c1 AS c1 FROM SUBWITH1 D1 ) ) GROUP BY T7171.CH_ID_SYM, T7315.MONTH_NUMERIC ) SELECT DISTINCT D2.c9 AS c1, D2.c10 AS c2, D2.c11 AS c3, D2.c12 AS c4, D2.c13 AS c5, D2.c14 AS c6, D1.c1 AS c7, D1.c2 AS c8, D1.c3 AS c9, D1.c4 AS c10, D1.c5 AS c11, D1.c6 AS c12, D1.c7 AS c13, D1.c8 AS c14 FROM SAWITH0 D1 INNER JOIN SAWITH1 D2 ON SYS_OP_MAP_NONNULL(D2.c15) = SYS_OP_MAP_NONNULL(D1.c4) AND SYS_OP_MAP_NONNULL(D2.c16) = SYS_OP_MAP_NONNULL(D1.c7) ORDER BY c10, c13
SQL in real time, followed by the details with the Predicate Section of dbms_xplan.display_cursor shot
Global stats
==============================================================================================================================
| Elapsed. CPU | E/S | Request | Cluster | Others | Pick up | Buffer | Read | Read | Write | Write | Cell |
| Time (s) | Time (s) | Waiting (s) | Waiting (s) | Waiting (s) | Waiting (s) | Calls | Gets | Reqs | Bytes | Reqs | Bytes | Unloading |
==============================================================================================================================
| 152. 146. 3.73 | 0.08 | 0.04 | 2.04 | 2. 16 M | 5223. 1 GB | 1. 200KB | 95,11% |
==============================================================================================================================
SQL details surveillance Plan (Plan hash value = 442312180)
===============================================================================================================================================================================================================================================
| ID | Operation | Name | Lines | Cost | Time | Start | Execs | Lines | Read | Read | Cell | MEM | Activity | Activity detail |
| | | | (Estimated) | | Active (s) | Active | | (Real) | Reqs | Bytes | Unloading | (Max) | (%) | (Number of samples).
===============================================================================================================================================================================================================================================
| 0 | SELECT STATEMENT | | | | 1. 152. 1. 0 | | | | | 0.65 | Cpu (1) |
| 1. RANGE OF PARTITION ALL THE | | 1. 3892 | | | 1. | | | | | | |
| 2. ACCESS STORAGE FULL FIRST RANKS TABLE. PC_T_REP | 1. 3892 | | | 37. | 74. 19 MB | 78.45% | 17 M | | |
| 3. TRANSFORMATION OF THE TEMPORARY TABLE. | | | 1. 152. 1. 1. | | | | | |
| 4. LOAD SELECT ACE | | | | 1. + 5 | 1. 1. | | | 278K | | |
| 5. VIEW | | 105. 3980 | 1. + 5 | 1. 13637 | | | | | | |
| 6. SORT UNIQUE | | 105. 3980 | 1. + 5 | 1. 13637 | | | | 757K | | |
| 7. UNION-ALL | | | | 1. + 5 | 1. 14033. | | | | | |
| 8. STORE TABLE FULL ACCESS | TM_R_REP | 22. 88. 1. + 5 | 1. 36. | | | | | |
| 9. RANGE OF PARTITION ALL THE | | 83. 3890. 1. + 5 | 1. 13997. | | | | | |
| 10. STORE TABLE FULL ACCESS | PC_T_REP | 83. 3890. 6. + 0 | 37. 13997. | | | 2 M | 0.65 | Smart cell table scan (1) |
| 11. LOAD SELECT ACE | | | | 1. + 5 | 1. 1. | | | 278K | | |
| 12. HASH UNIQUE | | 1. 4166. 1. + 5 | 1. 1. | | | 479K | | |
| 13. HASH JOIN | | 1. 4165 | 1. + 5 | 1. 444. | | | 1 M | | |
| 14. JOIN FILTER PART CREATE | : BF0000 | 3. 4075 | 1. + 5 | 1. 549. | | | | | |
| 15. OUTER HASH JOIN | | 3. 4075 | 1. + 5 | 1. 549. | | | 1 M | | |
| 16. HASH JOIN | | 3. 4068 | 1. + 5 | 1. 549. | | | 2 M | | |
| 17. VIEW | | 105. 3980 | 1. + 5 | 1. 13637 | | | | | | |
| 18. SORT UNIQUE | | 105. 3980 | 1. + 5 | 1. 13637 | | | | 757K | | |
| 19. UNION-ALL | | | | 1. + 5 | 1. 14033. | | | | | |
| 20. STORE TABLE FULL ACCESS | TM_R_REP | 22. 88. 1. + 5 | 1. 36. | | | | | |
| 21. RANGE OF PARTITION ALL THE | | 83. 3890. 1. + 5 | 1. 13997. | | | | | |
| 22. STORE TABLE FULL ACCESS | PC_T_REP | 83. 3890. 1. + 5 | 37. 13997. | | | 2 M | | |
| 23. STORE TABLE FULL ACCESS | TM_R_REP | 1884 | 88. 1. + 5 | 1. 1929 | | | | | | |
| 24. STORE TABLE FULL ACCESS | TM_REP | 7136 | 7. 1. + 5 | 1. 7137 | | | | | | |
| 25. RANGE OF SINGLE PARTITION | | 7449. 90. 1. + 5 | 1. 7449. | | | | | |
| 26. STORE TABLE FULL ACCESS | PC_T_REP | 7449. 90. 1. + 5 | 1. 7449. | | | | | |
| 27. SORT UNIQUE | | 1. 26032 | 1. 152. 1. 1. | | | 2048 | | |
| 28. OUTER HASH JOIN | | 1. 26031 | 72. + 81 | 1. 8238 | | | | 4 M | | |
| 29. FILTER | | | | 74. + 79 | 1. 8238 | | | | | 1.96 | Cpu (3) |
| 30. NESTED EXTERNAL LOOPS | | 1. 26027 | 72. + 81 | 1. 15 M | | | | | 3.27 | Cpu (5) |
| 31. HASH JOIN | | 1. 26026 | 72. + 81 | 1. 15 M | | | | 447K | 18.95 | Cpu (29) |
| 32. OUTER HASH JOIN | | 1. 13213 | 1. + 81 | 1. 332. | | | 452K | | |
| 33. HASH JOIN | | 1. 13206 | 1. + 81 | 1. 332. | | | 1 M | | |
| 34. HASH JOIN | | 1. 13199. 1. + 81 | 1. 444. | | | 434K | | |
| 35. HASH JOIN | | 1. 13197. 1. + 81 | 1. 444. | | | 290K | | |
| 36. JOIN CREATE FILTER | : BF0000 | 1. 13195. 1. + 81 | 1. 444. | | | | | |
| 37. HASH JOIN | | 1. 13195. 1. + 81 | 1. 444. | | | 2 M | | |
| 38. THE CARTESIAN MERGE JOIN. | 27. 13107 | 1. + 81 | 1. 7449. | | | | | |
| 39. HASH JOIN | | 1. 13017. 77. + 5 | 1. 1. | | | 750K | | |
| 40. STORE TABLE FULL ACCESS | TIM_MON | 1. 4. 1. + 5 | 1. 1. | | | | | |
| 41. VIEW | | 1. 13013. 1. + 81 | 1. 1. | | | | | |
| 42. HASH GROUP BY. | 1. 13013. 1. + 81 | 1. 1. | | | 482K | | |
| 43. OUTER HASH JOIN | | 1. 13012. 77. + 5 | 1. 8238 | | | | 4 M | | |
| 44. NESTED LOOPS | | 1. 13008. 77. + 5 | 1. 8238 | | | | | | |
| 45. FILTER | | | | 77. + 5 | 1. 8238 | | | | | 2.61 | Cpu (4) |
| 46. NESTED EXTERNAL LOOPS | | 1. 13007. 77. + 5 | 1. 15 M | | | | | 4.58. Cpu (7) |
| 47. HASH JOIN | | 1. 13006. 77. + 5 | 1. 15 M | | | | 424K | 11.76. Cpu (18) |
| 48. HASH JOIN | | 1. 193. 1. + 5 | 1. 332. | | | 1 M | | |
| 49. HASH JOIN | | 1. 186. 1. + 5 | 1. 444. | | | 420K | | |
| 50. HASH JOIN | | 4. 184. 1. + 5 | 1. 444. | | | 290K | | |
| 51. JOIN CREATE FILTER | : BF0002 | 1. 94. 1. + 5 | 1. 1. | | | | | |
| 52. JOIN FILTER PART CREATE | : BF0001 | 1. 94. 1. + 5 | 1. 1. | | | | | |
| 53. HASH JOIN | | 1. 94. 1. + 5 | 1. 1. | | | 290K | | |
| 54. JOIN CREATE FILTER | : BF0003 | 1. 6. 1. + 5 | 1. 1. | | | | | |
| 55. THE CARTESIAN MERGE JOIN. | 1. 6. 1. + 5 | 1. 1. | | | | | |
| 56. STORE TABLE FULL ACCESS | TIM_MON | 1. 4. 1. + 5 | 1. 1. | | | | | |
| 57. KIND OF BUFFER. | 1. 2. 1. + 5 | 1. 1. | | | 2048 | | |
| 58. VIEW | VW_NSO_1 | 1. 2. 1. + 5 | 1. 1. | | | | | |
| 59. UNIQUE HASH | | 1. | 1. + 5 | 1. 1. | | | 485K | | |
| 60. VIEW | | 1. 2. 1. + 5 | 1. 1. | | | | | |
| 61. STORE TABLE FULL ACCESS | SYS_TEMP_0FD9D71E1_B445AE36 | 1. 2. 1. + 5 | 1. 1. | | | | | |
| 62. USE OF JOIN FILTER | : BF0003 | 1884 | 88. 1. + 5 | 1. 1. | | | | | |
| 63. STORE TABLE FULL ACCESS | TM_R_REP | 1884 | 88. 1. + 5 | 1. 1. | | | | | |
| 64. USE OF JOIN FILTER | : BF0002 | 7449. 90. 1. + 5 | 1. 444. | | | | | |
| 65. RANGE OF SINGLE PARTITION | | 7449. 90. 5. + 1 | 1. 444. | | | | 0.65 | Cpu (1) |
| 66. STORE TABLE FULL ACCESS | PC_T_REP | 7449. 90. 1. + 5 | 1. 444. | | | | | |
| 67. VIEW | | 105. 2. 1. + 5 | 1. 13637 | | | | | | |
| 68. STORE TABLE FULL ACCESS | SYS_TEMP_0FD9D71E0_B445AE36 | 105. 2. 1. + 5 | 1. 13637 | | | | | | |
| 69. STORE TABLE FULL ACCESS | TM_REP | 7136 | 7. 1. + 5 | 1. 7137 | | | | | | |
| 70. STORE TABLE FULL ACCESS | L_OP | 19382 | 12813 | 77. + 5 | 1. 43879 | 565. 551 MB | 98.18% | 15 M | | |
| 71. TABLE ACCESS BY INDEX ROWID | L_US | 1. 1. 79. + 3 | 15 M | 15 M | 26. 208KO | | | 19.61 | Cpu (30) |
| 72. INDEX UNIQUE SCAN | L_US_PK | 1. | 77. + 5 | 15 M | 15 M | 2. 16384. | | 9 h 15 | Cpu (14) |
| 73. INDEX UNIQUE SCAN | L_A_PK | 1. 1. 151. + 2 | 8238 | 8238 | 3269 | 26 MB | | | 2.61 | Cpu (1) |
| | | | | | | | | | | | | | | monobloc cell physical read (3) |
| 74. STORE TABLE FULL ACCESS | OPP_C_DIM | 2304 | 4. 1. + 81 | 1. 2304 | 3. 112 KB | | | | |
| 75. KIND OF BUFFER. | 7449. 13107 | 1. + 81 | 1. 7449. | | | 370K | | |
| 76. RANGE OF SINGLE PARTITION | | 7449. 90. 1. + 81 | 1. 7449. | | | | | |
| 77. STORE TABLE FULL ACCESS | PC_T_REP | 7449. 90. 1. + 81 | 1. 7449. | | | | | |
| 78. STORE TABLE FULL ACCESS | TM_R_REP | 1884 | 88. 1. + 81 | 1. 1929 | | | | | | |
| 79. VIEW | | 1. 2. 1. + 81 | 1. 1. | | | | | |
| 80. USE OF JOIN FILTER | : BF0000 | 1. 2. 1. + 81 | 1. 1. | | | | | |
| 81. STORE TABLE FULL ACCESS | SYS_TEMP_0FD9D71E1_B445AE36 | 1. 2. 1. + 81 | 1. 1. | | | | | |
| 82. VIEW | | 105. 2. 1. + 81 | 1. 13637 | | | | | | |
| 83. STORE TABLE FULL ACCESS | SYS_TEMP_0FD9D71E0_B445AE36 | 105. 2. 1. + 81 | 1. 13637 | | | | | | |
| 84. STORE TABLE FULL ACCESS | TM_REP | 7136 | 7. 1. + 81 | 1. 7137 | | | | | | |
| 85. STORE TABLE FULL ACCESS | TM_REP | 7136 | 7. 1. + 81 | 1. 7137 | | | | | | |
| 86. STORE TABLE FULL ACCESS | L_OP | 19382 | 12813 | 72. + 81 | 1. 43879 | 593. 577 MB | 98,44% | 15 M | | |
| 87. TABLE ACCESS BY INDEX ROWID | L_US | 1. 1. 72. + 81 | 15 M | 15 M | | | | | 13.73. Cpu (21) |
| 88. INDEX UNIQUE SCAN | L_US_PK | 1. | 73. + 80 | 15 M | 15 M | | | | | 9.80 | Cpu (15) |
| 89. STORE TABLE FULL ACCESS | OPP_C_DIM | 2304 | 4. 1. 152. 1. 2304 | | | | | | |
===============================================================================================================================================================================================================================================
Information of predicates (identified by the operation identity card):
---------------------------------------------------
2. (("MEMBER_KEY_SYM" =: B1 ET "IS_LEAF" = 1) filter)
8 - storage("T7171".") CHILD_REP_ID "= 939)
filter ("T7171". ("CHILD_REP_ID" = 939)
10 - storage("T7167".") ANCESTOR_KEY "= 939)
filter ("T7167". ("ANCESTOR_KEY" = 939)
13 - access("T7167".") SALESYEARMONTH "= 'T7171'." SALES_YEAR_MONTH' AND 'T7167 '. "ANCESTOR_KEY"= "T7171". ("' CHILD_REP_ID")
filter (CASE WHEN TO_CHAR ("T7171". "CHILD_REP_ID_N") AS 9999% ' THEN 'ALL UNASSIGNED' | " CAST ("T7167". ("TERRITORY_ID" AS A VARCHAR (20)) ELSE 'T6715 '. "" NAME "| "
'||" T6715 ". "" MIDDLE_NAME "| " '||" T6715 ". ("" LAST_NAME "END ="JOES CRAMER")
15 - access("T7171".") CHILD_REP_ID_N "= 'T6715'." REP_ID")
16 - access("T7171".") CH_ID_SYM '= 'D1'.' C1")
20 - storage("T7171".") CHILD_REP_ID "= 939)
filter ("T7171". ("CHILD_REP_ID" = 939)
22 - storage("T7167".") ANCESTOR_KEY "= 939)
filter ("T7167". ("ANCESTOR_KEY" = 939)
23 - storage("T7171".") SALES_YEAR_MONTH "= 201505)
filter ("T7171". ("SALES_YEAR_MONTH" = 201505)
26 - storage("T7167".") SALESYEARMONTH "= 201505)
filter ("T7167". ("SALESYEARMONTH" = 201505)
28 - access (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM") = TO_CHAR ("OPP_C_DIM". " PERIOD") AND
TO_CHAR ("OPP_C_DIM". "OFFER_CODE") = "L_OP". ("' OFFER_CODE__C")
29 - filter("TM_REP".") REP_NUM "=" 0"|" » « « « L_US «. » REP_EMPLOYEE_NUMBER__C')
31 - access("T7315".") YEAR_MONTH «= TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP".» CLOSEDATE"),"YYYYMM")) AND
'T7167 '. «SALESYEARMONTH «= TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP".» (((("" CLOSEDATE "),"YYYYMM")))
32 - access("T7171".") CHILD_REP_ID_N "= 'T6715'." REP_ID")
33 - access("T7167".") MEMBER_KEY "=" TM_REP. " ("" REP_ID ")
34 - access("T7171".") CH_ID_SYM '= 'D1'.' C1")
35 - access("T7171".") CH_ID_SYM '= 'D1'.' C1")
37 - access (SYS_OP_MAP_NONNULL ("D2". "C16") = SYS_OP_MAP_NONNULL ("T7171". " CH_ID_SYM") AND"T7167 ". "SALESYEARMONTH"= "T7171". "" SALES_YEAR_MONTH "AND
'T7167 '. "ANCESTOR_KEY"= "T7171". ("' CHILD_REP_ID")
39 - access (SYS_OP_MAP_NONNULL ("D2". "C15") = SYS_OP_MAP_NONNULL ("T7315". " MONTH_NUMERIC'))
40 - storage("T7315".") YEAR_MONTH "= 201505)
filter ("T7315". ("YEAR_MONTH" = 201505)
43 - access (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM") = TO_CHAR ("OPP_C_DIM". " PERIOD") AND
TO_CHAR ("OPP_C_DIM". "OFFER_CODE") = "L_OP". ("' OFFER_CODE__C")
45 - filter("TM_REP".") REP_NUM "=" 0"|" » « « « L_US «. » REP_EMPLOYEE_NUMBER__C')
47 - access("T7315".") YEAR_MONTH «= TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP".» CLOSEDATE"),"YYYYMM")) AND
'T7167 '. «SALESYEARMONTH «= TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP".» (((("" CLOSEDATE "),"YYYYMM")))
48 - access("T7167".") MEMBER_KEY "=" TM_REP. " ("" REP_ID ")
49 - access("T7171".") CH_ID_SYM '= 'D1'.' C1")
50 - access("T7167".") SALESYEARMONTH "= 'T7171'." SALES_YEAR_MONTH' AND 'T7167 '. "ANCESTOR_KEY"= "T7171". ("' CHILD_REP_ID")
53 - access("T7171".") CH_ID_SYM "=" C1")
56 - storage("T7315".") YEAR_MONTH "= 201505)
filter ("T7315". ("YEAR_MONTH" = 201505)
63 - storage (("T7171". "SALES_YEAR_MONTH" = 201505 AND SYS_OP_BLOOM_FILTER (: BF0000, "T7171" ".") CH_ID_SYM')))
filter (("T7171". "SALES_YEAR_MONTH" = 201505 AND SYS_OP_BLOOM_FILTER (: BF0000, "T7171" ".") CH_ID_SYM')))
66 - storage (("T7167". "SALESYEARMONTH" = 201505 AND SYS_OP_BLOOM_FILTER (: BF0000, "T7167" ".") SALESYEARMONTH', 'T7167 '. ((("" ANCESTOR_KEY ")))
filter (("T7167". "SALESYEARMONTH" = 201505 AND SYS_OP_BLOOM_FILTER (: BF0000, "T7167" ".") SALESYEARMONTH', 'T7167 '. ((("" ANCESTOR_KEY ")))
70 - storage ((TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) > = 201505 AND "
TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) (< = 201505)) "
filter ((TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) > = 201505 AND "
TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) (< = 201505)) "
72 - access("L_OP".") OWNERID "=" L_US. " (' ' ID ')
73 - access("T765190".") WITH THE ID "=" L_OP. " ("' ACCOUNTID ')
77 - storage("T7167".") SALESYEARMONTH "= 201505)
filter ("T7167". ("SALESYEARMONTH" = 201505)
78 - storage("T7171".") SALES_YEAR_MONTH "= 201505)
filter ("T7171". ("SALES_YEAR_MONTH" = 201505)
81 - storage (SYS_OP_BLOOM_FILTER (: BF0000, "C0"))
filter (SYS_OP_BLOOM_FILTER (: BF0000, "C0"))
86 - storage ((TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) > = 201505 AND "
TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) (< = 201505)) "
filter ((TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) > = 201505 AND "
TO_NUMBER (TO_CHAR (INTERNAL_FUNCTION ("L_OP". "CLOSEDATE"), "YYYYMM")) (< = 201505)) "
88 - access("L_OP".") OWNERID "=" L_US. " (' ' ID ')
Note
-----
-dynamic sample used for this survey (level = 4)
-Automatic DOP: calculated degree of parallelism is 1 because of the parallel threshold
Although the table meet statistical why dynamic sampling is to be used? Why 15 million times ID 71, 72, 87 and 88 are executed, curious because that is where most of the time is spent. How can we reduce this 15 million probes?
Suggestions to reduce the response time sql would be useful.
Post edited by: Yasu masking of sensitive information (literal value)
YASU says:
For educational purposes could you please clarify why the optimizer has evaluated the join condition in the functioning of the FILTER to 15 million lines?
This is unusual, but TM_REP is attached to another PC_T_REP table using a join operation, so maybe it's the explanation of why it is moved to a FILTER operation had been delayed - could also be a side effect of the combination of ANSI join processing (Oracle internally transforms ANSI joins in Oracle join syntax) and the transformation of outer join internally.
Very curious to know how this is possible, could you please give us the hint/tour, you can use to push the inner join down execution plan is evaluated as soon as possible to reduce the data to be processed? I have a sql plus, where the situation is almost similar - ranks of filtering 2 million to the hash JOIN operation and return 0 rows. I can post the details of sql here but not to mix different sql question in the same post. Please let me know if you would like to give the details of this sql in this same thread, or a different thread? I searched for this type of information, but to no avail, so could you please suggest how this is possible, if not for this long sql then at least please provide a few examples/suggestions?
Normally you can influence this through the appropriate join order, for example with the help of the LEADING indicator, for filter indicator PUSH_SUBQ subqueries can also be useful for filtering at the beginning. But here the comment of Franck is particularly important - by leaning on the Cartesian join this problem here should be less relevant.
As I already said I would recommend here from scratch and think that all that this query is supposed to average and the question why most outer joins is actually converted into inner joins - the current query example returns the correct result?
Randolf
-
can I get the full text of sql from aud$ data table
Hi gems... good afternoon...
We try to understand the name of the tables and actions associated with their subject (select, insert, update, delete) what we will do with our application.
So I enabled the audit parameter audit_trail = db, extended. After that I can get the records required of the dba_audit_trail_view by the following query:
I'm satisfactory output by that. But the problem is that some of the requests in hibernation is too large (maybe 10000 characters... "I'm not sure), these queries do not come completely. This is why I don't get some important information such as the WHERE the FROM clause condition, etc.select d.entryid, d.timestamp, d.obj_name, d.action_name, d.sql_text from dba_audit_trail d where d.username='TEST_SCHEMA' and d.obj_name not like '%$%' and d.obj_name not in ('_CURRENT_EDITION_OBJ','ALL_OBJECTS','_ACTUAL_EDITION_OBJ','ALL_SYNONYMS','_ALL_SYNONYMS_TREE', '_ALL_SYNONYMS_FOR_AUTH_OBJECTS','_ALL_SYNONYMS_FOR_SYNONYMS','ALL_SYNONYMS','DBA_SYNONYMS','PLSQLDEV_AUTHORIZATION', 'USER_OBJECTS','_ALL_SYNONYMS_FOR_AUTH_OBJECTS','DUAL','_BASE_USER','ALL_TAB_COLUMNS','ALL_COL_COMMENTS','ALL_TAB_COLS', 'NLS_DATABASE_PARAMETERS','ALL_SOURCE','ALL_ERRORS') order by d.timestamp desc;
There is no sql_id column in the table of $ aud.
Is it possible to get the full text of sql... Please help...for this view sql_text column is different... try column sql_text a60000 and answer format which is the result
-
I need issue of SQL/PLSQL for practice
Hi all
I need to question of SQL/PLSQL for practice; could everything on send me the URL.
I need only the PDF file.
Thank you
GregoryHere is the link for the link of PL/SQL oracle
http://www.Oracle.com/pls/db111/portal.portal_db?selected=5&frame=
IN the section of SQL and PL/SQL language, there is the language Pl/SQL.. PDF reference .you can download... its preety good to start.
-
Unable to see the full text of SQL in the sessions of the monitor
Hi guys,.
I use SQL Developer 3.2 and when I followed sessions.
I'm unable to see the full text of sql. Can someone guide me what setting do I do to see the full text of sql.
Thank you
Deepak
you do not see the full text of design, this data dictionary that col stores only the first 1000 characters of the query
You can Customize this report to get the full text if you wish... just read the column full_text instead, which is a CLOB
in fact, this is the story in v3.2 - If you upgrade to version 4.0, we wonder SQL_FULLTEXT, and also make it more enjoyable to read code, throwing in a code editor
-
Pls suggest me a good model for a decimal field
Hello
Pls help me by suggesting a good model for a decimal field to the value of the amount, my problem is as below
The lengths are as below,
I specified the reason for this field as below (its as-> {} null | zero {} | num {($z9,999.99)} | {} num.decimal), pls note that I did ' t put any model in the tab CHANGE
(1) but, when the user enters the value get as on the form.
But I want that the foregoing as just $1.10 or $1,1
(2) in addition, make me as below for any other value,
But I want that the foregoing as just $0.60 or $0,6
(3) another case like below,
But I want him above looks like just $12 345 (if possible, if this is not possible it is OK)
(4) when the form is rendered on the browser see the field as below,
But, once the user put the cursor/clickedon field zero is failing as below,
but, I don't want default zero as above, with just white is eager (if its possible so this is nice, if this is not possible it is OK), in fact, I have another decimal field as below with the model, (pls note this field also has a ppatern of CHANGE as well)
The EDITING model is as below,
so this aspect of the rendering of form field is as below,
Once the user put the cursor / clikced bile field looks like as below
It's fine for me instead of zero defect as described in question # 4
Pls suggest me a good role model for my 4 questions above
Thank you
So use the locale of the system of the spectator and just put the model as:
NUM. Currency {ZZ, zz9. ZZ}
-
sql/PLSQL algorithm: is a rectangle filled with the other rectangles
Hello
I have 2 tables: T1 and T2:
FromPeriod, ToPeriod are positive whole number without decimal point.with T1 as (select 2 FromPeriod, 4 ToPeriod, 10 FromSum, 12 ToSum from dual) select * from t1; with T2 as (select 1 FromPeriod, 2 ToPeriod, 9 FromSum, 5 ToSum from dual union all select 1 FromPeriod, 3 ToPeriod, 9 FromSum, 4 ToSum from dual union all select 2 FromPeriod, 5 ToPeriod, 9 FromSum, 11 ToSum from dual union all select 2 FromPeriod, 5 ToPeriod, 11 FromSum, 12 ToSum from dual) select * from t2;
FromSum, ToSum are positive numbers can have the comma.
Table T1 contains unique in the columns 'FromPeriod-ToPeriod' points, that means that is there is a record where "FromPeriod-ToPeriod" = [2-4], then it is certainly not rendered as "FromPeriod-ToPeriod" = [1-4] keys wich [2-4] period, such a thing is not possible in table P1, it contains only unique periods that do not touch. Then the records with periods [2-4], [5-6] are ok in there.
But table T2 allows periods affecting somehow. You can see that T2 contains "FromPeriod-ToPeriod" = [1-2] and also [1-3] that touch each other.
We can look at the two tables T1 and T2 as rectangles where X - axis is the values of the axes and the "FromPeriod-ToPeriod" is [FromSum, ToSum].
I need sql/plsql algorithm that returns true if the rectangle of table T1 is discovered/filled with rectangles in table T2. If the rectangle in T1 is completely filled or even more filled than necessary, then algorithm should return true. If even a small neighborhood in rectangle T1 is not filled by rectangles in T2, then the algorithm must return false.
As see you in the sample data, T1 has a rectangle: [2-4; 10-12] T2 contains 4 mentions that fill/overdraw this area defined by T1. So for the moment the algorithm must return true.
I do not know how to write effective elsewhere such algorithm, can you help me?
--
At the moment I only came with such algorithm/query:
Test1: this test should return true:
I takes as input the T1 table horizontal axes (2, [4]) and research data table T2 that affect this horizontal axes, also the value axes is compared. But how then? There are 2 files, but it can give 10 stores overlap in the periods and amounts. How to determine now that rectange T1 is filled?--query: is rectangle [2-4;10-12] filled? -Yes. with T2 as (select 1 FromPeriod, 2 ToPeriod, 9 FromSum, 5 ToSum from dual union all select 1 FromPeriod, 3 ToPeriod, 9 FromSum, 4 ToSum from dual union all select 2 FromPeriod, 5 ToPeriod, 9 FromSum, 11 ToSum from dual union all select 2 FromPeriod, 5 ToPeriod, 11 FromSum, 12 ToSum from dual) select * from t2 where (2 <= ToPeriod and 4 >= FromPeriod) -- x-axes overlapping and (10 <= ToSum and 12 >= FromSum)--y-axes overlapping ;--2 rows -- 2 5 9 11 2 5 11 12
Test2: This case should return false:--query: is rectangle [2-4;10-12] filled? -No. with T2 as (select 1 FromPeriod, 2 ToPeriod, 9 FromSum, 4 ToSum from dual union all select 1 FromPeriod, 3 ToPeriod, 9 FromSum, 4 ToSum from dual union all select 2 FromPeriod, 4 ToPeriod, 9 FromSum, 11 ToSum from dual union all select 2 FromPeriod, 5 ToPeriod, 13 FromSum, 13 ToSum from dual) select * from t2 where (2 <= ToPeriod and 4 >= FromPeriod) -- x-axes overlapping and (10 <= ToSum and 12 >= FromSum)--y-axes overlapping ;--1 row. 2 4 9 11
Charles,
I see 2 choices, but none is likely to evolve very well. The first can be with SQL - subdivision T1 into unit squares and see if everything not covered by T2:
with T1 as (select 2 FromPeriod, 4 ToPeriod, 10.1 FromSum, 12 ToSum from dual) , T1X as (select (FromPeriod+level)-1 as Period from T1 connect by level <= (ToPeriod-FromPeriod)+1) , T1Y as (select (FromSum+level*.01)-.01 as Summ from T1 connect by level <= (ToSum-FromSum+.01)/.01) , T1XY as (select Period,Summ from T1X,T1Y) ,T2 as (select 1 FromPeriod, 2 ToPeriod, 9.99 FromSum, 10.1 ToSum from dual--satisfies sub-region [(2,2);(10.1,10.1)] union all select 1 FromPeriod, 2 ToPeriod, 9.99 FromSum, 10.11 ToSum from dual--now satisfied sub-regions: [(2,2);(10.1,10.11) union all select 2 FromPeriod, 2 ToPeriod, 10 FromSum, 12.01 ToSum from dual--now satisfied sub-regions: [(2,2);(10.1,12) union all select 3 FromPeriod, 4 ToPeriod, 10 FromSum, 11.99 ToSum from dual--now satisfied sub-regions: [(2,2);(10.1,12)],[(3,4);(10,11.99)] union all select 4 FromPeriod, 4 ToPeriod, 10 FromSum, 13 ToSum from dual--now satisfied sub-regions: all filled, return true ) select Period,Summ from T1XY where not exists ( select 1 from T2 where T2.FromPeriod<=T1XY.Period and T2.ToPeriod>=T1XY.Period and T2.FromSum<=T1XY.Summ and T2.ToSum>=T1XY.Summ ) ;
The second option is more inspiring you described, using a recursive algorithm to subdivide the T1 into small rectangles for each rectangle in T2. For example:
X(1)={[a,b;c,d]} Y={[e,f;g,h];[i,j;k,l]} X(2)={[a,e;c,g];[e,f;c,g];[f,b;c,g];[a,e;g,h];[f,b;g,h];[a,e;h,d];[e,f;h,d];[f,b;h,d]} or X(2)={[a,b;c,g];[a,b;h,d];[a,e;c,d];[f,b;c,d]} -- this gives some overlap, but fewer rectangles and the algorithm still works. You would have to refine it to handle partial overlaps correctly, then drop areas that don't have a positive area. If X(2) becomes empty then it is fully covered. It might be most efficient to sort T2 in order of descending area.
Kind regards
Bob -
SQL / PLSQL practice review
Hello
I'm looking for SQL, PLSQL practice Exam questions.
Can you get it someone please let me know where I can find these?
Concerning
FMPerhaps the [certificate Forum | http://forums.oracle.com/forums/forum.jspa?forumID=459] can help you.
We are mostly just typing (PL /) here on this forum SQL and PL/SQL SQL statements ;-) -
Hi all
I get columns 5 and 6 in the form of a record variable, a join of multiple tables, returned by a function called func. These columns belong to different variable tables.this of record is returned by a function in my sql environment, where I'm using a statement similar to the Sub statement.
Select func (par1, par2) of double;
I created a compatible record type in my schema using the Sub statement.
CREATE OR REPLACE TYPE ME_TYPE AS
OBJECT
(
number of col1,
col2 number.
col6 varchar2 (1000)
);
I created a variable of type record in my plsql function, using the statement
declare
me_type var1;
Start
Select
tab1. Col1,
Tab2.col2,
.
.
. tab6.col6
in
var1. Col1,
var1.col2,
.
.
var6.col6
Of
tab1, tab2, tab2...
where
condition1,
condition2
.but its throwing an error of
ORA-06530: Reference to the composite uninitialized
ORA-06512: at "my_package", line 177
Can someone pls suggest? I know that a collection should iniialized before available. Is it the same thing with a record? If so, how.
Thank youYou can use the function to deal WITH
create or replace type my_type is object ( empno integer , ename varchar2(10) ) / show err create or replace function my_function return my_type as l_emp my_type; begin select my_type(empno, ename) into l_emp from emp where empno = 7369; return l_emp; end; / show err with t as ( select my_function as val from dual ) select treat(val as my_type).empno as empno , treat(val as my_type).ename as ename from t;
-
Configure the notification email in XE without 'EM in sql / plsql
Hi guys,.
I was wondering if anyone knows where configure outgoing by mmon mail server should send alert emails.
My platform is an Oracle XE 10 DB, and I have not implemented the thing of XE (control of the database for XE) Administration web.
because I installed Apex.
So what I want to know is:
How Oracle XE are configurable from plsql to send alerts by e-mail, including how to configure the host emaili, email ID etc.
Thank you all and have a good weekend!MMON all done we put messages on a queue called ALERT_QUE. That means EM is subscribe to this queue, remove and send an e-mail/page of. The latter is done by EM himself doesn't use only not the packages built in.
In the absence of 'EM, you would use PL/SQL for:
(1) managing thresholds using DBMS_SERVER_ALERT
(2) subscribe to and dequeue with DBMS_AQ
(3) send emails with UTL_SMTP/UTL_MAILAt the moment there is no integrated package to send pages. If you really need to send pages, you will need to communicate with an external service that can send pages or use the API of any paging software, you use either Java stored procs or external procedures written in C
This is a good amount of code to write, but you will have your own stored procedures that you would be able to reuse against any DB.You really need to read the section called "additional APIs to Manage Server-Generated alerts:
[http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/manproc.htm#i1010615 | http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/manproc.htm#i1010615]
HTH
Chris
-
XML data in the table using sql/plsql
Hi experts,
Could you please help with the following requirement. I have the tags xml (.xml on a server file) below. I need to access this file and read the XML and insert into the db table using sql and plsql. Is it possible with the cdata below? And there is a nested this table.
Could someone please guide me if you have a sample code file and xml.
<? XML version = "1.0" encoding = "UTF-8"? >
< generation_date > <! [CDATA [17/11/2015]] > < / generation_date >
< generated_by > <! [CDATA [Admin Admin]] > < / generated_by >
< year > <! [CDATA [2015]] > < / year >
< month > <! [CDATA [01]] > < / month >
< author >
< author > <! [CDATA [user author]] > < / author > < author_initial > <! [CDATA [user]] > < / author_firstname > < author_country > <! [CDATA [author]] > < / author_lastname >
< author_email > <! [CDATA [[email protected]]] > < / author_email >
< author_data_01 > <! [CDATA []] > < / author_data_01 >
< author_data_02 > <! [CDATA []] > < / author_data_02 >
< items >
< article_item >
< article_id > <! [CDATA [123456]] > < / article_id >
< publication > <! [CDATA [Al Bayan]] > < / publication >
< section > <! [CDATA [Local]] > < / section >
< issue_date > <! [CDATA [11/11/2015]] > < / issue_date >
< page > <! [CDATA [2]] > < / print this page >
< article_title > <! [CDATA [title.]] > < / article_title > < number_of_words > <! [CDATA [165]] > < / number_of_words >
< original_price > <! [CDATA [200]] > < / original_price >
< original_price_currency > <! [CDATA [DEA]] > < / original_price_currency >
< price > <! [CDATA [250]] > < / price >
< price_currency > <! [CDATA [DEA]] > < / price_currency >
< / article_item >
< / articles >
< total_amount > <! [CDATA [250]] > < / total_amount >
< total_amount_currency > <! [CDATA [DEA]] > < / total_amount_currency >
< / author >
< / xml >
Thanks in advance,
Suman
XMLTABLE using...
SQL > ed
A written file afiedt.buf1 with t (xml) as (select xmltype ('))
2 ") of the double)"
3
4
5
6
7
8
9
10
11
[[12[email protected]]] >
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34-
35 end of sample data
36-
37 - assumptions:
(38 - a) XML may have several tags
(39 - b) eachmay contain more
40-
41 select x.gen_by, x.gen_date, x.mn, x.yr
42, y.author, y.auth_fn, y.auth_ln, y.auth_cnt, y.auth_em, y.auth_d1, y.auth_d2
43, z.id, z.pub, z.sec, z.iss_dt, z.pg, z.art_ttl, z.num_wrds, z.oprice, z.ocurr, z.price, z.curr
44 t
45, xmltable ('/ authxml')
from $ 46 t.xml
path of 47 columns gen_date varchar2 (10) '. / generation_date'
48, path of varchar2 (15) of gen_by '. / generated_by'
49, path of varchar2 (4) year '. "/ year"
50 varchar2 (2) mn road '. "/ month"
51, path of xmltype authors '.'
52 ) x
53, xmltable ('/ authxml/authors ')
from $ 54 x.authors
author of 55 path of varchar2 columns (15) '. / author'
56, path of varchar2 (10) of auth_fn '. / author_firstname'
57, path of varchar2 (10) of auth_ln '. / author_lastname'
58 road of VARCHAR2 (3) auth_cnt '. / author_country'
59 road of varchar2 (20) of auth_em '. / author_email'
60 road of varchar2 (5) of auth_d1 '. / author_data_01'
61, path of varchar2 (5) of auth_d2 '. / author_data_02'
62, path of xmltype articles '. / Articles'
63 ) y
64, xmltable ('/ Articles/article_item ')
from $ 65 y.articles
path id 66 number columns '. / article_id'
67, path of varchar2 (10) pub '. ' / publication.
68 road of varchar2 (10) dry '. / section'
69, path of varchar2 (10) of iss_dt '. / issue_date'
70 road of VARCHAR2 (3) pg '. "/ print this page"
71, path of varchar2 (20) of art_ttl '. / article_title'
72, path of varchar2 (5) of num_wrds '. / number_of_words'
73, path of varchar2 (5) of oprice '. / original_price'
74 road to VARCHAR2 (3) ocurr '. / original_price_currency'
75, path of varchar2 (5) price '. "/ price"
76, path of VARCHAR2 (3) curr '. / price_currency'
77* ) z
SQL > /.GEN_DATE GEN_BY YEAR MN AUTHOR AUTH_FN AUTH_LN AUT AUTH_EM AUTH_ AUTH_ ID PUB DRY ISS_DT PG ART_TTL NUM_W OPRIC HEARTS PRICE OCU
---------- --------------- ---- -- --------------- ---------- ---------- --- -------------------- ----- ----- ---------- ---------- ---------- ---------- --- -------------------- ----- ----- --- ----- ---
17/11/2015 Admin Admin 2015 01 user author user author [email protected] 123456 UAE Al Bayan Local 11/11/2015 2 is the title. 165 200 AED AED 250Of course, you'll want to change the types of data, etc. as needed.
I assumed that the XML can contain several "
" sections and that each section can contain several entries. Thus the XMLTABLE aliasing as 'x' gives information of XML, and supplies the data associated with the XMLTABLE with alias 'y' which gets the multiple authors, which itself
section of the XMLTABLE with alias 'z' for each of the article_item. CDATA stuff are handled automatically by SQLX (XML functionality integrated into Oracle's SQL)
-
Hello
I have a message raise_application_error in my PLSQL code that appears in the notification area of the APEX page when triggered. I would like to put a carrage back to specific points in the message. I tried the concatenations of Chr (10) and adding "< br >". Neither work. Any suggestions? It seems that the notification formatting removes HTML.
Thanks in advance
PaulP
Thanks for your suggestions. I found the quick and easy solution.
Rather than the use of RAISE_APPLICATION_ERROR (-20001, 'Message...')
APEX_ERROR. () ADD_ERROR
p_message in varchar2,
p_additional_info in varchar2 default null,
p_display_location in varchar2);
See
http://docs.Oracle.com/CD/E37097_01/doc/doc.42/e35127/apex_error.htm#CABDJBGJ
APEX_ERROR. ADD_ERROR renders the HTML code in the p_message then RAISE_APPLICATION_ERROR than don't.
Thank you Lakshmi and fac586
PaulP
-
How master SQL / PLSQL?
Hi friends, please click on my question.
I am newly graduate with approximately 1 year exp. in c#. I want to master SQL and PLSQL developer point of view and not admin I'm developer c# and not the side DBA.
Thank you!http://tkyte.blogspot.nl/2012/08/the-keys-to-Oracle.html
-
execute the block via file sql plsql
Hi all
I'm trying to run under plsql block by putting in a sql file and run it as (-oradb/BDC/oracle/OracleHomes/db/111/bin/sqlplus cpa@bdcd/cpa @/ apps/bkrdlr/interface_programs/IDSI_apply_rec_H_apply_test.sql--) but for some reason his hanging in there any idea what I'm doing wrong here. These sql statements are run very well when I run by physically logging in. appreciate your help. Thank you
Hanging out:set serveroutput on; DECLARE x NUMBER(10):=0; BEGIN DBMS_OUTPUT.PUT_LINE('Loading A0 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_A0; DBMS_OUTPUT.PUT_LINE('total records fetched from A0: ' || x); DBMS_OUTPUT.PUT_LINE('Loading D1 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_D1; DBMS_OUTPUT.PUT_LINE('total records fetched from D1: ' || x); DBMS_OUTPUT.PUT_LINE('Loading D2 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_D2; DBMS_OUTPUT.PUT_LINE('total records fetched from D2: ' || x); DBMS_OUTPUT.PUT_LINE('Loading B0 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_B0; DBMS_OUTPUT.PUT_LINE('total records fetched from B0: ' || x); DBMS_OUTPUT.PUT_LINE('Loading B2 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_B2; DBMS_OUTPUT.PUT_LINE('total records fetched from B2: ' || x); DBMS_OUTPUT.PUT_LINE('Loading M0 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_M0; DBMS_OUTPUT.PUT_LINE('total records fetched from M0: ' || x); DBMS_OUTPUT.PUT_LINE('Loading M2 Records'); x:=cms_idsi_prices_pkg.fn_upd_idsi_prices_from_M2; DBMS_OUTPUT.PUT_LINE('total records fetched from M2: ' || x); END; commit; exit
expected results (ran the connection manually)$ /oradb/BDC/oracle/OracleHomes/db/111/bin/sqlplus cpa@bdcd/cpa @/apps/bkrdlr/interface_programs/IDSI_apply_rec_H_apply_test.sql SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 7 10:48:41 2011 Copyright (c) 1982, 2008, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options 34
SQL> / Loading A0 Records total records fetched from A0: 4253 Loading D1 Records total records fetched from D1: 4253 Loading D2 Records total records fetched from D2: 4253 Loading B0 Records total records fetched from B0: 2853 Loading B2 Records total records fetched from B2: 2799 Loading M0 Records total records fetched from M0: 0 Loading M2 Records total records fetched from M2: 96 PL/SQL procedure successfully completed.
Try to make / issue;
-
Need help to form a query SQL/PLSQL
Hello
I'm not an expert in Oracle SQL. I need to have this query to improve the performance of my product. I have a table T that has a collar of column that is of type varchar. The neck is unique in the table (no two rows have the same value for the collar). Given a set S1 with 100 channels, the query should return me all channels in S1 who are not present in the neck.
SQL query or PLSQL would be perfect. The query can have strings (elements of S1) hardcoded into it.
Thanks in advance,
Madhuuser13290641 wrote:
They are separate strings. They will be most likely hard-coded.In this case to pass them on in the form of record set as shown below, so that you can use operator LESS to get your result.
with static_result_set as ( select 'aaa' col from dual UNION ALL select 'xxx' from dual UNION ALL select 'ccc' from dual UNION ALL select 'zzz' from dual ) select col from static_result_set minus select col from t
Maybe you are looking for
-
Cannot search from the address bar or search even in safe mode
Hello I can't search in the address bar or search, even in safe mode. I refreshed Firefox, delete all cookies, empty my cache, but nothing works. Also, I get a message that does not respect the firefox sync, and "this object pushed." I know that thes
-
How to open DBX with Windows XP SP3 home edition files?
I've sent e-mails that have been compacted to OE and now reside in a .dbx file which I would like to open and restore OE When I try to open it I get redirected to a file extension search prompt. Thanks Chuck 57
-
Several controls in the control 1
In the open G tookits, there is a control of the directional pad. Drop this control on the FP falls actually 4 separate orders - how is this done? I would like to create a command that deletes the error in and error of widgets in a gesture of mouse r
-
Homepage with/bcmwltry.exe alone. Cannot change user?
I disabled the checkbox on the cache. Now I can't login because I'm an error/bcmwltry.exe. How do I change users so I can re - check cache? I can't do anything. This is what facebook told me to do when I didn't have a gift in my gift box. Stupid of m
-
Current problems with explorer.exe
I suffer with the current problems with explorer.exe in the last two weeks or more. Main symptoms: Taskbar becomes unresponsive, and the currently open windows explore unresponsive. They do not recover. I have to kill the process in Task Manager, an