Tuning for sql join key table no consumer of the heavy use of the query processor
Obligation comes to tunne prod of the query in
high use of the query processor
sql_id: fp79wb32h7a6t
Module: AHC, P_PatientDQ()
Cost: 7
Elapsed time: hung
Status: Hung, 35,253,460 day at 30 minute intervals
-Create table
create table ahc. PATIENTVISITS
(
ahcid NUMBER,
visitId NUMBER,
visitstatus NVARCHAR2 (100),
visitdate DATE,
visitintime DATE,
visitouttime DATE
)
-Create/recreate the index
create indexes ahc. F1_PATIENTVISIT_AHCID on ahc. PATIENTVISITS (AHCID, VISITID);
create indexes ahc. VISITDATE_IDX on ahc. PATIENTVISITS (TRUNC (VISITDATE));
First total number of table
Select count (1) of
Pvs AHC.patientvisits
-Save County 1387485
create table ahc. PATIENTDEPENDENTVISITS
(
ahcid NUMBER (19) not null,
IDPack NUMBER (10) not null,
visitId NUMBER (19) not null,
dependentvisitid NUMBER (19) not null,
isdiabetic NUMBER (2)
)
-Create/recreate the index
create indexes ahc. K1_PATIENTDEPENDENT_AHCID on ahc. PATIENTDEPENDENTVISITS (AHCID);
Total number of second table
Select count (1) of
AHC.patientdependentvisits POS
-Save County 774599
Original request:
SELECT count (*)
ACH. PVS PATIENTVISITS
WHERE PVS. VISITID IN (SELECT POS. DEPENDENTVISITID
ACH. PATIENTDEPENDENTVISITS POS
WHERE POS. AHCID = 37
AND POS. VISITID = 218
AND POS. ISDIABETIC = 0)
AND SUPERIOR (PVS. VISITSTATUS) = 'PENDING'
AND PVS. AHCID = 37
Count (1)
-----------
1
PL/sql Developer explain plan for the original query
Owner of description Objects_name cost cardin bytes cpucost cost of e/s
SELECT STATEMENT, GOAL = ALL_ROWS | 7 | 1 | 41 | 63669 | 7 | ||
AGGREGATION OF TRI | 1 | 41 | |||||
SEMI OF THE NESTED LOOPS | 7 | 1 | 41 | 63669 | 7 | ||
TABLE ACCESS BY INDEX ROWID | AHC | PATIENTVISITS | 4 | 1 | 25 | 33295 | 4 |
INDEX RANGE SCAN | AHC | F1_PATIENTVISIT_AHCID | 3 | 9 | 23164 | 3 | |
TABLE ACCESS BY INDEX ROWID | AHC | PATIENTDEPENDENTVISITS | 3 | 1 | 16 | 30375 | 3 |
INDEX RANGE SCAN | AHC | K1_PATIENTDEPENDENT_AHCID | 2 | 14 | 18093 | 2 |
After editing the query
SELECT / * + FIRST_ROWS * / COUNT (1)
ACH. PVS PATIENTVISITS
JOIN THE AHC. PATIENTDEPENDENTVISITS POS ON PVS. VISITID = POS. DEPENDENTVISITID
WHERE PVS. AHCID = POS. AHCID
AND POS. AHCID = 37
AND POS. VISITID = 218
AND POS. ISDIABETIC = 0
AND SUPERIOR (PVS. VISITSTATUS) = 'PENDING'
Count (1)
-----------
1
PL/sql Developer explain plan for change request
Owner of description Objects_name cost cardin bytes cpucost cost of e/s
SELECT STATEMENT, TARGET = TIP: FIRST_ROWS | 7 | 1 | 41 | 59257 | 7 | ||
AGGREGATION OF TRI | 1 | 41 | |||||
NESTED LOOPS | |||||||
NESTED LOOPS | 7 | 1 | 41 | 59257 | 7 | ||
TABLE ACCESS BY INDEX ROWID | AHC | PATIENTDEPENDENTVISITS | 4 | 1 | 16 | 36646 | 4 |
INDEX RANGE SCAN | AHC | K1_PATIENTDEPENDENT_AHCID | 3 | 14 | 24364 | 3 | |
INDEX RANGE SCAN | AHC | F1_PATIENTVISIT_AHCID | 2 | 1 | 15293 | 2 | |
TABLE ACCESS BY INDEX ROWID | AHC | PATIENTVISITS | 3 | 1 | 25 | 22611 | 3 |
here after I changed the query no display cost = 7 io wait = improvement also 7 can someone please help these
How to adjust or rewrite lots of join not keys to multiple records on table table
Thank you
VSM
you have not answered my question. Are you really calling it 35 million times in 30 minutes?
If so, why?
Tags: Database
Similar Questions
-
OutOfMemoryError: GC overhead limit at execution a loading interface directly sql for sql with no work table.
I get the error message: error: exception OutOfMemoryError: higher GC limit exceeded when executing an interface making a direct using IKM SQL for SQL command load Append, source a 150millions lines table.
I have increased the ODI_MAX_HEAP and the interface run longer and failed. I'm already at: ODI_MAX_HEAP = 12560 m I tested with ODI_MAX_HEAP = 52560 m and still error.
I am following up to the memory of the server and I still have available memory...
Apart from the problem of memory I know that this type of load should be possible because the step of data load on LKM SQL to Oracle is able to load the work table $ CAN. Ideally, I want to emulate this behavior by using SQL for SQL IKM.
1 - What is the right path to follow here? (change the parameters of memory or modify the IKM?)
2 - ideas on how to solve the OutOfMemoryError: GC overhead limit exceeded error? (GC means Garbage Collector)
Execution of the IKM interface in the Simulator generates this code:
Load (Source) command:
Select
source - tbl.col1 COL1,
source - tbl.col2 COL2,
source-tbl. "' COL3 ' COL3
of public.source - tbl AS source-tbl
where
(1 = 1)
Default command (Destination):
insert into the source-tbl
(
col1,
col2,
COL3
)
values
(
: COL1,.
: COL2.
: COL3
)
My experience is very limited with ODI so I don't know about changing the code to the KMs
Thanks in advance.
Find a work around the error of generals limit exceeded GC:
-in my case I was running without the IDE so that changes made to the odiparams.sh were not useful.
-This means that I need to change the JVM settings to:
$ODI_HOME/oracledi/client/odi/bin/odi.conf
AddVMOption - XX: MaxPermSize = NNNNM
$$ODI_HOME/oracledi/client/ide/bin/ide.conf
AddVMOption - XmxNNNNM
AddVMOption - XmsNNNNM
Where NNNN is a higher value.
-
SQL: JOIN two table also corresponding column NULL how?
Hello
I'm trying to join two tables which works fine,
But if there are NULL values, then, JOIN does not.
I have two tables TEMP_DD AND TEMP_EE, in which two line
is the column: allocation A_ID,.
IE: 112 and NULL and I want both my sql output, but how?
I tried under sql as it returns only a single line of 112 and does not return a null row which is a football game.
How to remedy this situation?SELECT * FROM TEMP_DD JOIN TEMP_EE ON (TEMP_DD.A_ID = TEMP_EE.A_ID);
OUTPUTcreate table TEMP_DD ( A_ID VARCHAR2(3), B_ID VARCHAR2(4), C_ID VARCHAR2(10) ); create table TEMP_EE ( A_ID VARCHAR2(3), B_ID VARCHAR2(4), C_ID VARCHAR2(10) ); insert into TEMP_DD (A_ID, B_ID, C_ID) values ('112', '1123', '12345678'); insert into TEMP_DD (A_ID, B_ID, C_ID) values (NULL, '1123', '12345678'); insert into TEMP_DD (A_ID, B_ID, C_ID) values ('212', '1123', '12345678'); insert into TEMP_EE (A_ID, B_ID, C_ID) values ('112', '1123', '12345678'); insert into TEMP_EE (A_ID, B_ID, C_ID) values (NULL, '1123', '12345678'); insert into TEMP_EE (A_ID, B_ID, C_ID) values ('312', '1123', '12345678');
---------
"112', ' 1123," "12345678".
(NULL, ' 1123","12345678 ".Hello
Wrap both sides in an NVL IE. NVL (col1, 'X'), WHERE = NVL(col2,'X').
See you soon
Ben
-
How to join two tables if you transpose the rows, columns and rows in one of the table
Hi guys,.
can someone help me please in the write request
I have two tables
Agents and Agent phones but in the agent phones table for the id of an agent it displays 4 rows because one of the column there types of different phones (office, mobile, home, fax)
So instead of display 4 rows, I used max(case...) to convert rows to columns
now how to reach it with another table
Requirement:
Database: 11.2.0.2.0
create the table AGENT_PHONE
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
Phone_Number VARCHAR2 (16) not null,
phone_type_code VARCHAR2 (10) not null
)
CREATE TABLEAGENTS
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
NAME VARCHAR2 (40) NOT NULL
)
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '4805551436', 'CELL');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '1111111111', 'PHONE');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '2223334444',' OFF');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '5556667788', 'FAX');
INSERT INTO VALUES AGENTS
(29709, ARE ', 'OFFICE', 'FLY');
INSERT INTO VALUES AGENTS
(1234, ARE ', 'OFFICE', 'MIKE');
SELECT * FROM AGENT_PHONES
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE ---------------------------------------------------------------------------------------------
29709 RE OFFICE 4805551436 CELL 29709 RE OFFICE 1111111111 PHONE 29709 RE OFFICE 2223334444 OFF 29709 RE OFFICE 5556667788 FAX
SELECT * AGENTS
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME
29709 RE OFFICE ROB 1234 RE OFFICE MIKE
This is so the data we have in both table
Now, I transposed rows to columns in the table of agent phones so I used the following query
SELECT AP. AGENT_ID,. AGENT_TYPE_CODE,. AGENT_TYPE_PREFIX.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'CELL' THEN AP. PHONE_NUMBER END) AS CELL.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'OFF' THEN AP PHONE_NUMBER END) AS TURNED OFF.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'FAX' THEN AP. PHONE_NUMBER END) LIKE FAX,.
MAX (CASE WHEN PHONE_TYPE_CODE = 'PHONE'. THEN AP PHONE_NUMBER END) AS PHONE
AGENT_PHONE AP
WHERE AP. AGENT_ID = 29709
GROUP OF AP. AGENT_ID, AP. AGENT_TYPE_CODE, AP. AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL OFF FAX PHONE 1 29709 RE OFFICE 4805551436 2223334444 5556667788 1111111111 My question is how this to join the agents table so that my output should be like this...
I want to display all the results in the table of the Agent, even if they are not in the table of agent phones. As you can see there are other agent id 1234 is also populated
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE Currently, I run this query and I get the output as below
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE 1 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 CELL 2 29709 RE OFFICE ROB 29709 RE OFFICE 1111111111 PHONE 3 29709 RE OFFICE ROB 29709 RE OFFICE 2223334444 OFF 4 29709 RE OFFICE ROB 29709 RE OFFICE 5556667788 FAX 5 1234 RE OFFICE MIKE I want id 29709 agent in a line with 1234 agent also id to display
You can rotate your phone number of agent in columns
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 Then you can join to view inline or CTE
with AGENT_PHONE_PIVOT like)
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
)
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE_PIVOT AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE - - - - - - - Is that what you're looking for?
-
Help with a script to search for text in a table cell and apply the cell style
Hello
I build the script which Jongware wrote in his post here http://indesignsecrets.com/tackling-tables-through-scripting.php - I am trying to create a variable in which I can add a number of different parts of the text, in this case it's different parts of the United Kingdom i.e. 'London', 'East', 'Scotland' etc. I just need the script to apply the cell Style - 'District Cell' - to any cell that contains text in the variable. Here's the script, if anyone can help I would be grateful.
function checkWhichTable() { // ensure the user made a selection if (app.selection.length != 1) return null; var currentTable = app.selection[0]; if (currentTable.hasOwnProperty("baseline")) { currentTable = app.selection[0].parent; } while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column) currentTable = currentTable.parent; if (!(currentTable instanceof Table)) { // No table selected return null; } return currentTable; } app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table"); function checkUserSelection () { var a_table = checkWhichTable(); if (a_table == null) { if (confirm("No table selected. Do you want to process *all* tables?") == false) return; allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements(); for (aTable=0; aTable<allTables.length; aTable++) { processTable (allTables[aTable]); } } else { processTable (a_table); } } function processTable(table) { // do something here! //Find Text in Cell and apply Cell Style var textInCell=['London', 'Scotland', 'South West']; for (i=0; i<table.cells.length; i++) { if (table.cells[i].texts[0].contents==textInCell) table.cells[i].appliedCellStyle = "District Cell"; } }
Hello
Change this feature:
function processTable(table) { //Find Text (exactly as it is) in Cell and apply Cell Style var textInCell=['London', 'Scotland', 'South West'], mFound, cFound; app.findGrepPreferences = null; app.findGrepPreferences.findWhat = "^(" + cities.join("|") + ")$"; mFound = table.findGrep(); while( cFound = mFound.pop() ) cFound.parent.appliedCellStyle = "District Cell"; }
Jarek
-
How to join several tables source and do the research?
I have a requirement to load a target table by joining 4 source tables. Also, I do a search on a field of table to transform codes and check for NULL values. What will be the best approach for load table target?
Is it possible to do it in a single interface, or do I need to create multiple interfaces to achieve this?
My basic source and target are oracle, and I am planing to use incremental update Oracle merge.
Thank youYou are in the right direction by creating an interface for this transformation.
You will need to drag the source drop 4 tables + the lookup table in the Sources of Interface window and then make the appropriate joins.
Also, look for NULL values in the transformation. Depends on what you want to do with NULL values. If you want to ignore, use a filter.
If you want to make mistakes, use a constraint.
If you want to convert them, use NVLStart with Oracle Update incremental and once successful, use incremental update Oracle MERGE.
-
Join itself find missing links, helps the query, table
Data in the table:
I'm trying to right a query that returns the relationships that are the only way.tblRelationships RelationshipID SourceID DestinationID 1 100 200 2 200 100 3 300 100
So for the above data, 3 would return because he'll only source 300 to 100 and not source from 100 to 300.
Published by: avalanche333 on January 15, 2010 12:26SQL> create table tblRelationships ( 2 RelationshipID NUMBER, 3 SourceID NUMBER, 4 DestinationID NUMBER) 5 / Table created. SQL> insert into tblRelationships values (1,100,200); 1 row created. SQL> insert into tblRelationships values (2,200,100); 1 row created. SQL> insert into tblRelationships values (3,300,100); 1 row created. SQL> SQL> select relationshipid from tblrelationships 2 where sourceid in ( 3 select SourceID from tblRelationships 4 minus 5 select destinationid from tblRelationships) 6 / RELATIONSHIPID -------------- 3 SQL> drop table tblRelationships 2 / Table dropped. SQL>
-
I miss Windows activation code, rest of this KWKRT-JJCT4-JHC product key-, is there anyway to get it back
Thank you.Hello
If the operating system is preinstalled, product key Finder programs won't find a product key that can be used for purposes of resettlement.
_______________________________________
You can contact HP and ask them to send you a set of recovery disks and to reinstall the operating system, if they are available.
They should do this for a small fee.
And if you have never received a recovery disk when you bought your computer, there should be a recovery on the drive Partition hard reinstall Windows how much you bought your computer.
The recovery process can be started by pressing a particular combination of the key or keys at startup. (Power on / start)
Maybe it's F10, F11, Alt + F10, etc., depending on the manufacturer.
Ask them to the proper key sequence.
The methods above resettlement generally do not require allows you to provide a product key during Installation, the recovery process uses the Installation product key factory to activate automatically during the resettlement process.
See you soon.
-
Loading data from SQL to Essbase table
Hello
I'm loading data from SQL to Essbase table by using a rules file. Number of rows in the source table is 7 million. I use the SUNOPSIS MEMORY ENGINE as area transit, LKM SQL for SQL and SQL IKM for Hyperion Essbase (DATA).
Question:
1 can I not use any other LKM as MSSQL for MSSQL (PCBS) to load data to the staging instead of LKM SQL for SQL? What I have to change the transit area then? Loading data using LKM SQL for SQL seems quite slow.
2 it is mandatory to use LKM SQL for SQL, can someone please tell me what I can change to make this quick support parameters?
3. is it compulsory to use the SUNOPSIS MEMORY engine loading data from SQL server to Essbase?
Thank you...
(1) Yes, I highly recommend watching using a KM which uses native as database technology these will usually be more efficient than the generic (like LKM SQL for SQL) KM especially when large volumes of data are involved. Your staging will change depends on where you organize data for example if you are using a SQL server specific KM as - MSSQL for MSSQL (PCBS) - you must have a lay-by available on a MSSQL database and have access to the utility of PCBS.
(2) it is not mandatory to use this KM you can use a KMs supported by your database technology
(3) it is absolutely not obligatory to use the SUNOPSIS MEMORY engine. This should only be used when you have relatively small amounts of data, as well as all the processes in memory, or in the case where you have no other relational technology to perform the staging on. However, in your case to use wherever you are processesing these large volumes of data you should be staged on a physical such as SQL Server or Oracle database if they are available.
-
Tree of SQL on multiple tables
Hi gurus,
I have a question about the trees of building sql on multiple tables.
It's the exit, I hope:
This is the situation: I have 4 table which can be forced to key foreign and all build toghether in a tree.0 - 10, 'Company Blue1', 0 -- 101, 'Part Blue1', 10 --- 1001, 'Accounting Blue', 101 ---- 10001, 'Hans Mueller', 1001 --- 1002, 'Special Problems Blue', 101 ---- 10002, 'Stephen Meyer', 1002 ---- 10003, 'Carlos Anceto', 1002 -- 102, 'Part Blue2', 10 --- 1003, 'Information Technology Blue', 102 ---- 10004, 'Tobias Tries', 1003 - 20, 'Company Red1', 0 -- 201, 'Part Red1', 20 --- 2001, 'Accounting Red', 201 ---- 20001, 'Carl Van Deser', 2001 ---- 20002, 'Geromel Boats', 2002 - 30, 'Company Green1', 0 -- 301, 'Part Green1', 30 --- 3001, 'Accounting Green', 301 ---- 30002, 'Peter Finnighan', 3001 --- 3003, 'Special Problems Green', 301 ---- 30001, 'Loui Van Ecke', 3003
The problem is that I do not know how in alle concate these values and using the connection by the clause that creates this treeTable1: tbl_company (c_id, company_name) Values: 10, 'Company Blue1' 20, 'Company Red1' 30, 'Company Green1' Table2: tbl_company_parts (cp_id, part_name, company_id) Values: 101, 'Part Blue1', 10 102, 'Part Blue2', 10 201, 'Part Red1',20 301, 'Part Green1',30 Table3: tbl_departments (d_id, dept_name, part_id) Values: 1, 'Accounting Blue', 101 2, 'Special Problems Blue', 101 3, 'Information Technology Blue', 102 4, 'Accounting Red',201 5, 'Accounting Green',301 6, 'Special Problems Green',301 Tablemployees (e_id, dept_name, department_id) Values: 1, 'Hans Mueller', 1 2, 'Stephen Meyer', 2 3, 'Carlos AncetoÄ, 2 4, 'Carl Van Deser',4 5, 'Geromel Boats', 4 6, 'Loui Van Ecke',5 7, 'Peter Finnighan',6 8, 'Tobias Tries',3
Hi Tobias,.
It was not exactly how id should be calculated, but this example you get:
SQL> create table tbl_company (c_id, company_name) 2 as 3 select 10, 'Company Blue1' from dual union all 4 select 20, 'Company Red1' from dual union all 5 select 30, 'Company Green1' from dual 6 / Table created. SQL> create table tbl_company_parts (cp_id, part_name, company_id) 2 as 3 select 101, 'Part Blue1', 10 from dual union all 4 select 102, 'Part Blue2', 10 from dual union all 5 select 201, 'Part Red1',20 from dual union all 6 select 301, 'Part Green1',30 from dual 7 / Table created. SQL> create table tbl_departments (d_id, dept_name, part_id) 2 as 3 select 1, 'Accounting Blue', 101 from dual union all 4 select 2, 'Special Problems Blue', 101 from dual union all 5 select 3, 'Information Technology Blue', 102 from dual union all 6 select 4, 'Accounting Red',201 from dual union all 7 select 5, 'Accounting Green',301 from dual union all 8 select 6, 'Special Problems Green',301 from dual 9 / Table created. SQL> create table tbl_employees (e_id, emp_name, department_id) 2 as 3 select 1, 'Hans Mueller', 1 from dual union all 4 select 2, 'Stephen Meyer', 2 from dual union all 5 select 3, 'Carlos Anceto', 2 from dual union all 6 select 4, 'Carl Van Deser',4 from dual union all 7 select 5, 'Geromel Boats', 4 from dual union all 8 select 6, 'Loui Van Ecke',5 from dual union all 9 select 7, 'Peter Finnighan',6 from dual union all 10 select 8, 'Tobias Tries',3 from dual 11 / Table created. SQL> select coalesce 2 ( case when e.department_id is null then null else 3 trunc(d.part_id,-2) * 100 + dense_rank() over (partition by d.part_id order by e.e_id) 4 end 5 , trunc(d.part_id,-2) * 10 + dense_rank() over (partition by d.part_id order by d.d_id) 6 , p.cp_id 7 , c.c_id 8 , 0 9 ) id 10 , coalesce 11 ( e.emp_name 12 , d.dept_name 13 , p.part_name 14 , c.company_name 15 ) name 16 , coalesce 17 ( trunc(d.part_id,-2) * 10 + dense_rank() over (partition by d.part_id order by d.d_id) 18 , d.part_id 19 , p.company_id 20 , case grouping(c.c_id) when 0 then 0 end 21 ) parent_id 22 from tbl_company c 23 , tbl_company_parts p 24 , tbl_departments d 25 , tbl_employees e 26 where c.c_id = p.company_id 27 and p.cp_id = d.part_id 28 and d.d_id = e.department_id 29 group by rollup 30 ( ( c.c_id,c.company_name) 31 , ( p.cp_id,p.part_name,p.company_id) 32 , ( d.d_id,d.dept_name,d.part_id) 33 , ( e.e_id,e.emp_name,e.department_id) 34 ) 35 order by c.c_id nulls first 36 , p.cp_id nulls first 37 , d.d_id nulls first 38 , e.e_id nulls first 39 / ID NAME PARENT_ID ---------- --------------------------------------------------------------------------------- ---------- 0 10 Company Blue1 0 101 Part Blue1 10 1001 Accounting Blue 1001 10001 Hans Mueller 1001 1002 Special Problems Blue 1002 10002 Stephen Meyer 1002 10003 Carlos Anceto 1002 102 Part Blue2 10 1001 Information Technology Blue 1001 10001 Tobias Tries 1001 20 Company Red1 0 201 Part Red1 20 2001 Accounting Red 2001 20001 Carl Van Deser 2001 20002 Geromel Boats 2001 30 Company Green1 0 301 Part Green1 30 3001 Accounting Green 3001 30001 Loui Van Ecke 3001 3002 Special Problems Green 3002 30002 Peter Finnighan 3002 22 rows selected.
Kind regards
Rob. -
my computer keeps asking for my activation key
my computer keeps asking for my activation key while I installed all the programs that came with my new motherboard - R2.0 P8H61-MLX3 I don't know what my product key even though I looked everywhere directed. looking forward to your help
Have you tried to restart by phone?
How to activate Windows 7 manually (activate by phone)
1) click Start and in the search for box type: slui.exe 4
(2) press the ENTER"" key.
(3) select your "country" in the list.
(4) choose the option "activate phone".
(5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
(6) explain your problem clearly to the support person.
http://support.Microsoft.com/kb/950929/en-usPlease run the Microsoft Genuine Diagnostics Tool then copy and paste the results into an answer here for further analysis:
http://go.Microsoft.com/fwlink/?LinkId=52012 -
How to specify an outer join in the query designer
I quickly built a large query with the query designer, and it works very well, but does not produce 9 disks on 2200 - so I need to change to an outer join.
My problem is that I can't find a way to specify an outer join. I tried to change the query, query builder formed, but it won't let me.
I know that I can capture the query, edit and run it in sql developer and that works fine, but I want to use the Query Builder as it is the fastest way I know to quickly add and remove items - my users don't know exactly what that it to include.
I know it's kind of a trivial question, but I searched the forum, manual, the web and no luck
Thanks for any help you can give
GlennHi Glenn,.
When you use the query designer to create the sql statement, you must click on the empty box to the right of the fields in each table to create the join. When you are finished, you should see a line drawn between the two tables. Click on this line, and a small window appears allowing you to select inner outer or right outer joins, left.
When the report was created, however, you must change the statement. For example, if you use the query designer to join DEPT at EMP based on the DEPTNO field on the two tables, you get:
select "DEPT"."DEPTNO" as "DEPTNO", "DEPT"."DNAME" as "DNAME", "DEPT"."LOC" as "LOC", "EMP"."EMPNO" as "EMPNO", "EMP"."ENAME" as "ENAME", "EMP"."JOB" as "JOB", "EMP"."MGR" as "MGR", "EMP"."HIREDATE" as "HIREDATE" from "EMP" "EMP", "DEPT" "DEPT" where "DEPT"."DEPTNO"="EMP"."DEPTNO"
This is to change:
select "DEPT"."DEPTNO" as "DEPTNO", "DEPT"."DNAME" as "DNAME", "DEPT"."LOC" as "LOC", "EMP"."EMPNO" as "EMPNO", "EMP"."ENAME" as "ENAME", "EMP"."JOB" as "JOB", "EMP"."MGR" as "MGR", "EMP"."HIREDATE" as "HIREDATE" from "EMP" "EMP" LEFT OUTER JOIN "DEPT" "DEPT" ON "DEPT"."DEPTNO"="EMP"."DEPTNO"
Andy
-
How did the foreign key that is recognized by the primary key
Hi, when I have two user tables and userLevel and the primary key of the user is the user name and I add a field to userLevel userID is only to make the userID field in userLevel automatically the foreign key of the table? Or do you switch the engine of MyISAM tables to InnoDB to make relational links. Can someone please explain this in English clear to me, because I just can't get my head around this.
In the case of a query such as SELECT statement, we talked, being a key actually means that the field is indexed so that the database can quickly look up. Thus, in phpMyAdmin, you set the field to be indexed by the visualization of the structure of the table and clicking the icon index (the one with the Lightning) for the field in the Action section.
If you are looking for integrity refrential between tables we also talked about and using the InnoDB engine, you can click the link 'Show the relational' in the table structure page of phpMyAdmin and define foreign key constraints.
-
Refresh the result table or rerun the query
I have a requirement, simple but stuck somewhere.
Jdev 11.1.1.17 Expert level: Mid-Senior
I have a form of application and the associated result table. It works great and no problems.
My requirement is that I have a commandlink on one of the column. Clicking on that will open a popup with an editable filed. OK will commit and Cancel will close the pop-up window.
After that the popup is dismissed with partial trigger, my table refreshes but data is identical to the front. But if I click the Find (Search) button on the query, it shows the data with the results updated which are changed in the pop-up window above.
How do I update table which re - runs the query and then refreshes the table after the popup is dismissed, or when the user clicks the OK button in the pop-up window.
Get on the viewObject of this table and call the executeQuery method that
Write this method in the method AMImpl and then call it in bean managed using the OperationBinding at the click on the Ok button of the dialog box
ViewObject vo = this.getViewObjectName ();
vo.executeQuery ();
Ashish
-
In SQL Developer, is it possible to send the results of a sql statement?
In SQL Developer, is it possible to send the results of a sql statement?Right-click on the query results pane, select "Export data" in the context menu, then select "xls".
Maybe you are looking for
-
While trying to install gimp portable version on my mac Air, I get the following error message "Gimp app requires x 11 go to the optional package on OS install disc" this time I installed xquartz. Now when I bought my mac air (mid 2013 model) I don't
-
Drivers HP Photosmart 2610 XI will be dependent not on my new laptop Windows 8
I got the CD which worked well on my XP laptop I know not updated to a new laptop with Windows 8, and the cd is not compatible. I would like to be able to use all the features of my printer, but I need the drivers. Any help would be great. Sue
-
How to print an e-mail and attachment, but with open attachment.
I just want to print an email and it is incidental (e.g. pdf) but with the open pdf, not as an icon/link. Is it possible or ' add to ' who can do this?
-
I have been using site crackberry, and when ordering merchandise I wanted to return to correct some information from the previous screen. When I try to go forward even when I can't figure out how to go back to the right. Can anyone help please.
-
I would like to insert all other different lines of the failed. Could someone explain with a small piece of code.Thanks in advance,Pradeep