TimesTen and Oracle 11 g result cache
Oracle 11g introduces the concept of cache the result whereby the result set of frequently executed queries are stored in the cache and used later when other users ask the same query. This is different from the caching of the data blocks and exceuting the query over and over again.Tom Kyte calls this materialized view just-in-time, in which case the results are dynamically evaluated without DBA intervention
http://www.Oracle.com/technology/oramag/Oracle/07-Sep/o57asktom.html
My point is that, given utilities like result_cache and possibility to use Solid State Disks in Oracle to accelerate physics I/O etc. is necessary for a product like TimesTen? It seems to me he could asdd just another layer of complexity?
Oracle cache there result a useful tool, but it is significantly different from TimesTen. My understanding of the Oracle result cache is caching the results for rarely changing data such as search (currencies/identification code) tables, data reference that do not change often (list of counterparties) etc. It would be pointless to cache the result set when the data changes frequently.
There is also another argument for the cache of SQL result that if you hit high on your CPU usage and that you have enough memory, then you can cache some defined thus results save on your cycles CPU.
In view of the arguments on the wired RDBMS and drives (SSD), we can talk all day, but with SSDS does not eliminate the consideration for physical i/o optimizer. A table scan is a table scan if the data resides on disk SCSI or SSD. SSD will be faster, but we are still running physical IOs.
What about TimesTen, the positioning of the product is different. TimesTen is closer to average than Oracle. It is designed to work closely at the application layer, while Oracle aims much more wide. There is no way one can replace TimesTen with any RDBMS wired for volumes of moderate and real-time response. Demand for the result cache has been around for a while. In areas like trading program and data on the market when the underlying data changes quickly, TimesTen will come handy, because time real/provisional data and calculations must be made almost in real time, with fewer complications of the execution engine. I don't see how we can deploy the result cache in this scenario. Due to underlying data change, Oracle is obliged to calculate queries almost everytime and the cache of result will be just wasted.
Hope this helps,
Mich
Tags: Database
Similar Questions
-
Hello
In our database, we have the following settings for caching the result:
result_cache_max_result integer 5
result_cache_max_size great whole 256256 K
result_cache_mode chain MANUAL
result_cache_remote_expiration integer 0
But we use indicators no results hidden in questions, or tables that are enabled for result caching.
So from my understanding, caching the result should not happen.
But we met a performance problem, and when I checked the AWR report I found this:
And also I found this activity latch:
However, just set result_cache_max_size = 0 fixed to all our questions. Wait no more. Performance as expected.
But how is that possible? I thought with result_cache_mode = manual and not using indicators of result cache or table modes,.
There should be no result at all caching? Any max_size choose?
Can someone help me understand what is happening here?
Thank you and greet.
Daniel
tylerv wrote:
The original poster was not to the point and they actually understand the docs.
Sorry - I'm not okay. As I went to the docs are very EXPLICIT about how to disable the cache of result. If you turn it off, then it is enabled.
The fact that they have tried to do is that when result_cache_mode is set to the default value of the MANUAL, because they showed, it is, while according to the docs 12 c only the results of queries that use the RESULT_CACHE indicator must be stored in the cache of result
Maybe that's where you and OP have misunderstanding. on the RESULT_CACHE_MODE parameter and the parameter values. This seems to be a common misunderstanding.perhaps, because people are not read ALL the relevant articles of the RFSO and only looking at the section for this parameter.
There is NOTHING in the doc of 12 c for this parameter that shows ANY correlation to determine whether the cache is enabled or not.
Refer to the section "Setting the Mode of the result Cache"
https://docs.Oracle.com/database/121/TGDBA/tune_result_cache.htm#CDEJCGJD
As shown in table 15-3 there are ONLY two settings: MANUAL and FORCE. No adjustment said ANYTHING on toggle or if the cache is ENABLED or DISABLED.
... and they were not aware of all the queries that they had used this trick on. When you're ready to values by default and don't use don't not result_cache indicator (as much), it's odd to find the cache of your result are so full.
OK - the USER does not use the indicator result-cache to cache the results of the queries USERS. But if the cache is enabled (size not equal to zero) that according to the quote from the doc above has NO effect on the use of Oracle to cache for queries or non-deterministic function calls.
I think a lot of people may be jumping on the server I mentioned first that article explicitly states that you must set the size to zero to disable hide and seek only to the section on setting the parameters.
And that the "setting mode" section is confusing as it includes a paragraph that uses the expression "If you choose to activate the result cache.
That subsection and the r-phrase likely cause people to think that the setting and the off/on State of the cache are one and the same.
When the result cache is enabled, the database also highlights cache queries that call non-deterministic functions of PL/SQL. When caching
SELECT
statements that call functions, result cache dependencies of data for PL/SQL functions and titles of database objects. However, if the function uses the data that are not followed (such as sequences,SYSDATE
,SYS_CONTEXT
and package variables), uses the cache of result on queries that call this function can produce stale results. In this regard, the behavior of the cache of result is identical to the caching of PL/SQL functions. So always consider the accuracy of the data, as well as performance, if you choose to activate the result cache.But if all associated sections are interpreted in their context, it should clear up the misunderstanding.
If you have a support contract, you can submit a request to have the documentation changed to update mode setting (table 15-3) article to explicitly declare the parameter mode does NOT determine if the cache is enabled or not.
.
-
Result Cache in oracle 11g release 2.0.2.0
All,
A few months ago I tried function result Cache 11 g version 2.0.1.0. The oracle of time mentioned that they have 3 ways to use this feature by setting the parameter result_cache_mode AUTOMATIC, MANUAL or FORCE. With AUTO (result_cache_mode = AUTO) mode you can identify the queries that can benefit from the cache of the result. I would like to know what views or function I see where he captures this information.
In 11.2.0.1.0 documentation he was making reference to certain points of view (totally forgot the names of views) and said: those that will be available in 11.2.0.2.0.
Did anyone know about this?
Thanks in advance.user2486753 wrote:
Although doc oracle didn't tell on AUTO it is still accepts this value and caches the result of the SQL query if you add / * + cache result * / allusion to the SQL.
I know that they mentioned in 112010 somewhere that will help users find what SQL is good candidates for caching by running the app for a while. I couldn't just fine there.If we add AUTO and always passing the tip, this is the same behavior as MANUAL. I'm not sure I've seen the value of anywhere and neither its there in the docs too.
HTH
Aman... -
Hello
I use the Oracle 12 manged customer ODP.net connected to a database of GR 11, 2. I recently went on the cache of results with great effectiveness.
So, I thought I would try the result to the client cache. I have the setting turned on and restarted my db, but my questions always appear in the graphs of Enterprise manager and the AWR report. I would have thought if the query has been cached on the client, that it does not show.
How will I know if it works or not?
Thanks in advance.
Adrian.
Re-reading the original question, I missed the fact that you use managed ODP.NET. The client result cache does not support managed ODP.NET. Only unmanaged ODP.NET is because it uses the capacity, within the OIC, that uses the unmanaged code.
I apologize for the misunderstanding.
-
Update statement can be used depending on the result cache?
Hi all
I stumbled on an interesting question. UPDATE statement is used in the following function, even if the feature is created RESULT_CACHE. It seems illogical. I was wondering, is it possible?
If so, why RESULT_CACHE is used? Because it means "do not execute the function, look for the result of the hash table and return the results to the user ' if the UPDATE statement, so doesn't mean it should run for each call and use with RESULT_CACHE and UPDATE/DELETE/MERGE is illogical or wrong?
Thanks for your help.
FUNCTION to CREATE or REPLACE plch_get_data (FULL id_in)
RETURN VARCHAR2
RESULT_CACHE
IS
BEGIN
Dbms_output.put_line ('run');
UPDATE plch_data
SET nm = UPPER (nm)
WHERE id = id_in;
COMMIT;
RETURN "SUPERIOR."
END;
/
Yes, it's the challenge of PL/SQL quiz - and the point of the quiz is only automatic relies on parsing by Oracle only supports arrays of account that is QUESTIONED.
The tables that are affected by DML not a query as an update do not figure in automatic invalidation of a cache.
I was hoping that the explanations given in the questionnaire itself would not lead to a thread - rather it would provide a pleasant and clear answer. So feel free to let me know if you think otherwise.
As to why Oracle would let you include DML not a query inside a function of caching of result, well... I can easily accept that you shouldn't do this - in general. But I don't see that we should make it impossible. It would probably be a good candidate for an another PLW (PL/SQL warning), as in:
"Non-requetes DML in a result caching function will not affect caching and can result in unexpected results."
-
Hello
I'm on Oracle Database 11 g Release 11.2.0.3.0 and Application Express 4.2.2.00.11
How to use trick cache result?
How do you get the same result shown in Figuree 3 (apex.oracle.com Application Express 4.2.6.00.03) ?
I try to use the result cache but explain plan does not appear to be used (Figure 1)
Then I tried ' alter table STUDENT result_cache (FORCE mode); In figure 2, you could see that column in the table of students result_cache was changed to 'force' but explain the plan shows yet cache result being used.
Figure 2
Figure 3 (from apex.oracle.com workspace)
Hello
Thank you all for your answers.
According to Oracle Help Center (11 g release 2) this is a feature reserved for Enterprise Edition. And Apex.oracle.com from today using Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production.
While I'm using Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production it is why in the screenshots above I could not duplicate the result in apex.oracle.com
https://docs.Oracle.com/CD/E11882_01/license.112/e47877/editions.htm#DBLIC116
-
Hi all
I have a question about the use of the result of the client cache but first of all, here is the information on my database:
SQL> SELECT * FROM v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
I installed the Oracle Client Tools on my clientmachine. There a tnsnames.ora like this:
ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = FEA11-119SRV)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl.local) ) )
The result of the Client Cache is configured in the sqlnet.ora.
ADR_BASE = /u01/app/oracle OCI_RESULT_CACHE_MAX_SIZE= 2048000 OCI_RESULT_CACHE_MAX_RSET_SIZE = 1024000 NAMES.DIRECTORY_PATH = (EZCONNECT, TNSNAMES, HOSTNAME)
The Databaseserver is configured like this:
SQL> col name format a30 SQL> col value format a30 SQL> SELECT name, value 2 FROM v$system_parameter 3 WHERE name LIKE '%result_cache%'; NAME VALUE ------------------------------ ------------------------------ result_cache_mode MANUAL result_cache_max_size 0 result_cache_max_result 5 result_cache_remote_expiration 0 client_result_cache_size 1073741824 client_result_cache_lag 3000
After you set up a client's server, I try the SQL query on the clientmachine followign:
sqlplus oracle/password@orcl set autotrace traceonly explain SELECT /*+ result_cache */ * FROM testtable;
-
However, I do not understand why? I mean what happens behind all this? Why the 30 result? Could someone tell me why?I create and populate the following table in my schema: create table plch_table (id number, time_sleep number); begin insert into plch_table values (1, 20); commit; end; / Then I create this function (it compiles successfully, since my schema has EXECUTE authority on DBMS_LOCK): create or replace function plch_func return number result_cache is l_time_sleep number; begin select time_sleep into l_time_sleep from plch_table where id = 1; dbms_lock.sleep(l_time_sleep); return l_time_sleep; end; / I then start up a second session, connected to the same schema, and execute this block: declare res number := plch_func; begin null; end; / Within five seconds of executing the above block, I go back to the first session and I run this block: declare t1 number; t2 number; begin t1 := dbms_utility.get_time; dbms_output.put_line(plch_func); t2 := dbms_utility.get_time; dbms_output.put_line('Execute in '||round((t2-t1)/100)||' seconds'); end; / what will be displayed after this block executes? And the result is: 20 Execute in 30 seconds
Honestly, before the issue of PL/SQL challenge of yesterday, I had no idea how it worked either. It is much a deep internals question - you would probably pick up a post from presentation or very specialized blog get more details (or that you would have to do the research yourself). And even then, it is relatively unlikely that they would go in a lot more detail than the PL/SQL Challenge response has been. Julain Dyke result Cache Internals (PPT) is probably one of the more detailed presentations on the internals of the result cache.
All of the valid statuses for a result cache object are documented in the entry reference of Oracle database to the view v$ result_cache_objects. Delays second two 10 are controlled by the session level settings and database of the resultcache_timeout undocumented parameter (which, based on this blog by Vladimir Begun has been fixed at 60 seconds in 11.1.0.6 and changed to 11.1.0.7 to 10 seconds.)
Justin
-
Today I test the query result cache, but the result is not as I expected. Please give a few advices.thank you in advance.
SQL > create table (qrc_tab)
Number 2);
Table created.
SQL > insert into qrc_tab values (1);
1 line of creation.
SQL > insert into qrc_tab values (2);
1 line of creation.
SQL > insert into qrc_tab values (3);
1 line of creation.
SQL > insert into qrc_tab 4;
1 line of creation.
SQL > insert into qrc_tab values (5);
1 line of creation.
SQL > create or replace function slow_function (p_id in qrc_tab.id%TYPE)
2 back qrc_tab.id%TYPE DETERMINISTIC AS
3 BEGIN
4 DBMS_LOCK.sleep (1);
5 return p_id;
6 end;
7.
The function is created.
SQL > set timing on
SQL > select slow_function (id) in the qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.01
SQL > select / * + result_cache * / slow_function (id) of qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.00
SQL > select / * + result_cache * / slow_function (id) of qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.00
SQL > select / * + result_cache * / slow_function (id) of qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.00
I wonder why time is not fast? Help, please
create or replace function slow_function (p_id in qrc_tab.id%TYPE)
return qrc_tab.id%TYPE result_cache DETERMINISTIC AS
Start
DBMS_LOCK. Sleep (1);
return p_id;
end;
/
--
John Watson
Oracle Certified Master s/n
-
OS and Oracle block size block size
[Condition] If the size of the block of BONE [512 b - 64K] is greater than the size of block Oracle [2K - 16K]
Assume: BONES Block Size: 32K and Oracle block size: 8K
Quebec: One-to-many relationship will always be true? or block Oracle will use 8K to 32 K, and the rest will be unused? or it will return the error at the time of the creation of the data file?
This will challenge the relationship "one to many".
Leader: Oracle logical and physical storage diagram.svg - Wikimedia Commons
Refer to the basis of the diagram.
" --------------------< "="" show's="" one="" to="" many="" relation.="" one="" x="" can="" contain="" many="">
">-------------------<" show's="" many="" to="" many"="" i.e="" many="" x="" can="" contain="" many="">">
You don't seem to be read or understand what everyone says.
There is NO such "one to many" relationship. Like I said above
There is no 'validation of one to many '.
1. the operating system uses a given block size
2. you choose an Oracle block size
All these "one to many" is just the result of the choices you made in #2 above. There isn't any 'validation' that occur.
This likely diagram shows this relationship based on the recommendation of Oracle to select a block size that is a multiple of the block size of OS. If you do that this diagram will NOT reflect the case of NORMAL use.
You can't believe everything you see on the internet. Articles/diagrams and others are often from unknown or reliable sources.
2.
'Validation' is not any process.
I just wanted to write the Validation of the theory, the relationship.
Re-read what I just said again above.
There is NO validation. There is NO theory of validation.
All there is is the reality of the block size, you choose and the reality of the OS block size you use. Any relationship between these two values is just a reflection of these two values.
If you choose two different values, they have a completely different relationship to each other.
Oracle works with blocks of the Oracle. The operating system works with the BONE blocks. Oracle does not care really what size a block of BONE is in connection with an Oracle block.
-
Consider the function result Cache
Hello
Have a question about the function result to cache.
Follow this link: http://www.oracle.com/technetwork/articles/sql/11g-caching-pooling-088320.html
I use the following version of oracle: Oracle Database 11g Express Edition Release 11.2.0.2.0
I'm doing using the feature of function result cache.
Please find the source code used, below:
create or replace function fnresultcahceg (empid employees.employee_id%type)
employees.salary%type result_cache relies_on (employees) is back
l_salary employees.salary%type;
Start
Select the wage in l_salary of employees where employee_id = empid;
DBMS_LOCK. Sleep (1);
Return l_salary;
end fnresultcahceg;
Try to run the function created above with the following:
SQL > select fnresultcahceg (200) double;
FNRESULTCAHCEG (200)
-------------------
4400
Elapsed time: 00:00:01.15
SQL > select fnresultcahceg (201) twice;
FNRESULTCAHCEG (201)
-------------------
13000
Elapsed time: 00:00:01.01
SQL > select fnresultcahceg (200) double;
FNRESULTCAHCEG (200)
-------------------
4400
Elapsed time: 00:00:01.00
SQL > select fnresultcahceg (201) twice;
FNRESULTCAHCEG (201)
-------------------
13000
Elapsed time: 00:00:01.01
SQL > select fnresultcahceg (201) twice;
FNRESULTCAHCEG (201)
-------------------
13000
Elapsed time: 00:00:01.00
SQL > exec dbms_output.put_line (fnresultcahceg (200));
4400
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.04
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.03
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.01
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.00
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.00
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.01
SQL > spool off;
We could see no improvement in time elapsed execution.
Have a doubt on the am I missed something / do wrong to the result of the setting of the cache settings.
Have you tried with the following result cache settings
ALTER SYSTEM SET result_cache_max_size = 2M RANGE = MΘMOIRE
ALTER SYSTEM SET result_cache_remote_expiration = 2;
ALTER SYSTEM SET result_cache_mode = {MANUAL |} STRENGTH} - two similar agronomic results
The wait was to reduce the execution time after its first execution if the data remains the same.
Please guide me in this regard.
Thanks in advance,
Sandeep.S
> I use the next version of oracle: Oracle Database 11g Express Edition Release 11.2.0.2.0.
PL/SQL function result Cache is only available in Oracle Database Enterprise Edition (EE).
Concerning
-
architecture of the relationship between R and Oracl
If I know, this will be the great success for Oracle. architecture of connection between oracle and R.
R customer send it is SQL for Oracle server and Oracle perform the function of ore itself and send the results to R on the client. as ore.lm
for other R packages as SNA, IGraph, Data mining in R code sending R Oracle to on server R and R on server run and send to Oracle. Oracle, send them to r. He connect through a single port and is secure. IS TRUE MY WRITING?
I have another question. If we R 2 or more on the server, how oracle identifies correct R? for example, I install R2.13 and R2.15 on the server.
tanks for your attention
Published by: Nasiri Mahdi on 24 February 2013 22:42Nguyen,
Architecture of ore, take a look at [url http://www.oracle.com/technetwork/database/options/advanced-analytics/r-enterprise/ore-trng1-gettingstarted-1501628.pdf] the first presentation in our learning of the R series.
For your second question. ORE will use R who we found during installation. The installer will display the value of R_HOME before it proceeds with the installation. In general 1.3 ore we recommend R 2.15.1 and ORE 1.1 - R 2.13.1.
Denis
-
Hi all
What are the restrictions of use result indicator cache on queries? How to use Union or join or subqueries? What doc should I read about it?
Also, I run the following queries on the HR diagram example:
Usingselect first_name,(select /*+ RESULT_CACHE */ last_name from employees where employee_id=100) from employees; select first_name from (select /*+ RESULT_CACHE */ first_name from employees);
I can check if the first subquery, where it is evaluated in each row, using no indicator result hides while the second use on. How do I?select name, value from v$result_cache_statistics where id=7;
Best regards
ValSelect first_name, (select / * + RESULT_CACHE * / last_name of employees where employee_id = 100) of employees;
(Of course, this is an artificial example, but one) result_cache indicator does not work in a scalar subquery, unless you move out in a CTE first (WITH clause) and b) without result caching, you will benefit from [url http://www.oratechinfo.co.uk/scalar_subqueries.html] scalar subquery caching anyway.
You might also be interested in some of the debates on this topic:
Problem with caching the result -
Count (*) that is a conditional statement and then if the result
HI: This is table_1:
with Table_1 as ( select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') incident_date, 2005 Policy_no from dual union all select to_date('04-MAR-2009 12:12','DD-MON-YYYY HH24:MI') incident_date, 2009 Policy_no from dual union all select to_date('25-JUL-2010 23:30','DD-MON-YYYY HH24:MI') incident_date, 2013 Policy_no from dual ) select * from Table_1
I need to perform a count (*) on agr_line_no on the condition that there is other other objects 'CAR' that is to say if forpolicy_no = 2005 the count should be 4.with Table_2 as ( select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 100 agr_line_no, 'BIKE' object from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 200 agr_line_no, 'BUCKS' from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 300 agr_line_no, 'CELL' from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 400 agr_line_no, 'CAR' from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 500 agr_line_no, 'HOUSE' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 100 agr_line_no, 'BIKE' object from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 200 agr_line_no, 'BUCKS' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 300 agr_line_no, 'BEACH' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 400 agr_line_no, 'CAR' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 500 agr_line_no, 'HOUSE' from dual union all select to_date('20-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('29-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2013 Policy_no, 676 agr_line_no, 'CAR' from dual ) select * from Table_2
Be Table_1 to table_2 on Policy_no and all columns in table_1 must be selected as well as an additional column called Object_many.
Object_many is based on the count (*) from table_2 it is if the number is > 1, 'Y' must be returned to another "n".
Also, there must be a clause where clause that is to say when table_1.incident_date between .cover_start_date table_2 and table_2 .cover_end_date
Final result should look like this
Thanks in advance!with Table_1 as ( select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') incident_date, 2005 Policy_no, 'Y' Object_many from dual union all select to_date('04-MAR-2009 12:12','DD-MON-YYYY HH24:MI') incident_date, 2009 Policy_no, 'Y' Object_many from dual union all select to_date('25-JUL-2010 23:30','DD-MON-YYYY HH24:MI') incident_date, 2013 Policy_no, 'N' Object_many from dual ) select * from Table_1
Banner:
Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production."
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Productionwith Table_1 as ( select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') incident_date, 2005 Policy_no from dual union all select to_date('04-MAR-2009 12:12','DD-MON-YYYY HH24:MI') incident_date, 2009 Policy_no from dual union all select to_date('25-JUL-2010 23:30','DD-MON-YYYY HH24:MI') incident_date, 2013 Policy_no from dual ), Table_2 as ( select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 100 agr_line_no, 'BIKE' object from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 200 agr_line_no, 'BUCKS' from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 300 agr_line_no, 'CELL' from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 400 agr_line_no, 'CAR' from dual union all select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 500 agr_line_no, 'HOUSE' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 100 agr_line_no, 'BIKE' object from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 200 agr_line_no, 'BUCKS' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 300 agr_line_no, 'BEACH' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 400 agr_line_no, 'CAR' from dual union all select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 500 agr_line_no, 'HOUSE' from dual union all select to_date('20-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('29-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2013 Policy_no, 676 agr_line_no, 'CAR' from dual ) -- -- end-of-test-data -- select table_1.policy_no, max(table_1.incident_date) incident_date, case when count(table_2.agr_line_no) > 1 then 'Y' else 'N' end object_many from table_1 left outer join table_2 on table_2.policy_no = table_1.policy_no and table_2.cover_start_date <= table_1.incident_date and table_2.cover_end_date >= table_1.incident_date and table_2.object != 'CAR' group by table_1.policy_no order by table_1.policy_no;
I assumed policy_no either the primary key in Table_1 - so max (table_1.incident_date) will work.
If you have an index on Table_2 on coverage dates, then the construction above could be better than one between. Otherwise between will be quite OK ;-)
-
rules of the clues in the text and oracle query using matches
Dear all,
I would like to ask questions about the function of rules and matches the oracle text.
I followed a lead in the oracle text application developer guide.
I have a table of rules like this:
1 oracle
2 larry or ellison
3 oracle and text
market share 4
Then I create an index in this table. This is necessary for the matches function call. Here's the syntax:
create index queryx on queries (query_string)
indexType is ctxsys.ctxrule;
Then, I noticed that the result on DR$ QUERYX$ I table as follows:
0 2 2 1 LARRY (BLOB)
MARKET 0 4 4 1 (BLOB) {MARKET} {ACTION}
0 1 1 1 ORACLE (BLOB)
0 3 3 1 ORACLE (BLOB) {TEXT}
0 2 2 1 ELLISON (BLOB)
What I want to ask is why do the words 'share' and 'text' appear in the DR table $ QUERYX$?
When we use the function of the matches, it can search on the result of the index and therefore he walls can't find the word 'action '. Thus, when for example I ask like this:
Select query_id queries where matches (query_string, "it only to share ten percent of all products sold") > 0
It will give 0 results since no words in "it only to share ten percent of all products sold ' was in the index table. But in fact it could possibly be classified as category 4 rules which is "market share".
I tried this in a large data set and get the same result.
Here are my rules generated from my collection of document:
1 {REQUIREMENTS of} & {ELICITATION}
1 {REQUIREMENTS of} ~ {ELICITATION} & {ACTOR}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} & {FURPS}
1 {REQUIREMENTS OF} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} & {PROC}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} & {SPEED}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} & {PDF}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {PDF} & {SET}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {PDF} ~ {SET} & {UNNECESSARY}
1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {PDF} ~ {SET} ~ {UNNECESSARY} & {MISUSE}
1 {INTERPRETATION} ~ {REQUIREMENTS}
2 {DESIGN of} & {PERFORMANCE}
2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} & {OCTOBER}
2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} & {PROCEDURAL}
2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} ~ {PROCEDURAL} & {STRICT}
2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} ~ {PROCEDURAL} ~ {STRICT} & {ENTER}
2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} ~ {PROCEDURAL} ~ {STRICT} ~ {ENTER} & {NUMBER} & {LAYER}
2 {DESIGN OF} ~ {REPRESENTATION} ~ {CAN}
3 {PM} & {TEST} & {ATTRIBUTION}
And this is the result of table with a ctxrule index:
(only the column token_text shown)
PM
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
INTERPRETATION
so when I try to file a document with the word in there way, it should produce category 1 (based on rules), but since there is no word 'plan' in the tabel index, matches will return 0 means that the document is classifiedto not any category. I don't understand why this is happening. Everyone knows about it? I'd appreciate any help.
Thank you very much.Share market means that the market immediately followed word on the part of the word, so if you don't have the word share then is not a match. If she had walked or hand, then he would be looking for just one part.
Maybe you are looking for
-
How can I stop them altogether? If you can't do it I'll just uninstall Skype.
-
Transfer of ram on macbook (early 2008) iMac 8.1?
Hi, is it safe if I transfer 2 ram sticks of a macbook (early 2008) for an Imac 8.1 (core 2 duo)? Or I have to get different ram for imac? Also how can I clean the ram because its pretty dusty on one side of it.
-
How dense can the main grid to allow a minor grid?
Hello NO,. on a xy chart, allowing the secondary gridlines (with the lines of the main grid enabled, of course) do not always show them. It seems that no minor gridlines is drawn if there is already "several" main grid lines. For example, a chart wit
-
Will not install the 2007 Microsoft Office Suite Service Pack 3 (SP3) update. I get an error code: 'update code 80070663 Windows has encountered an error unknown. How can I fix? I tried Microsoft fix. It fixes something, but apparently not this probl
-
Problems with the display of compensation
Hi all I developed an application where I want to, on an action such as a buttonPress, turn off the screen of its current contents and redraw the entire screen. The current content is drawn inside a GridManager which draws the screen as expected. Ini