Where is the result of the following query caching?
I run the following query statement:select * from hr.employees
Where is the result of the following query caching? Is cached in the PGA? What area of PGA?
By definition is not "cache". The blocks of data that are read to retrieve the results of the query are retrieved in the cache (DB_CACHE_SIZE or DB_BLOCK_BUFFERS component BMG) buffers so that they are accessible on several occasions by the same users or other users. However, because the buffer cache is limited in size, buffers are released when new blocks to be read. Buffers for a full table scan (as it would be for such a request) are released very probably earlier.
Please read the Oracle database documentation, starting with the Concepts manual for the version you are using. Starting at http://tahiti.oracle.com
Hemant K Collette
Tags: Database
Similar Questions
-
Best way to write the following query
Hello
I have following table structures and data...
And I wrote the request in order to obtain records that are superior to BBB-
But could you please me to write in a simpler way.
I used the table rt_srt twise in the above querycreate table obj (ob_id ) as select 1 from dual union all select 2 from dual union all select 3 from dual union all select 4 from dual union all select 5 from dual union all select 6 from dual create table og_dt (or_id , rt_cd,rt_ct_cd) AS SELECT 1 ,'B','BRID' FROM DUAL UNION ALL SELECT 1 ,'B','BRD' FROM DUAL UNION ALL SELECT 2 ,'BB-','ACR' FROM DUAL UNION ALL SELECT 2 ,'BB-','AQCR' FROM DUAL UNION ALL SELECT 3 ,'BBB','QYRE' FROM DUAL UNION ALL SELECT 4 ,'BB+','TUR' FROM DUAL UNION ALL SELECT 5 ,'BBB-','KUYR' FROM DUAL create table rt_srt (srt_ord,rt_cd,rt_ct_cd) as select 50 ,'B','VID' FROM DUAL UNION ALL SELECT 50 ,'B','BRD' FROM DUAL UNION ALL SELECT 40 ,'BB-','ACR' FROM DUAL UNION ALL SELECT 41 ,'BB-','AQCR' FROM DUAL UNION ALL SELECT 30 ,'BBB','QYRE' FROM DUAL UNION ALL SELECT 33 ,'BB+','TUR' FROM DUAL UNION ALL SELECT 20 ,'BBB-','KUYR' FROM DUAL select distinct * from obj,og_dt,rt_srt where obj.ob_id=og_dt.or_id and og_dt.rt_cd = rt_srt.rt_cd and og_dt.rt_ct_cd=rt_srt.rt_ct_cd and rt_srt.srt_ord > all (select rt_srt.srt_ord from rt_srt where rt_cd='BBB-'
Could you advice please write it in simple way.
Thank youHere's the implementation plans for 3 possible solutions (including the one you posted). Solutions of second & third assumes that rt_srt.srt_ord is not null:
SQL> explain plan for 2 select distinct * 3 from obj, 4 og_dt, 5 rt_srt 6 where obj.ob_id = og_dt.or_id 7 and og_dt.rt_cd = rt_srt.rt_cd 8 and og_dt.rt_ct_cd = rt_srt.rt_ct_cd 9 and rt_srt.srt_ord > all ( 10 select rt_srt.srt_ord 11 from rt_srt 12 where rt_cd = 'BBB-' 13 ) 14 / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- Plan hash value: 3210303028 --------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 7 | 504 | 16 (25)| 00:00:01 | | 1 | HASH UNIQUE | | 7 | 504 | 16 (25)| 00:00:01 | | 2 | MERGE JOIN ANTI NA | | 7 | 504 | 15 (20)| 00:00:01 | | 3 | SORT JOIN | | 7 | 385 | 11 (19)| 00:00:01 | |* 4 | HASH JOIN | | 7 | 385 | 10 (10)| 00:00:01 | |* 5 | HASH JOIN | | 7 | 238 | 7 (15)| 00:00:01 | PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- | 6 | TABLE ACCESS FULL| OBJ | 6 | 78 | 3 (0)| 00:00:01 | | 7 | TABLE ACCESS FULL| OG_DT | 7 | 147 | 3 (0)| 00:00:01 | | 8 | TABLE ACCESS FULL | RT_SRT | 7 | 147 | 3 (0)| 00:00:01 | |* 9 | SORT UNIQUE | | 1 | 17 | 4 (25)| 00:00:01 | |* 10 | TABLE ACCESS FULL | RT_SRT | 1 | 17 | 3 (0)| 00:00:01 | --------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("OG_DT"."RT_CD"="RT_SRT"."RT_CD" AND PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- "OG_DT"."RT_CT_CD"="RT_SRT"."RT_CT_CD") 5 - access("OBJ"."OB_ID"="OG_DT"."OR_ID") 9 - access("RT_SRT"."SRT_ORD"<="RT_SRT"."SRT_ORD") filter("RT_SRT"."SRT_ORD"<="RT_SRT"."SRT_ORD") 10 - filter("RT_CD"='BBB-') Note ----- - dynamic sampling used for this statement (level=2) 31 rows selected. SQL> explain plan for 2 select distinct * 3 from obj, 4 og_dt, 5 rt_srt 6 where obj.ob_id = og_dt.or_id 7 and og_dt.rt_cd = rt_srt.rt_cd 8 and og_dt.rt_ct_cd = rt_srt.rt_ct_cd 9 and rt_srt.srt_ord > ( 10 select max(rt_srt.srt_ord) 11 from rt_srt 12 where rt_cd = 'BBB-' 13 ) 14 / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- Plan hash value: 3391900174 --------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 55 | 14 (15)| 00:00:01 | | 1 | HASH UNIQUE | | 1 | 55 | 14 (15)| 00:00:01 | |* 2 | HASH JOIN | | 1 | 55 | 10 (10)| 00:00:01 | | 3 | MERGE JOIN CARTESIAN| | 2 | 68 | 6 (0)| 00:00:01 | |* 4 | TABLE ACCESS FULL | RT_SRT | 1 | 21 | 3 (0)| 00:00:01 | | 5 | SORT AGGREGATE | | 1 | 17 | | | PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- |* 6 | TABLE ACCESS FULL| RT_SRT | 1 | 17 | 3 (0)| 00:00:01 | | 7 | BUFFER SORT | | 6 | 78 | 3 (0)| 00:00:01 | | 8 | TABLE ACCESS FULL | OBJ | 6 | 78 | 3 (0)| 00:00:01 | | 9 | TABLE ACCESS FULL | OG_DT | 7 | 147 | 3 (0)| 00:00:01 | --------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("OBJ"."OB_ID"="OG_DT"."OR_ID" AND "OG_DT"."RT_CD"="RT_SRT"."RT_CD" AND PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- "OG_DT"."RT_CT_CD"="RT_SRT"."RT_CT_CD") 4 - filter("RT_SRT"."SRT_ORD"> (SELECT MAX("RT_SRT"."SRT_ORD") FROM "RT_SRT" "RT_SRT" WHERE "RT_CD"='BBB-')) 6 - filter("RT_CD"='BBB-') Note ----- - dynamic sampling used for this statement (level=2) 30 rows selected. SQL> explain plan for 2 select distinct obj.*, 3 og_dt.*, 4 rt_srt.srt_ord, 5 rt_srt.rt_cd, 6 rt_srt.rt_ct_cd 7 from obj, 8 og_dt, 9 ( 10 select t.*, 11 max(case rt_cd when 'BBB-' then srt_ord end) over() max_srt_ord 12 from rt_srt t 13 ) rt_srt 14 where obj.ob_id = og_dt.or_id 15 and og_dt.rt_cd = rt_srt.rt_cd 16 and og_dt.rt_ct_cd = rt_srt.rt_ct_cd 17 and rt_srt.srt_ord > max_srt_ord 18 / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- Plan hash value: 998396165 -------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 7 | 476 | 11 (19)| 00:00:01 | | 1 | HASH UNIQUE | | 7 | 476 | 11 (19)| 00:00:01 | |* 2 | HASH JOIN | | 7 | 476 | 10 (10)| 00:00:01 | |* 3 | HASH JOIN | | 7 | 238 | 7 (15)| 00:00:01 | | 4 | TABLE ACCESS FULL | OBJ | 6 | 78 | 3 (0)| 00:00:01 | | 5 | TABLE ACCESS FULL | OG_DT | 7 | 147 | 3 (0)| 00:00:01 | PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- |* 6 | VIEW | | 7 | 238 | 3 (0)| 00:00:01 | | 7 | WINDOW BUFFER | | 7 | 147 | 3 (0)| 00:00:01 | | 8 | TABLE ACCESS FULL| RT_SRT | 7 | 147 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("OG_DT"."RT_CD"="RT_SRT"."RT_CD" AND "OG_DT"."RT_CT_CD"="RT_SRT"."RT_CT_CD") 3 - access("OBJ"."OB_ID"="OG_DT"."OR_ID") PLAN_TABLE_OUTPUT --------------------------------------------------------------------------------------- 6 - filter("RT_SRT"."SRT_ORD">"MAX_SRT_ORD") Note ----- - dynamic sampling used for this statement (level=2) 27 rows selected. SQL>
SY.
Published by: Solomon Yakobson on May 7, 2012 16:46
-
Please send me selection for the following query statement...
FOR I IN 1.9 LOOP
IF shift (i) IS NULL THEN
FOR y IN i + 1.9 LOOP
IF shift (y) IS NOT NULL THEN
(I) shift: shift = (y);
Shift (y): = NULL;
EXIT;
END IF;
END LOOP;
END IF;
END LOOP;
Please how to write the select query to replace the lines of code abovePlease proceed here complete and this code did SHIFT here.
-
Query - Gohan values in the following columns of aging
Oracle 11.2.0.3...
I have this query... working on it in SQL * Navigator.
We pay all suppliers with Net 20, 25 Net and Net 30 terms due date + 15 days. I'm developing an application that will tell me who is due now, which must be returned within next 7, then 10, then 14 and coming 21 days.
The following query returns not due, owed, due + 7, etc... but just what is due is also displayed in the + 7, + 10, etc - because if it's due, it will be always due in a week!
How can I remove these values if they are already due?
(or, if they are due in 7 days, how can I delete + 10, + 14, etc?)
SELECT
PV. $vendor_name "seller."
NPS.invoice_number "Bill."
NPS.invoice_date "Date of the invoice.
NPS.due_date "due date."
Inv.Terms "terms."
(TO_DATE (sysdate) - nps.invoice_date) "Days entries."
(CASE
When to_date (nps.due_date) < to_date (sysdate)
then (to_date (sysdate) - to_date (nps.due_date))
Another null
end) 'days overdue',
"Remaining amount", NPS.amount_remaining
--0-15
(CASE
WHEN (TO_DATE (sysdate) - nps.invoice_date) < 45
THEN nps.amount_remaining
ANOTHER NULL
END
) "Unmatured,"
(CASE
WHEN (TO_DATE (sysdate) - nps.invoice_date) > = 45
THEN nps.amount_remaining
ANOTHER NULL
END
) "Have."
(CASE
WHEN (TO_DATE (sysdate + 7) - nps.invoice_date) > = 45
THEN nps.amount_remaining
ANOTHER NULL
END
) '+ 7 days. "
(CASE
WHEN (TO_DATE (sysdate + 10) - nps.invoice_date) > = 45
THEN nps.amount_remaining
ANOTHER NULL
END
) '+ 10 days. "
(CASE
WHEN (TO_DATE (sysdate + 14) - nps.invoice_date) > = 45
THEN nps.amount_remaining
ANOTHER NULL
END
) '+ 14 days. "
(CASE
WHEN (TO_DATE (sysdate + 21) - nps.invoice_date) > = 45
THEN nps.amount_remaining
ANOTHER NULL
END
) "21 days".
Of
Inv,
PV,
NPS
WHERE
and nps.amount_remaining <>0
and inv.terms ("Net 20', ' Net 25', 'Net 30')
example of output:
Invoice date of invoice terms due Date day days entered late amount not remaining due not due 7 days + 10 days + 14 days + 21 days
seller 00470871 1 12/27/1 / 2012/2013 Net 30 12 126,62 126.62 26
provider 59355648 2 11/28/2012 12/28/2012 Net 30 41 11 538,75 538.75 538,75 538.75 538,75 538.75
the seller 3 75793062 12/4/1/3 of 2012/2013 Net 30 35 5 950 950 950 950 950
seller 4 52835 12/13/1 / 2012/2013 Net 30 26 298.92 13 298,92 298.92
seller 4 52814 12/4/1/3 of 2012/2013 Net 30 35 5 330 330 330 330 330
any sql gurus have ideas?
Published by: camforbes on January 8, 2013 13:24Hello
It's not very clear what you want, but I think something more or less like that will do what you want:
WITH got_grp AS ( SELECT pv.vendor_name , nps.invoice_number , nps.invoice_date , nps.due_date , inv.terms , SYSDATE - nps.invoice_date AS days_entered , CASE WHEN nps.due_date < SYSDATE THEN SYSDATE - nps.due_date ELSE NULL END AS days overdue , nps.amount_remaining , CASE WHEN nps.invoice_date > SYSDATE - 24 THEN 'Over 21 Days' WHEN nps.invoice_date > SYSDATE - 31 THEN '+21 Days' WHEN nps.invoice_date > SYSDATE - 35 THEN '+14 Days' WHEN nps.invoice_date > SYSDATE - 38 THEN '+7 Days' WHEN nps.invoice_date > SYSDATE - 45 THEN 'Due' ELSE 'Not Due' END AS grp FROM inv JOIN pv ON ... JOIN nps ON ... WHERE nps.amount_remaining != 0 AND inv.terms IN ('Net 20', 'Net 25', 'Net 30') ) SELECT pv.vendor_name , nps.invoice_number , nps.invoice_date , nps.due_date , inv.terms , days_entered , days overdue , CASE WHEN grp = 'Not Due' THEN amount_remianing END AS not_due , CASE WHEN grp = 'Due' THEN amount_remianing END AS due , CASE WHEN grp = '+7 Days' THEN amount_remianing END AS plus_7_days , CASE WHEN grp = '+14 Days' THEN amount_remianing END AS plus_14_days , CASE WHEN grp = '+21 Days' THEN amount_remianing END AS plus_21_days FROM got_grp ;
Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
If the results are dependent on when the query is run, give an exact time of execution, or better yet, give a couple of different run times and desired outcomes, the same sample for each data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
Performance problem on the SQL query that does not use the primary key index
Hello!
I have some performance issues on a single SQL query (Oracle 10 g).
I could solve the problem by using the INDEX indicator, but I would like to know WHY this is happening.
* Tables *.
create table jobs)
ID number (5) not null,
name varchar2 (100),
primary key constraint Job_PK (id)
)
/
-Record count: 298
create table Comp)
integer ID not null,
name varchar2 (100),
primary key constraint Comp_PK (id)
)
/
-Record count: 193
-Relation m: n
create table JobComp)
integer ID not null,
id_job integer not null,
id_comp integer not null,
primary key constraint JobComp_PK (id),
unique key constraint JobComp_UK (id_job, id_comp),
Constraint JobComp_FK_Job foreign key (id_job) refers to Job (id),
Constraint JobComp_FK_Comp foreign key (id_comp) makes reference Comp (id)
)
/
create index JobComp_IX_Comp on JobComp (Cod_Comp)
/
create index JobComp_IX_Job on JobComp (Cod_Job)
/
-Record count: 6431
* Ask *.
When I run this query, the execution plan shows the index using (JobComp_PK and JobComp_IX_Comp).
No problem.
Select JobComp.*
of JobComp
Join jobs
on Job.id = JobComp.id_job
where JobComp.id_comp = 134
/
-runs in 0.20 sec
But when I add the field 'name' of the work table the plan uses full access table to the table of work
Select JobComp.*, Job.name
of JobComp
Join jobs
on Job.id = JobComp.id_job
where JobComp.id_comp = 134
/
-runs in the 2.70 dry
With the help of the index
Select / * + INDEX (Job Job_PK) * /.
JobComp.*, Job.name
of JobComp
Join jobs
on Job.id = JobComp.id_job
where JobComp.id_comp = 134
/
-runs in 0.20 sec
* Doubt *.
This behavior is correct?
PS. : I tried to recalculate the statistics, but nothing changes:
analyze the job calculation table statistics.
/
change the statistical calculation of index Job_PK reconstruction;
/
Start
dbms_utility.analyze_schema (sys_context ('userenv', 'current_schema'), 'CALCULATE');
end;
/
[of]
Gustavo EhrhardtGus.EHR wrote:
Hello.
I'm sorry for the plan unformatted.
The execution time of the querys "without field name' and 'with the field name with suspicion" are equal.
He has no problem caching, because I get the plans of the sequence different from the querys and repeated the performance. The result is always the same.I don't think that there is no problem with oracle crossing LOOP IMBRIQUEE to the HASH JOIN when you include the field name and this should be the expected behavior. But it seems that your WORKING table has a degree of parallelism set against what is causing the query to run in parallel (as JOB table is now available with full table scan, instead of indexed access earlier). It could be that the parallel execution is contributor to extra Runtime.
(a) do you know why the degree of parallelism on the WORK table has been defined? Do you need it?You can see if the following query provides a better response time?
select /*+ NOPARALLEL(JOB) */ JobComp.*, Job.Name from JobComp join Job on Job.id = JobComp.id_job where JobComp.id_comp = 134
-
Need help with the RESEARCH QUERY
Hello
I have the follwing query to search in my table.
If the search box is empty and I click to perform a search, all the elements of the array are listed.
How can I change the following query so if: P1_REPORT_SEARCH is null, I have no results.
Thank you
Roseline
SELECT "RDO"."ID",LPAD(NOD, 4, '0') as NOD,"IDD","TIT","TIC", '- - -' AS "DISQUE" ,'- - -' AS "ELEMENT" from "REGDOSSIERS" "RDO" where ( TRANSLATE ( UPPER ("TIT") , 'ÀÂÉÈÊÎÔÛÙÜ' , 'AAEEEIOUUU' ) like '%' || TRANSLATE ( UPPER (:P1_REPORT_SEARCH) , 'ÀÂÉÈÊÎÔÛÙÜ' , 'AAEEEIOUUU' ) || '%' )
Hello
Try
SELECT "RDO"."ID",LPAD(NOD, 4, '0') as NOD,"IDD","TIT","TIC", '- - -' AS "DISQUE" ,'- - -' AS "ELEMENT" from "REGDOSSIERS" "RDO" where ( TRANSLATE ( UPPER ("TIT") , 'ÀÂÉÈÊÎÔÛÙÜ' , 'AAEEEIOUUU' ) like '%' || TRANSLATE ( UPPER (:P1_REPORT_SEARCH) , 'ÀÂÉÈÊÎÔÛÙÜ' , 'AAEEEIOUUU' ) || '%' ) AND :P1_REPORT_SEARCH IS NOT NULL
BR, Jari
-
When I pull the select query, but therefore cannot get the data that you check?
Hello
When I raised this query without get data then can you help me it's ok?
DataSource { id: durgSearch_dataSource source: "sql/durg.db" query: "select * from durg_detail where durg_name =" + "\"" + searchTextField.text + "\"" onDataLoaded: { durgSearch_dataModel.insertList(data); } }
Glance. I just tested your app and it works correctly. I entered Rock and search button and it returns a Rock record. If you want to get all records that contain a particular letter or Word, you can use the following query:
"select * from medicin_detail where PharmacyName LIKE '%" + searchTextField.text + "%'"
-
generations of months using the sql query
Hello
Based on the input of date parameter, I need display every month in the current year and last year.
For example, suppose that my setting date is December 5, 14 ', I need the output below.
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
JANUARY
FEBRUARY
MARCH
APRIL
PEUT
Until the month of May and the month last year. I came with the request. Please find the following query.
Select to_char (add_months (trunc(sysdate,'year'), level-1), 'MONTH') mth
of the double
connect by level < = 12
Union of all the
Select to_char (to_date (ddate, 'MM'), 'MONTH') month
(select 1 + rownum - 1 ddate
from user_objects
where (1 + rownum - 1) < = to_number (to_char (to_date ('12-05-14', ' dd-mm-yy'), 'mm')));
But I don't want to use the data user_objects dictionary. Can you please guide how to achieve this output, or can u give me some other request too if possible.
Thank you
Siva
Try the below
SELECT TO_CHAR (ADD_MONTHS (ADD_MONTHS (TRUNC (TO_DATE(:date1,'DD-MM-YY'), 'MM'),
((- MONTHS_BETWEEN (trunc (to_date(:date1,'DD-mm-YY'), 'MM'), trunc (to_date(:date1,'DD-mm-YY'), 'YY')) + 12)).
(LEVEL-1))
, 'MONTHS '.
'NLS_DATE_LANGUAGE = ENGLISH') FROM dual months_between
CONNECT BY LEVEL<=>=>
-
Modification of the PLSQL query
The following query returns the records like below:SELECT A.CHEQUE_CODE AS COL1, A.ACC_ADD_REF AS COL2 FROM CTSCHEQUEBOOK A, BRANCHES B, CTSCHEQUEBOOK_DESIGN C WHERE A.COMP_CODE = 1 AND A.COMP_CODE = B.COMP_CODE AND A.BRANCH_CODE = B.BRANCH_CODE AND A.COMP_CODE = C.COMP_CODE AND A.CHEQUE_CODE = C.CODE ORDER BY 1
I want to display the records as only in the column but Group on COL1:COL1 COL2 --------------------------------- 1 01616005034001 1 01616005034001 1 01616005128001 2 01616005197001 2 01616005197001 3 01616005144001 3 01616005144001 3 01616005144001
How can I do this with my request?1 01616005034001 01616005034001 01616005128001 2 01616005197001 01616005197001 3 01616005144001 01616005144001 01616005144001
Then try the following script
WITH DATA AS (SELECT TO_CHAR(A.CHEQUE_CODE) AS COL1, A.ACC_ADD_REF AS COL2 FROM CTSCHEQUEBOOK A, BRANCHES B, CTSCHEQUEBOOK_DESIGN C WHERE A.COMP_CODE = 1 AND A.COMP_CODE = B.COMP_CODE AND A.BRANCH_CODE = B.BRANCH_CODE AND A.COMP_CODE = C.COMP_CODE AND A.CHEQUE_CODE = C.CODE ORDER BY 1 ) SELECT (CASE WHEN RN IS NULL THEN COL1 ELSE COL2 END) COL1 FROM (SELECT rownum RN,COL1, MIN(COL2) COL2 FROM DATA GROUP BY CUBE(ROWNUM),COL1);
Mahir
-
Error giving a subquery, but with the outer query, it gives no error.
Hello
The following query gives error "ORA-00979: not a GROUP BY expression" (I know to use the filter condition in the WHERE clause, but for reasons explaining the problem, I use the HAVING clause)
SELECT DeptNo
WCP
HAVING comm IS NULL;
But when I use it as a subquery in as long as below, the query will run successfully (resultset may be wrong).
SELECT d.
BY d Dept.
(SELECT deptno
WCP
WITH comm IS NULL) a
WHERE d.deptno = a.deptno;
Please explain the reason.
Kind regards
DanishSort of philosophical question. But you're right, this behavior can be misleading.
-
Need to rotate the sub query using 11 g
Hello
Please find the below query
SELECT AGING_BUCKET_ID, DAYS_START, DAYS_TO, AR_AGING_BUCKET_LINES TYPE
WHERE AGING_BUCKET_ID = 3
It displays the data as below
AGING_BUCKET_ID DAYS_START DAYS_TO TYPE
3-9999 0 CURRENT
3 1 30 LAST
3 31 60 LAST
3 61 90 LAST
3 91 9999999 PAST
I tried to rotate the data, tried to make use of the PIVOT of the 11 g used the following query function
WITH AGBUCK AS
(
SELECT AGING_BUCKET_ID, DAYS_START, DAYS_TO, AR_AGING_BUCKET_LINES TYPE
WHERE AGING_BUCKET_ID = 3
) SELECT * FROM AGBUCK
PIVOT)
DAYS_START s1, s2 DAYS_TO, type
FOR AGING_BUCKET_ID
(3)
);
finished in the msg below:-ora-56902: wait for the aggregate within the operation of pivot function
can you please help me to fix it.
Concerning
YramHi, Yram,
Whenever you have a problem, after a few sample data and outcomes from these data.
Sorry, I can't make a good guess at what you want, and I'm not an Oracle 11 database now to test. I think you want something like this:WITH AGBUCK AS ( SELECT AGING_BUCKET_ID , DAYS_START , DAYS_TO || TYPE AS label FROM AR_AGING_BUCKET_LINES WHERE AGING_BUCKET_ID = 3 ) SELECT * FROM agbuck PIVOT ( MIN (days_start) FOR label IN ( '0 CURRENT' AS current_0 , '30 PAST' AS past_30 , '60 PAST' AS past_60 , '90 PAST' AS past_90 , '9999999 PAST' AS past_9999999 ) ) ;
The first thing inside the parentheses after the PIVOT keyword must be an aggregate function. If there is a one-to-one correspondence between the lines in the "input" table and cells in the output, so no matter if you use the MIN or MAX (or, in the case of numbers, AVG or SUM).
-
Better way to write the simple query?
I'm trying to get the date of 'busy' max 'mansion '.
It is an example, I imagined, since I can't post our actual data. The following query works, but is their path easier.
Reason, I take the ID's for the second join because I know that the ID max = max.CREATE TABLE TEST_TABLE ( LOAN_NUMBER VARCHAR2(15 Byte), UN_ID NUMBER, CHANGE_DATE DATE, PROP_TYPE VARCHAR2(25 Byte), OCCSTAT VARCHAR2(25 Byte) ); COMMIT; INSERT INTO TEST_TABLE VALUES (123456, 1,'01-JAN-09','Tent','Occupied'); INSERT INTO TEST_TABLE VALUES (123456, 2,'01-FEB-09','Shack','Occupied'); INSERT INTO TEST_TABLE VALUES (123456, 3,'01-JUN-08','Single Family','Occupied'); INSERT INTO TEST_TABLE VALUES (123456, 4,'01-OCT-08','Single Family Plus','Occupied'); INSERT INTO TEST_TABLE VALUES (123456, 5,'01-DEC-08','Mansion','Occupied'); INSERT INTO TEST_TABLE VALUES (123456, 6,'05-JAN-09','Mansion','Unoccupied'); COMMIT;
easier way without the second join?select i2.UN_ID, i2.CHANGE_DATE, i2.PROP_TYPE, i2.OCCSTAT from ( select distinct(LOAN_NUMBER) AS "LOAN_ID", max(UN_ID) AS "ID_MAX" from( select LOAN_NUMBER, UN_ID from TEST_TABLE where OCCSTAT = 'Occupied' group by LOAN_NUMBER, UN_ID ) group by LOAN_NUMBER )i left join TEST_TABLE i2 on i.ID_MAX = i2.UN_ID
Thanks in advance.
RTry this query, it should be equivalent to your:
select UN_ID, CHANGE_DATE, PROP_TYPE, OCCSTAT from ( select LOAN_NUMBER, UN_ID, CHANGE_DATE, PROP_TYPE, OCCSTAT, rank() over(partition by LOAN_NUMBER order by un_id desc) rn from test_table where OCCSTAT = 'Occupied' ) where rn=1
Max
-
Hello.
I'm just trying to understand a few things about the BI server cache.
1. is there a time-out for the server cache BI which means how long it keeps the cache and when it should be deleted. Y at - it all the parameters that can be set to determine when the server cacahe BI expires.
2. when clears it BI server than the cacahe y at - it an order in which it gives off the sense cacahe if she has 10 inputs and reached a limit how he chooses only 10 entries to remove. How to determine which is deleted.
All documents pointing to the same thing with useful as well.
Thanks and greetingsHello
In the case where if the time persistent cache is defined at the level of the physical table, then the cache associated with this table will be deleted after the time interval specified. Another stratergy to remove the Cache is using the events polling mechanism. There are also other ways to purge the cache. In addition, according to the value set for MAX_CACHE_ENTRIES in the NQSConfig file, the cache entries are replaced based on the algorithm least recently used (LRU).
Below are the links for more details:
http://555obiee.WordPress.com/category/OBIEE-cache-management/
http://OBIEE-tips.blogspot.com/2009/09/OBIEE-query-caching.htmlDocumentation:
http://download.Oracle.com/docs/CD/E12096_01/books/AnyInConfig/AnyInConfigNQSConfigFileRef7.html#wp1005221Thank you
-
How to take a SQL query result in the source section of an APEX "agenda of the page" field and allow this request to be formatted using XML in an HTML format for a Java Script file to perform a function on the result?
Currently I have the following text:
To query the DB table and format the result as HTML:
SELECT XMLELEMENT ("UL id ="ticker01"', XMLAGG (XMLFOREST (Scroll_Mess AS LI))") "item UL' OF Web_Ticker where Mess_Id < 10 order by Mess_Id;
That displays the following:
< UL id = "ticker01" > < LI > HELLO < /LI > < LI > HELLO < /LI > < /UL id = "ticker01" >
I need the output of this to be visible to a JScript function that is currently called the "head of page", but there doesn't seem to be its scope? The function works correctly if there is a list in the page field items 'Text element Pre' but does not work correctly when used in conjunction with the query to generate a table form.
If everyone is happy to help I would be grateful .
James.
Solved!
In order for the request to be part of the DOM of the page of the APEX, the Java Script allows to perform its function on the result marked "HTML" to query, you must set page of the apex on which the query resides and then add the inner text of this page to a second variable for which the function of web ticker can run on as follows:
$(function() {})
var x = $("#P9_TICKER_DATA");
var y = x [0] .innerText;
x.Append (y);
$("UL#ticker01").liScroll ();
});
From there, on the Java script is able to properly see the result of the query in HTML format.
-
When I try to perform the following PROCEDURE, he throws me an error:
Error from line: 2 in command.
BEGIN
FACT_UPDATE;
END;
Error report-
ORA-01489: result of concatenating string is too long
ORA-06512: at "AFLOBIDW. FACT_UPDATE', line 22
ORA-06512: at line 2
01489 00000 - "result of concatenating string is too long."
* Cause: Result of concatenation of string exceeds the maximum size.
* Action: Make sure that the result is less than the maximum size.
---------------------------------------------------------------------------
I can't change the logic of the code since I'm trying to do Informatica at the back done and compare performance between Informatica and Oracle DB. Is there another solution for errors? I add only the SQL query that is part of the PROCEDURE for easy viewing. Please help me. Thank you!
SELECT "UPDATE XXAFL_MON_FACTS_F SET TASK_WID ='"
|| NVL (TO_CHAR (TASK_WID), 'NULL')
|', EXECUTION_PLAN_WID ='
|| NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL')
|| ', DETAILS_WID ='
|| NVL (TO_CHAR (DETAILS_WID), 'NULL')
|', SOURCE_WID ='
|| NVL (TO_CHAR (SOURCE_WID), 'NULL')
|', TARGET_WID = '
|| NVL (TO_CHAR (TARGET_WID), 'NULL')
|| ', RUN_STATUS_WID ='
|| NVL (TO_CHAR (RUN_STATUS_WID), 'NULL')
|', SEQ_NUM ='
|| NVL (TO_CHAR (SEQ_NUM), 'NULL')
|', NAME = "'
|| NVL (TO_CHAR (NAME), 'NULL')
|| ' ', NO_POSITION = "'
|| NVL (TO_CHAR (INSTANCE_NUM), 'NULL')
||'' ', INSTANCE_NAME = "'
|| NVL (TO_CHAR (INSTANCE_NAME), 'NULL')
|| ' ', TYPE_CD = "'
|| NVL (TO_CHAR (TYPE_CD), 'NULL')
||'' ', STATUS_CD = "'
|| NVL (TO_CHAR (STATUS_CD), 'NULL')
||'' ', START_TS ='
|| DECODE (START_TS, ",' to_date(''e))
|| To_char (START_TS, "mm/dd/yyyy hh)
||'' ((', "dd/mm/yyyy hh")')
|| ', END_TS ='
|| DECODE (END_TS, ",' to_date(''e))
|| To_char (END_TS, "mm/dd/yyyy hh)
||'' ((', "dd/mm/yyyy hh")')
|', DURATION = '
|| NVL (TO_CHAR (DURATION), 'NULL')
|', STATUS_DESC = "'
|| NVL (TO_CHAR (STATUS_DESC), 'NULL')
|| ' ', DBCONN_NAME = "'
|| NVL (TO_CHAR (DBCONN_NAME), 'NULL')
||'' ', SUCESS_ROWS ='
|| NVL (TO_CHAR (SUCESS_ROWS), 'NULL')
|| ', FAILED_ROWS ='
|| NVL (TO_CHAR (FAILED_ROWS), 'NULL')
|', ERROR_CODE = '
|| NVL (TO_CHAR (ERROR_CODE), 'NULL')
|', NUM_RETRIES ='
|| NVL (TO_CHAR (NUM_RETRIES), 'NULL')
|| ', READ_THRUPUT ='
|| NVL (TO_CHAR (READ_THRUPUT), 'NULL')
|', LAST_UPD = '
|| DECODE (LAST_UPD, ",' to_date(''e))
|| To_char (LAST_UPD, "mm/dd/yyyy hh)
||'' ((', "dd/mm/yyyy hh")')
|', RUN_STEP_WID = "'
|| NVL (TO_CHAR (RUN_STEP_WID), 'NULL')
|| ' ', W_INSERT_DT = '
|| DECODE (W_INSERT_DT, ",' to_date(''e))
|| To_char (W_INSERT_DT, "mm/dd/yyyy hh)
||'' ((', "dd/mm/yyyy hh")')
|', W_UPDATE_DT = '
|| DECODE (W_UPDATE_DT, ",' to_date(''e))
|| To_char (W_UPDATE_DT, "mm/dd/yyyy hh)
||'' ((', "dd/mm/yyyy hh")')
|| ', START_DATE_WID ='
|| NVL (TO_CHAR (START_DATE_WID), 'NULL')
|', END_DATE_WID = '
|| NVL (TO_CHAR (END_DATE_WID), 'NULL')
|', START_TIME ='
|| NVL (TO_CHAR (START_TIME), 'NULL')
|', END_TIME ='
|| NVL (TO_CHAR (END_TIME), 'NULL')
||' WHERE INTEGRATION_ID = "'
|| INTEGRATION_ID
||''';' AS Column
OF XXAFL_MON_FACTS_F;
Hello
ORA-01489 is one of these error messages that really means what he says. The error message you posted pretty much sums up the situation.
What version of Oracle are you using? (You must still include this whenever you have a question. See the FAQ forum: Re: 2. How can I ask a question on the forums? )
From 12.1 of the Oracle, there is an option to allow VARCHAR2s in SQL to be as big as 32767octets. (The default is 4000).
Otherwise, if you can't change the code, either do not run. or ensure that the concerned channels are quite short so the error does not occur.
Maybe you are looking for
-
I know how to use the BCC field so that the recipients do not see THE names, but I wish that each recipient to see their own name, but none of the others. Is this possible?
-
Tecra A6 (PTA60E) - need info on GPU
Hello Recently I got a preowned TECRA A6 and I was wondering just what gpu, she had ideas of her would be much appreciated Thank you jake
-
CUT or not? (MX200 essential 500 GB)
Hello. I recently bought a 500 GB SSD Crucial MX200. I am on El Capitan, at the moment and I wondered if I should activate TRIM or not? I make music production I use my hard drive to write data frequently. All the words of advice? Thank you...
-
What is the speed of the processor (SoC) in the Netgear CM600 Modem cable 24 x 8? I know that the Netgear CM500 16 x 4 and Arris SB6183 16 x 4 modems use Broadcom chips that have the processing power of the double thread of 600 MHz. The Arris SB6190
-
Hello A work of Radeon 5450 1 GB on a Slimline s3321p with 160w power ahead? I heard that a 5450 is the best graphics card to upgrade a tapered, with a power supply 160w without upgrading of power supply. All the specifications of my computer are alw