Extract the hierarchy in Parent child format from HP
Hello,
I have a hierarchy within Accounts dimension which I need to move to the other application in the different environment. I donot want to move the whole dimension. I just need to move a hierarchy. Is there a way I can extract a hierarchy in Parent child format with properties and move the same in to the next one.
Thanks in advance for your help.
Cheers,
XXX
Hi,
Below code assumes that you have 2 alias tables and assymetric hierarchy (having 4 to 6 levels) in accounts and all level 0 accounts are 6 digits. If you wish to remove the second alias table from the code simply remove references to it (i.e. aliastbl_id=50030). You can customize the extract top level member by modifying this section: (select object_id from hsp_object where object_name='Total Expenditure')
This outputs the structure in a fixed columnar format having all levels in different columns.
Code:
select o1.object_name as LVL1, o1.object_name as LVL1_DESC_EN, al1.object_name as LVL1_DESC_AR,
o2.object_name as LVL2, o2.object_name as LVL2_DESC_EN, al2.object_name as LVL2_DESC_AR,
o3.object_name as LVL3, al3.object_name as LVL3_DESC_EN, alar3.object_name as LVL3_DESC_AR,
o4.object_name as LVL4, al4.object_name as LVL4_DESC_EN, alar4.object_name as LVL4_DESC_AR,
o5.object_name as LVL5, al5.object_name as LVL5_DESC_EN, alar5.object_name as LVL5_DESC_AR,
o6.object_name as LVL6, al6.object_name as LVL6_DESC_EN, alar6.object_name as LVL6_DESC_AR
from hsp_object o1
left outer join (select * from hsp_alias where aliastbl_id=50030) a1 on o1.object_id=a1.MEMBER_ID left outer join hsp_object al1 on a1.alias_id=al1.object_id
inner join hsp_object o2 on o1.object_id=o2.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=50030) a2 on o2.object_id=a2.MEMBER_ID left outer join hsp_object al2 on a2.alias_id=al2.object_id
inner join hsp_object o3 on o2.object_id=o3.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a3 on o3.object_id=a3.MEMBER_ID left outer join hsp_object al3 on a3.alias_id=al3.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar3 on o3.object_id=ar3.MEMBER_ID left outer join hsp_object alar3 on ar3.alias_id=alar3.object_id
inner join hsp_object o4 on o3.object_id=o4.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a4 on o4.object_id=a4.MEMBER_ID left outer join hsp_object al4 on a4.alias_id=al4.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar4 on o4.object_id=ar4.MEMBER_ID left outer join hsp_object alar4 on ar4.alias_id=alar4.object_id
inner join hsp_object o5 on o4.object_id=o5.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a5 on o5.object_id=a5.MEMBER_ID left outer join hsp_object al5 on a5.alias_id=al5.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar5 on o5.object_id=ar5.MEMBER_ID left outer join hsp_object alar5 on ar5.alias_id=alar5.object_id
inner join hsp_object o6 on o5.object_id=o6.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a6 on o6.object_id=a6.MEMBER_ID left outer join hsp_object al6 on a6.alias_id=al6.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar6 on o6.object_id=ar6.MEMBER_ID left outer join hsp_object alar6 on ar6.alias_id=alar6.object_id
where o1.object_id =(select object_id from hsp_object where object_name='Total Expenditure') and
LENGTH(o6.object_name)=6
union all
select o1.object_name as LVL1, o1.object_name as LVL1_DESC_EN, al1.object_name as LVL1_DESC_AR,
o2.object_name as LVL2, o2.object_name as LVL2_DESC_EN, al2.object_name as LVL2_DESC_AR,
o3.object_name as LVL3, al3.object_name as LVL3_DESC_EN, alar3.object_name as LVL3_DESC_AR,
o4.object_name as LVL4, al4.object_name as LVL4_DESC_EN, alar4.object_name as LVL4_DESC_AR,
o5.object_name as LVL5, al5.object_name as LVL5_DESC_EN, alar5.object_name as LVL5_DESC_AR,
o5.object_name as LVL6, al5.object_name as LVL6_DESC_EN, alar5.object_name as LVL6_DESC_AR
from hsp_object o1
left outer join (select * from hsp_alias where aliastbl_id=50030) a1 on o1.object_id=a1.MEMBER_ID left outer join hsp_object al1 on a1.alias_id=al1.object_id
inner join hsp_object o2 on o1.object_id=o2.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=50030) a2 on o2.object_id=a2.MEMBER_ID left outer join hsp_object al2 on a2.alias_id=al2.object_id
inner join hsp_object o3 on o2.object_id=o3.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a3 on o3.object_id=a3.MEMBER_ID left outer join hsp_object al3 on a3.alias_id=al3.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar3 on o3.object_id=ar3.MEMBER_ID left outer join hsp_object alar3 on ar3.alias_id=alar3.object_id
inner join hsp_object o4 on o3.object_id=o4.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a4 on o4.object_id=a4.MEMBER_ID left outer join hsp_object al4 on a4.alias_id=al4.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar4 on o4.object_id=ar4.MEMBER_ID left outer join hsp_object alar4 on ar4.alias_id=alar4.object_id
inner join hsp_object o5 on o4.object_id=o5.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a5 on o5.object_id=a5.MEMBER_ID left outer join hsp_object al5 on a5.alias_id=al5.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar5 on o5.object_id=ar5.MEMBER_ID left outer join hsp_object alar5 on ar5.alias_id=alar5.object_id
where o1.object_id =(select object_id from hsp_object where object_name='Total Expenditure') and
LENGTH(o5.object_name)=6
union all
select o1.object_name as LVL1, o1.object_name as LVL1_DESC_EN, al1.object_name as LVL1_DESC_AR,
o2.object_name as LVL2, o2.object_name as LVL2_DESC_EN, al2.object_name as LVL2_DESC_AR,
o3.object_name as LVL3, al3.object_name as LVL3_DESC_EN, alar3.object_name as LVL3_DESC_AR,
o4.object_name as LVL4, al4.object_name as LVL4_DESC_EN, alar4.object_name as LVL4_DESC_AR,
o4.object_name as LVL5, al4.object_name as LVL5_DESC_EN, alar4.object_name as LVL5_DESC_AR,
o4.object_name as LVL6, al4.object_name as LVL6_DESC_EN, alar4.object_name as LVL6_DESC_AR
from hsp_object o1
left outer join (select * from hsp_alias where aliastbl_id=50030) a1 on o1.object_id=a1.MEMBER_ID left outer join hsp_object al1 on a1.alias_id=al1.object_id
inner join hsp_object o2 on o1.object_id=o2.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=50030) a2 on o2.object_id=a2.MEMBER_ID left outer join hsp_object al2 on a2.alias_id=al2.object_id
inner join hsp_object o3 on o2.object_id=o3.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a3 on o3.object_id=a3.MEMBER_ID left outer join hsp_object al3 on a3.alias_id=al3.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar3 on o3.object_id=ar3.MEMBER_ID left outer join hsp_object alar3 on ar3.alias_id=alar3.object_id
inner join hsp_object o4 on o3.object_id=o4.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a4 on o4.object_id=a4.MEMBER_ID left outer join hsp_object al4 on a4.alias_id=al4.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar4 on o4.object_id=ar4.MEMBER_ID left outer join hsp_object alar4 on ar4.alias_id=alar4.object_id
where o1.object_id =(select object_id from hsp_object where object_name='Total Expenditure') and
LENGTH(o4.object_name)=6
Cheers,
Alp
Similar Messages
-
Converting numeric level identifier into Parent/Child format to load.
I am unable to receive meta data in parent child format from a ERP source system and need to load these into Planning through ODI. Each member is identified with a numeric level indicator. Is there any wasy to convert this into Parent/Child format using the level indicator?
Thank you.If you are using oracle you could look into using the "Connect by prior" function.
Cheers
John
http://john-goodwin.blogspot.com/ -
Hierarchy Table - Parent/Child Value Pairs w/o Node Name
Hi,
Has any body worked with below senario to create a Hierarchy table through Import Manager. If so how did you do it? I followed and sucessfull with some senario's by refering the blog "MDM Import Manager: handling multiple formats of source data for hierarchy" by pandey but not with this one. This scenair is actually from help.sap.com
Parent Category
Printers
Printers Laser
Printers Inkjet
Inkjet B&W
Inkjet Color
Printers Dot Matrix
Dot Matrix 300 DPI
Dot Matrix 600 DPI
Dot Matrix 1200 DPI
Edited by: SDN POWERED on Jun 7, 2009 8:59 PMHi SDN Powered,
For Hierarchy Table - Parent/Child Value Pairs w/o Node Name just do as follows:
1) In the Source Hierarchy tree, select the Parent and Child field nodes which you want to use to build hierarchy.
2) Right-click on one of the nodes and choose Create Hierarchy Field from the context menu, or choose Source > Create Hierarchy Field from the main menu.
3) MDM opens the Create Hierarchy Field dialog box. This dialog box contains 4 feilds, viz Hierarchy Field Name, Parent Field, Child Field, and Node Name Field. In the Hierarchy Field Name, type the name for the new field.In the Parent Field, Child Field. For Parent/Child Value Pairs w/o Node Name , set the Node Name Field to None.
4) Click OK to close the Create Hierarchy Field dialog box. The MDM Import Manager creates Hierarchy using the values you have provided.
I hope I am able to solve your problem.
Thanks & Regards
Dilmit Chadha -
Hi,
I have this table REQ_DETAILS
detail_id value_id parent
282 125 281
283 126 281
284 119 (null)
285 127 284
286 128 284
301 120 (null)
341 1169 321
303 130 301
322 1168 321
334 123 (null)
335 129 301
342 1170 321
321 122 (null)
361 1172 334
362 1171 334
363 119 (null)
364 120 (null)
365 1170 364
281 118 (null)
219 125 284
The column PARENT refers to DETAIL_ID.
and I've NUMTABLE of type INTEGER. (create or replace TYPE NUMTABLE AS TABLE OF INTEGER;)
I'd like to write a function which takes detail_id's as input and returns the correct order of the input. (parent-child format)
for example
order_req_det (detId_in NUMTABLE) return NUMTABLE;
order_req_det (219, 284, 285, 286, 282, 283, 281, 362, 334, 361)
should return the below output.
284
219
285
286
281
282
283
334
361
362
Any suggestions?
Regards.Guys, not even a suggestion?
SQL> desc numtable;
numtable TABLE OF NUMBER(38)
SQL> select * from test;
DETAIL_ID VALUE_ID PARENT
282 125 281
283 126 281
284 119
285 127 284
286 128 284
301 120
341 1169 321
303 130 301
322 1168 321
334 123
335 129 301
342 1170 321
321 122
361 1172 334
362 1171 334
363 119
364 120
365 1170 364
281 118
219 125 284
20 rows selected.
SQL> declare
2 vt1 numtable :=
3 numtable(219, 284, 285, 286, 282, 283, 281, 362, 334, 361);
4 vt2 numtable;
5 vt3 numtable;
6 vt4 numtable := numtable();
7 --v2 number;
8 begin
9 select detail_id
10 bulk collect into vt2
11 from test
12 where parent is null
13 and detail_id in( select column_value
14 from table(vt1));
15 for i in 1..vt2.count loop
16 select detail_id
17 bulk collect into vt3
18 from test
19 start with detail_id = vt2(i)
20 connect by prior detail_id = parent
21 order siblings by detail_id;
22 vt4 := vt4 multiset union vt3;
23 end loop;
24 for i in 1..vt4.count loop
25 dbms_output.put_line(vt4(i));
26 end loop;
27 end;
28 /
284
219
285
286
281
282
283
334
361
362
PL/SQL procedure successfully completed. -
Inclue children and exclue children in a single hierarchy in parent child dimension in mdx
hi,
include children and exclude children in a single hierarchy in parent child dimension in mdx
*12-parent
**20-parent
- 9-parent
--250-child1
--210-child2
--240-child3
aggregation of 12-parent only
aggregation of 20-parent only
aggregation of 9 with children
regards,
ManishHi manishcal16PPS,
According to your description, you have a parent child dimension in your cube. Now you want to use one measure use show aggregation value including/excluding child member based on different parent level member. Right?
In this scenario, we could use IIF() in the calculated measure to apply different calculation depends on the current dimension member. Please refer to query below:
with member [x] as
IIF([Dim].[Hierarchy].CurrentMember is [Dim].[Hierarchy].[Parent].&[9]
sum(Descendants([Dim].[Hierarchy].CurrentMember,
[Date].[Calendar].[Parent]),
[Measures].[Amount])
sum([Dim].[Hierarchy].CurrentMember,[Measures].[Amount])
select [x] on 0,
[Date].[Calendar].[Parent].members on 1
from
[Cube]
Best Regards,
Simon Hou
TechNet Community Support -
<p>Hi</p><p> can anyoneplease tell me how to get metadata in parent child format <b><spanstyle=" text-decoration: underline;">from</span></b> essbase. Ineed the data from essbase cubes which are already build. we areusing version 6.5.4.2</p><p> </p><p>Thanks!!</p>
<p>Thanks forthe reply. i have some more questions.</p><p> Is it a freeware ?where can I download it from. As per my knowledge My company doesnthave it.</p><p> </p><p>Thanks!!</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>
-
Inserting parent /child records from a xml file ...
XML file pasted below:
I have loaded the xml file into a table called xml_demo which has a column xml_data of type xmltype.
The select for parent record is as follows and it works:
INSERT INTO balit_submissions (balitdoc, documentversion, datetime_from,job_id, status,creation_datetime)
(SELECT 'MOL'
,to_number(extract(x.xml_data,'/MolDocument/DocumentVersion/@v'))
,to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
'yyyy-mm-dd"T"hh24:mi')
,123456
,'CREATED',
NULL
FROM xml_DEMO x WHERE
existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1)
Having problem creating child records. From this file I expect to create 3 records.
insert into balit_energy_blocks
SO_ID,
DATETIME_FROM,
DIRECTION,
BLOCK_NUMBER,
ENERGY,
LAST_SUBMIT_DATETIME,
PRICE_POUNDS,
PRICE_EUROS,
BALIT_REF,
STATUS,
LAST_EDIT_DATETIME,
MOL_REASON,
ACQUIRING_SO_AREA)
(SELECT 'RTE'
,to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
'yyyy-mm-dd"T"hh24:mi')
,DECODE(extract(x.xml_data,'/MolDocument/MolTimeSeries/Direction/@v'),'AO1','Up','Down')
,to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
,to_number(extract(x.xml_data,'/MolDocument/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
,sysdate
,null -- price pounds
,null -- price euro
,extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v')
,'SUBMITTED'
,'A96'
,NULL -- acquiring area
,sysdate
FROM xml_DEMO x WHERE
existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1)
For example, there are 3 ContractIdentification tags. Example of 1:
<ContractIdentification v="RTE_20100331_1500_16"/>
I was expecting this select to pluck the last number from this string. In this case 16.
The select was:
to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
The result I got was:
16RTE_20100331_1500_20NG_20100331_1500_6
All contractident values are concatnated and returns from position 19 onwards.
Can anyone help me to extract the last number from each ContractIdentification tag value and to create the 3 records
Thanks
James Sathiaraj
<?xml version="1.0" encoding="UTF-8"?>
<MolDocument DtdVersion="3" DtdRelease="0">
<DocumentIdentification v="MOL_20100331_1500_1600"/>
<DocumentVersion v="1"/>
<DocumentType v="A43"/>
<SenderIdentification codingScheme="A01" v="17X100Z100Z0001H"/>
<SenderRole v="A35"/>
<ReceiverIdentification codingScheme="A01" v="10XFR-RTE------Q"/>
<ReceiverRole v="A04"/>
<CreationDateTime v="2010-03-31T14:10:00Z"/>
<ValidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<Domain codingScheme="A01" v="10YDOM-1001A001A"/>
<MolTimeSeries>
<ContractIdentification v="RTE_20100331_1500_16"/>
<ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
<AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
<ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
<AuctionIdentification v="AUCTION_20100331_1500_1600"/>
<BusinessType v="A10"/>
<BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<MeasureUnitQuantity v="MAW"/>
<Currency v="EUR"/>
<MeasureUnitPrice v="MWH"/>
<Direction v="A02"/>
<MinimumActivationQuantity v="50"/>
<Status v="A06"/>
<Period>
<TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<Resolution v="PT60M"/>
<Interval>
<Pos v="1"/>
<Qty v="50"/>
<EnergyPrice v="50.45"/>
</Interval>
</Period>
</MolTimeSeries>
<MolTimeSeries>
<ContractIdentification v="RTE_20100331_1500_20"/>
<ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
<AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
<ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
<AuctionIdentification v="AUCTION_20100331_1500_1600"/>
<BusinessType v="A10"/>
<BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<MeasureUnitQuantity v="MAW"/>
<Currency v="EUR"/>
<MeasureUnitPrice v="MWH"/>
<Direction v="A02"/>
<MinimumActivationQuantity v="50"/>
<Status v="A06"/>
<Period>
<TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<Resolution v="PT60M"/>
<Interval>
<Pos v="1"/>
<Qty v="50"/>
<EnergyPrice v="50.48"/>
</Interval>
</Period>
</MolTimeSeries>
<MolTimeSeries>
<ContractIdentification v="NG_20100331_1500_6"/>
<ResourceProvider codingScheme="A01" v="10X1001A1001A515"/>
<AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
<ConnectingArea codingScheme="A01" v="10YGB----------A"/>
<AuctionIdentification v="AUCTION_20100331_1500_1600"/>
<BusinessType v="A10"/>
<BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<MeasureUnitQuantity v="MAW"/>
<Currency v="EUR"/>
<MeasureUnitPrice v="MWH"/>
<Direction v="A01"/>
<MinimumActivationQuantity v="50"/>
<Status v="A06"/>
<Period>
<TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
<Resolution v="PT60M"/>
<Interval>
<Pos v="1"/>
<Qty v="50"/>
<EnergyPrice v="17.0"/>
</Interval>
</Period>
</MolTimeSeries>
</MolDocument>Hi,
The result I got was:
16RTE_20100331_1500_20NG_20100331_1500_6In the query you tried, you access a single record so you can't expect to get three rows "magically". The EXTRACT function just works as expected, it extracts the requested nodes, but the result is still an XML fragment (a scalar value).
In order to achieve your goal, you have to break the MolTimeSeries sequence into relational rows.
Two similar solutions are possible, XMLTable (10gR2 and up) or Table/XMLSequence.
In your other post you mentioned db version 10.1, so I guess we'll go with XMLSequence :
SELECT 'RTE'
,to_date(substr(extractvalue(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),'yyyy-mm-dd"T"hh24:mi')
,decode(extractvalue(x2.column_value,'/MolTimeSeries/Direction/@v'),'A01','Up','Down')
,to_number(regexp_substr(extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v'),'\d+$'))
,to_number(extractvalue(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
,sysdate
,null
,null
,extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v')
,'SUBMITTED'
,'A96'
,null
,sysdate
FROM xml_demo x,
table(
xmlsequence(
extract(x.xml_data, '/MolDocument/MolTimeSeries')
) x2
WHERE existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1;Please also note the use of REGEXP_SUBSTR instead of the regular SUBSTR because it didn't work for "NG_20100331_1500_6".
Hope that helps.
Edited by: odie_63 on 24 juin 2010 21:18 - added regexp comment -
Dynamic hierarchy in parent child hierarchy table??
Do you have any experience to handle the requirement of dynamic hierarchy in universe/webi?
We have some data in parent child hierarchy as below u201CCustomeru201D table.
Customer
Parent Child
Z A
Z B
A AA
B BB
AA AAA
For example, Company Z is the parent company of Company A.
Another table, Amount is the amount value of different Customers.
Amount
ID Amt
AA 10
AAA 1
BB 2
Is there any functionality in Universe designer to build related Classes and objects, So that the web intelligence documents represent the following report with the drilling results?
When we want to see the ID and Amt, the expected result should be:
Z 13
when we drill down Z
the result should be:
A 11
B 2
when we drill down A:
the result should be:
AA 11
notes **
the level of hierarchy is dynamic
Any suggestion is appreciated. Thanks.Hi,
The only way to do it is to create recursive derived table that flatten you parent child hierarchy with a given maximum depth.
Here is a sample I built a long time ago to flatten a parent-child hierarchy on Employees table in Foodmart database (SQL Server).
Didier
SELECT DISTINCT
Z.employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
A.supervisor_id_5,
A.employee_id_5,
A.full_name_5,
A.supervisor_id_6,
A.employee_id_6,
A.full_name_6,
Z.supervisor_id AS supervisor_id_7,
Z.employee_id AS employee_id_7,
Z.full_name AS full_name_7
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
A.supervisor_id_5,
A.employee_id_5,
A.full_name_5,
Z.supervisor_id AS supervisor_id_6,
Z.employee_id AS employee_id_6,
Z.full_name AS full_name_6
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
Z.supervisor_id AS supervisor_id_5,
Z.employee_id AS employee_id_5,
Z.full_name AS full_name_5
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
Z.supervisor_id AS supervisor_id_4,
Z.employee_id AS employee_id_4,
Z.full_name AS full_name_4
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
Z.supervisor_id AS supervisor_id_3,
Z.employee_id AS employee_id_3,
Z.full_name AS full_name_3
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
Z.supervisor_id AS supervisor_id_2,
Z.employee_id AS employee_id_2,
Z.full_name AS full_name_2
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A
WHERE A.employee_id_1 = Z.supervisor_id
) A
WHERE A.employee_id_2 = Z.supervisor_id
) A
WHERE A.employee_id_3 = Z.supervisor_id
) A
WHERE A.employee_id_4 = Z.supervisor_id
) A
WHERE A.employee_id_5 = Z.supervisor_id
) A
WHERE A.employee_id_6 = Z.supervisor_id
UNION
SELECT DISTINCT
A.employee_id_6 AS employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
A.supervisor_id_5,
A.employee_id_5,
A.full_name_5,
A.supervisor_id_6,
A.employee_id_6,
A.full_name_6,
NULL AS supervisor_id_7,
NULL AS employee_id_7,
NULL AS full_name_7
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
A.supervisor_id_5,
A.employee_id_5,
A.full_name_5,
Z.supervisor_id AS supervisor_id_6,
Z.employee_id AS employee_id_6,
Z.full_name AS full_name_6
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
Z.supervisor_id AS supervisor_id_5,
Z.employee_id AS employee_id_5,
Z.full_name AS full_name_5
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
Z.supervisor_id AS supervisor_id_4,
Z.employee_id AS employee_id_4,
Z.full_name AS full_name_4
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
Z.supervisor_id AS supervisor_id_3,
Z.employee_id AS employee_id_3,
Z.full_name AS full_name_3
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
Z.supervisor_id AS supervisor_id_2,
Z.employee_id AS employee_id_2,
Z.full_name AS full_name_2
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A
WHERE A.employee_id_1 = Z.supervisor_id
) A
WHERE A.employee_id_2 = Z.supervisor_id
) A
WHERE A.employee_id_3 = Z.supervisor_id
) A
WHERE A.employee_id_4 = Z.supervisor_id
) A
WHERE A.employee_id_5 = Z.supervisor_id
) A
UNION
SELECT DISTINCT
A.employee_id_5 AS employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
A.supervisor_id_5,
A.employee_id_5,
A.full_name_5,
NULL AS supervisor_id_6,
NULL AS employee_id_6,
NULL AS full_name_6,
NULL AS supervisor_id_7,
NULL AS employee_id_7,
NULL AS full_name_7
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
Z.supervisor_id AS supervisor_id_5,
Z.employee_id AS employee_id_5,
Z.full_name AS full_name_5
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
Z.supervisor_id AS supervisor_id_4,
Z.employee_id AS employee_id_4,
Z.full_name AS full_name_4
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
Z.supervisor_id AS supervisor_id_3,
Z.employee_id AS employee_id_3,
Z.full_name AS full_name_3
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
Z.supervisor_id AS supervisor_id_2,
Z.employee_id AS employee_id_2,
Z.full_name AS full_name_2
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A
WHERE A.employee_id_1 = Z.supervisor_id
) A
WHERE A.employee_id_2 = Z.supervisor_id
) A
WHERE A.employee_id_3 = Z.supervisor_id
) A
WHERE A.employee_id_4 = Z.supervisor_id
) A
UNION
SELECT DISTINCT
A.employee_id_4 AS employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
A.supervisor_id_4,
A.employee_id_4,
A.full_name_4,
NULL AS supervisor_id_5,
NULL AS employee_id_5,
NULL AS full_name_5,
NULL AS supervisor_id_6,
NULL AS employee_id_6,
NULL AS full_name_6,
NULL AS supervisor_id_7,
NULL AS employee_id_7,
NULL AS full_name_7
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
Z.supervisor_id AS supervisor_id_4,
Z.employee_id AS employee_id_4,
Z.full_name AS full_name_4
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
Z.supervisor_id AS supervisor_id_3,
Z.employee_id AS employee_id_3,
Z.full_name AS full_name_3
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
Z.supervisor_id AS supervisor_id_2,
Z.employee_id AS employee_id_2,
Z.full_name AS full_name_2
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A
WHERE A.employee_id_1 = Z.supervisor_id
) A
WHERE A.employee_id_2 = Z.supervisor_id
) A
WHERE A.employee_id_3 = Z.supervisor_id
) A
UNION
SELECT DISTINCT
A.employee_id_3 AS employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
A.supervisor_id_3,
A.employee_id_3,
A.full_name_3,
NULL AS supervisor_id_4,
NULL AS employee_id_4,
NULL AS full_name_4,
NULL AS supervisor_id_5,
NULL AS employee_id_5,
NULL AS full_name_5,
NULL AS supervisor_id_6,
NULL AS employee_id_6,
NULL AS full_name_6,
NULL AS supervisor_id_7,
NULL AS employee_id_7,
NULL AS full_name_7
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
Z.supervisor_id AS supervisor_id_3,
Z.employee_id AS employee_id_3,
Z.full_name AS full_name_3
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
Z.supervisor_id AS supervisor_id_2,
Z.employee_id AS employee_id_2,
Z.full_name AS full_name_2
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A
WHERE A.employee_id_1 = Z.supervisor_id
) A
WHERE A.employee_id_2 = Z.supervisor_id
) A
UNION
SELECT DISTINCT
A.employee_id_2 AS employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
A.supervisor_id_2,
A.employee_id_2,
A.full_name_2,
NULL AS supervisor_id_3,
NULL AS employee_id_3,
NULL AS full_name_3,
NULL AS supervisor_id_4,
NULL AS employee_id_4,
NULL AS full_name_4,
NULL AS supervisor_id_5,
NULL AS employee_id_5,
NULL AS full_name_5,
NULL AS supervisor_id_6,
NULL AS employee_id_6,
NULL AS full_name_6,
NULL AS supervisor_id_7,
NULL AS employee_id_7,
NULL AS full_name_7
FROM employee Z,
SELECT DISTINCT
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
Z.supervisor_id AS supervisor_id_2,
Z.employee_id AS employee_id_2,
Z.full_name AS full_name_2
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A
WHERE A.employee_id_1 = Z.supervisor_id
) A
UNION
SELECT DISTINCT
A.employee_id_1 AS employee_id,
A.supervisor_id_1,
A.employee_id_1,
A.full_name_1,
NULL AS supervisor_id_2,
NULL AS employee_id_2,
NULL AS full_name_2,
NULL AS supervisor_id_3,
NULL AS employee_id_3,
NULL AS full_name_3,
NULL AS supervisor_id_4,
NULL AS employee_id_4,
NULL AS full_name_4,
NULL AS supervisor_id_5,
NULL AS employee_id_5,
NULL AS full_name_5,
NULL AS supervisor_id_6,
NULL AS employee_id_6,
NULL AS full_name_6,
NULL AS supervisor_id_7,
NULL AS employee_id_7,
NULL AS full_name_7
FROM employee Z,
SELECT DISTINCT
supervisor_id AS supervisor_id_1,
employee_id AS employee_id_1,
full_name AS full_name_1
FROM employee
WHERE supervisor_id = 0 OR supervisor_id IS NULL
) A -
Getting parent-child data from a single column in a table
Hi,
I have a parent-child data in a column.
Eg:
0
00
01
010
011
1
10
11
These values are present in the single column itself. My need is to get the parent values for the given child value.
For eg: If I am giving the input as 011, the query should return all its parents, i.e. 01 and 0
Could you please give me any inputs on this?
Thanks,
GVFrank Kulash wrote:
Assuming that each child's id is formed by adding exactly one character to the end of its parent's id:
SELECT id
FROM table_x
START WITH id = :target_id
CONNECT BY PRIOR id LIKE id || '_';
Small tweak to yours Frank if it's just the parents that need identifying...
SQL> ed
Wrote file afiedt.buf
1 with t as (select '0' as x from dual union all
2 select '00' from dual union all
3 select '01' from dual union all
4 select '010' from dual union all
5 select '011' from dual union all
6 select '1' from dual union all
7 select '10' from dual union all
8 select '11' from dual)
9 -- end of test data
10 SELECT x
11 FROM t, (select '&required' as req from dual) req
12 WHERE x != req.req
13 START WITH x = req.req
14* CONNECT BY PRIOR x LIKE x || '_'
SQL> /
Enter value for required: 011
old 11: FROM t, (select '&required' as req from dual) req
new 11: FROM t, (select '011' as req from dual) req
X
01
0
SQL> /
Enter value for required: 11
old 11: FROM t, (select '&required' as req from dual) req
new 11: FROM t, (select '11' as req from dual) req
X
1
SQL> -
How to filter parent & child rows from tables while export usingData export
Hi,
I have a requirement of export schema. Assume there is a account details table and account transactions table under schema.They have parent child relation exist. if i filter accounts from account details the corresponding transactions in account transactions table should be filterd.How to achieve this?
Regards,
Venkat Vadlamudi
Mobile:9850499800Not sure if this is a SQL and PL/SQL question or whether it's an Oracle Apps type question or a Database General.
Whatever, you've posted in the wrong forum (http://forums.oracle.com/forums/ann.jspa?annID=599)
You should post in a more appropriate forum e.g.
PL/SQL
General Database Discussions
etc.
locking this thread -
Parent/child records from same table
I want to create a query that is a union such that the 2nd resultset is based on the 1st resultset. I have a table that has parent/child records in the same table.
Table: EVENTS
EVENT_ID
PARENT_EVENT_ID
CREATED_DATE
(other columns)
if PARENT_EVENT_ID is null then it is a parent record, else it is a child record. I want to select all parent records then union them with all the associated child records...something like this:
select * from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null -- All parents
union
select * from EVENTS where PARENT_EVENT_ID in (select EVENT_ID from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null) -- include any children of parents selected from above
This works but it's kind of ugly, I want to avoid using the sub-select in the 2nd because it is a repeat of the 1st statement, is there a way to alias the first statement and just refer to it in the 2nd query?Hi,
kev374 wrote:
Thanks, one question...
I did a test and it seems the child rows have to also satisfy the parent row's where clause, take this example:
EVENT_ID|PARENT_EVENT_ID|CREATED_DATE
2438 | (null) | April 9 2013
2439 | 2438 | April 11 2013
2440 | 2438 | April 11 2013
select * from EVENTS where CREATED_DATE < sysdate - 9
start with EVENT_ID = 2438
connect by PARENT_EVENT_ID = prior EVENT_IDSo you've changed the condition about only wanting roots and their children, and now you want descendants at all levels.
This pulls in record #2438 (per the sysdate - 9 condition) but 2439 and 2440 are not connected. Is there a way to supress the where clause evaluation for the child records? I just want to pull ALL child records associated with the parent and only want to do the date check on the parent.Since the roots (the only rows you want to exclude) have LEVEL=1, you can get the results you requested like this:
WHERE created_date < SYSDATE - 9
OR LEVEL > 1However, since you're not ruling out the grandchildren and great-grandchildren any more, why wouldn't you just say:
SELECT *
FROM events
WHERE created_date < SYSDATE - 9
OR parent_event_id IS NOT NULL;?
CONNECT BY is slow. Don't use it if you don't need it.
If you x-reference my original query:
select * from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null -- All parents
union
select * from EVENTS where PARENT_EVENT_ID in (select EVENT_ID from EVENTS where CREATED_DATE < sysdate - 90 and PARENT_EVENT_ID is null) -- include any children of parents selected from above
The 2nd select does not apply the created_date < sysdate - 90 on the children but rather pulls in all related children :)Sorry; my mistake. That's what happens when you don't post sample data, and desired results; people can't test their solutions and find mistakes like that. -
Send the output/response in CDATA format from OSB
Hi,
I want to send the output in CDATA format from OSB as below.
<DataSet><![CDATA[<Data>
<QueryRes>
<tagA>anil kumar</tagA>
<tagB>Telesales Lead</tagB>
</QueryRes>
</Data>]]></DataSet>
Request your help to acieve the same.Hi,
I want to send the output in CDATA format from OSB as below.
<DataSet><![CDATA[<Data>
<QueryRes>
<tagA>anil kumar</tagA>
<tagB>Telesales Lead</tagB>
</QueryRes>
</Data>]]></DataSet>
Request your help to acieve the same. -
How to extract the hierarchy(in the levels) into BW
Thanks in advance.
Edited by: S MB on May 6, 2009 11:13 AM
Edited by: S MB on May 6, 2009 11:14 AMhi,
You can create the mapping between the hierarchy datasource in BW to the masterdata object.And then creation of infopackeage and extract the data.
While creating the transfer rules, mapping is to be done to Header and Node i.e, on the top of communication structure you get an option 'Segment' which has dropdown Header/Node. You can map the objects and load the data.
Let me know if you are expecting the same or any further details.
Regards,
Geetha. -
Can I delete the hierarchy groups and reload again from R/3
Hello all,
I am having some issue in my reports because of the hierarchy groups. Can i just delete the entire hierarcgy groups from "production" and reload again from R/3 will that cause any issue?
Thanks in advanceHi,
I think u can delete the Master Data Hierarchies. I dont see any issue in the production .
Rgds,
Ravi. -
Extract the name of a digital ID from a smart card and place in a field
In DoD we use Smart Cards, commonly called 'Common Access Card (CAC)', I am wondering if it's possible to extract the name of the user from their CAC, or at least be able to extract the name from a .FDF file. If you go to 'Sign & Certify' from Acrobat 10.x, and then go to 'More Sign & Certify', then click on 'Security Settings', again, this only applies if you have either a Smart Card or digital ID, you will see the security settings menu. Within this menu, you will see the option to 'Export' the file to either an email or save the data to a file. When you click next, you have the option to save as and .fdf file or .p7c file. Is it possible to create a button or a digital signature that will allow me to export the name of the user to a field?
Hi bsabourin1962,
It can be done by creating a button with a script to extract the name of the user.
Maybe you are looking for
-
Discosing a specific Tab clears combobox values
Hi All, Still in trouble with tabbed panes. I have the following situation (JDev 11.1.1.1.0 + ADF): Two tabs (Default Tab and Item Tab), user may select (or add) something in Default tab and it can have many "items", in the item Tab I can navigate to
-
How to make optical connectivity between Catalyst 4948 and 10K router ?
Hi, I am Ratheesh P D, network Manager of one project in Motorola. We have one catalyst 4948. Its going to get one 10K router. Our requirement needs optical connection between these two. The document of 4948 says, its compatible with 1000BaseX SFP an
-
When starting oem Agent ir error out with java.lang.NoClassDefFoundError: o
Hi , Facing below error when starting oem agent with comand
-
Dvt:map, JSR-168 portlets, and WebCenter Spaces
Please click here [http://fusion.appshosting.com:8788/coxcustomportlets/faces/callcenterportlet.jspx] When I attempt to view this portlet in WebCenter Spaces, the map will not render. The rest of the portlet renders fine. The connections.xml file is
-
I can't get three songs onto my 2nd gen shuffle
I can't get 3 songs onto my 2nd generation Shuffle (bought 1 week ago). I can get anything else on with no trouble, just drag and drop, but these 3 songs I can't get on, I drag them over the "iPod" icon and they don't do anything, they just sit there