How to use GL Parent Child relationships in Discoverer?
Subject: How to used GL Parent Child relationships in Discoverer?
How to use GL Parent Child relationships in Discoverer?
Please let me know how to incorporate the parent -child relation ships exsiting in GL Accouting flexfield Segments in Discoverer for drill downs? we have GL - BIS views installed.
How to create the specific Parent -child relationship hierarchies in Discoverer from the FND_* tables?
Please help.
Thanks.
KS.
Hi,
I'm also trying to implement this. If you have come any further in solving this any hints would be much appreciated...
regards,
AJ
Similar Messages
-
How do I identify parent/child relationship
How do I identify parent/child relationship in Designer?
turn your object into a symbol, and place multiple instances of it on the artboard, when you edit the symbol all instances will update.
-
Function to get the path using a parent-child relationship
Hello,
I have a table which uses parent-child relationship to store the options available. I need a function to give me the full path given the id of a particular option.
I have two different functions. One of them uses the Oracle built in function and the other uses simple queries with a loop.The code of the functions are given below.
Now, the problem is with their "performance". The difference in their performance is significant. The function using the Oracle function takes more than 2 hours to run a query whereas the other function takes less than 2 minutes.
I am having trouble trusting the other function. No matter how many tests I perform on the output of both the functions, it always comes out to be the same.
Any thoughts to help me understand this ??
Function 1
=====================
FUNCTION Gettree (opt_id IN NUMBER,i_app_id IN NUMBER)
RETURN VARCHAR2
IS
path VARCHAR2(32767);
application_no NUMBER;
BEGIN
SELECT ABC.APP_OPT_ID INTO application_no FROM ABC
WHERE ABC.APP_ID = i_app_id AND ABC.PARENT_ID IS NULL;
SELECT LPAD(' ', 2*LEVEL-1)||SYS_CONNECT_BY_PATH(app_opt_name, '=>') "Path" INTO path
FROM ABC
WHERE app_opt_id = opt_id
START WITH parent_id =application_no
CONNECT BY PRIOR app_opt_id =parent_id;
path := SUBSTR(path,INSTR(path,'>')+1,LENGTH(path));
RETURN path;
END Gettree ;
Function 2
======================
FUNCTION GetOptPath(opt_id NUMBER,app_id NUMBER)
RETURN VARCHAR2
IS
string VARCHAR2(900);
opt VARCHAR2(100);
pid NUMBER(38);
BEGIN
SELECT ABC.parent_id,ABC.app_opt_name INTO pid,string FROM ABC WHERE ABC.app_opt_id = opt_id;
IF pid IS NULL
THEN
RETURN 'root';
ELSIF pid IS NOT NULL
THEN
LOOP
SELECT ABC.app_opt_name,ABC.parent_id INTO opt, pid FROM ABC WHERE ABC.app_opt_id = pid;
EXIT WHEN pid IS NULL;
string := opt || '=>'|| string;
END LOOP;
RETURN string;
END IF;
END;Hi,
user8653480 wrote:
Hello Frank,
The parameters taken by gettree & getoptpath are app_opt_id and app_id and both the functions return only one string i.e. the path of that particular option (app_opt_id) starting from its root and not all the descendants of that option/root node of that option.
So, does that mean that gettree first fetches all the descendants of the root node of the given option and then returns the required one ??Yes. It's a little like the situation where you need to meet with your co-worker Amy, so you send an e-mail to everyone in the department telling them to come to your office, and then, when they arrive, tell everyone except Amy that they can leave.
>
And if that is the case, then won't it be better to use the bottom-up approach to fetch the required path just for that particular option ?? 'coz my requirement is that only.. given an option_id get the full path starting from the root.Exactly!
I have used explain plan also for both the functions.. but since I did not know how to anlayze the output from plan_table so I just compared the value in the fields and they were exactly the same for both the queries.If you'd like help analyzing the plans, post them, as Centinul said.
I am attaching a sample data with the outputs of both the functions for the reference.
(tried attaching the file but could not find the option, so pasting the data here)
App_opt_ID App_ID Parent_ID App_opt_name "gettree(app_opt_id,app_id)" "getoptpath(app_opt_id,app_id)"
1 1 NULL application NULL root
2 1 1 module1 module1 module1
3 1 1 module2 module2 module2
4 1 2 submod1 module1=>submod1 module1=>submod1
5 1 3 submod1 module2=>submod1 module2=>submod1
6 1 5 opt1 module2=>submod1=>opt1 module2=>submod1=>opt1
7 2 NULL app2 NULL root
8 2 7 scr1 scr1 scr1
9 2 8 opt1 scr1=>opt1 scr1=>opt1
10 2 7 scr2 scr2 scr2Please help.The best solution is to do a bottom-up query, and write a function like reverse_path (described in my first message) to manipulate the string returned by SYS_CONNECT_BY_PATH. You seem to have all the PL/SQL skills needed for this.
Another approach is a revised form of gettree, like I posted earlier. Does it do what you want or not?
If you'd help, then post a little sample data in a form people can actually use, such as CREATE TABLE and INSERT statements. Post a few sets of parameters, and the results you need from each set, given the sample data posted. -
How to Get the Parent - Child Relationship
Hi ,
In my application having 100 tables with parent - child releation ship without using casecade constraints
i want to delete the parent with child and sub child records
Example
Table - 1
parent1
child 2
Table - 2
Child 1 - Parent 1
Parent 2
Table - 3
Child 1 - Parent 2
Parent 3
Table - 4
Child 1 - Parent 3
How to delete the parent table ? Is it any scripts available ?
Regards
Sudhakar P.Hi,
1) Firstly identify the parent tables using
SELECT a.table_name, 0
FROM user_tables a, user_tab_columns b
WHERE a.table_name = b.table_name
store these in one table say ID_table
2) Identify dependent tables and sore in table say table_dependency using
SELECT LEVEL, parenttable, parentcol, childtable, childcol
FROM (SELECT UNIQUE parenttable, parentcol, childtable,
b.column_name childcol
FROM (SELECT p.table_name parenttable,
k.column_name parentcol,
k.POSITION pos,
c.table_name childtable,
c.constraint_name CONSTRAINT
FROM all_constraints p,
all_constraints c,
all_cons_columns k
WHERE p.constraint_name =
c.r_constraint_name
AND c.r_constraint_name =
k.constraint_name
AND p.constraint_type IN ('P', 'U')
AND c.constraint_type = 'R'
AND p.table_name != c.table_name
ORDER BY p.table_name,
c.constraint_name,
k.POSITION) a,
all_cons_columns b
WHERE a.CONSTRAINT = b.constraint_name
AND a.pos = b.POSITION)
3)Now using these details find tables without cascade rule as below
SELECT *
FROM table_dependency
WHERE child_table IN (
SELECT DISTINCT table_name
FROM user_constraints
WHERE constraint_type = 'R'
AND delete_rule <> 'CASCADE'
AND table_name IN (SELECT child_table
FROM table_dependency)
AND r_constraint_name IN (
SELECT constraint_name
FROM user_constraints
WHERE table_name IN (
SELECT table_name
FROM id_table
UNION
SELECT child_table
FROM table_dependency))
AND table_name NOT IN (
SELECT table_name
FROM id_table)); -
How to view a parent-child relationship on the Command line (cmd)
Hi
I'm a newbie. I'm trying to insert some values using a small application into an oracle db table and I got this message:
"java.sql.SQLException: ORA-02291: integrity constraint (DATA.SYS_C002764) violated - parent key"
From my point of view(thinking) I'm trying to insert data into a child table which references a parent table.
My Q is how can I see which table(s) are involve here per command line? What type of querry if any can I give onto the cmd line to see the relationships of tables which references each other? I'll really much appreciate your respond. Thanks in advance!Hi,
Go to application navigator, model node by clicking on the entity, in the structure panel you'll see the list of defined constraints.
But you better give relevant names to your database constraints. I create them at the database level, example
for a primary key of table emp: DEPT_PK, foreign key in child table dept: DEPT_EMP_FK
When you create the entity in jdev, the ide will use those names and it will be easier to identify them.
Regards
Frederic -
I have multiple instances of an object, and I would like to make any changes that I put on one of these objects to perpetuate and change on the other instances of the object
turn your object into a symbol, and place multiple instances of it on the artboard, when you edit the symbol all instances will update.
-
How to output the outline parent-child relationship using a report script?
I'd like to extract the outline's dimension members with it's parent-child relationship using a report script. Anybody can provide a sample script? Thanks.
Example:
DimensionX
-----MemberX
----------ChildX
Output:
Dimension X MemberX
MemberX ChildX
Edited by: obelisk on Jan 11, 2010 5:16 PMSorry a report script won't do it. You have two options
1. Use at Essbase Outline API to walk the outline and get it for you
2. Use the Outline extractor available from Applied Olap (it is a free download). It can be run interactively of as a bat file.
Frankly, I would rather use 2 since I don't have to code it myself -
Implement Parent child Relationship using SSIS
Could you please suggest the best way which should not impact the performance of data loading, to implement parent child relationship using SSIS.
We have a flat file RECON80.dat which need to be loaded into the database into 2 tables.
Parent Table JobMaster and Child Table RECON80 .
In the flat file we have a fields Jobphase which will get inserted in JobMaster table and the remaning details like EIN, DATE etc will get inserted in RECON80 table.
The Parent table JobMaster has JobId as an identity column which is the Pk of the table and it will get inserted into the child table i.e RECON80 JobId as FK of the child tale.
Please suggest the best possible way to achieve it.Hi SubhadipRoy, I think you might need to create a procedure for this task.
Because in SSIS, we cannot directly get the Identity ID.
As my experience, there were serveral ways to do. But all are workaround.
So, My suggestion is.
In SSIS:
1. Create a DataFlow
2. Drag a flat source and load the data from dat file
3. Create a procedure which receive the parameter from your data of each row.
4. Drag a OLEDBCommand to the Panel and Invoke the Procedure also don't forget to pass all your rows to the Procedure in OLEDBCommand control.
5. In Procedure, after insert 1 row you could get the Identity ID throuth SCOPE_IDENTITY()
That's it, hope it works for you even this may not the efficency way.
Althrough, I expect someone can give the best way if there is. -
How to model parent child relationship with DPL? @Transient?
Hello All,
I want to model a parent entity object with a collection of child entities:
@Entity
public class Parent{
@PrimaryKey
String uuid;
List<Child> children;
@Entity
public class Child{
@PrimaryKey
String id;
I know that the DPL won't support automatic persistence where it'll recursively go through my parent bean and persist my children with one call. Is there a way of applying the equivalent to JPA's @Transient annotation on "children" so I can persist the children manually and have the engine ignore the collection?
If not and I want to return to the user a Parent with a List named "children," do I have to create a new object which is identical to Parent, but doesn't have the BDB annotations and manually assemble everything? If possible, I'd like to avoid defining redundant objects.
Thanks in advance,
Steven
Harvard Children's Hospital Informatics Program
Edited by: JavaGeek_Boston on Oct 29, 2008 2:22 PMHi Steven,
The definition of persistence is here:
http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/Entity.html
And includes this: "All non-transient instance fields of an entity class, as well as its superclasses and subclasses, are persistent. static and transient fields are not persistent."
So you can use the Java transient keyword. If that isn't practical because you're using transient in a different way for Java serialization, see the JE @NotPersistent annotation.
In general a parent-child relationship between entities is implemented almost as you've described, but with a parentId secondary key in the Child to index all children by their parent. This enables a fast lookup of children by their parent ID.
I suggest looking at this javadoc:
http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/SecondaryIndex.html
as it describes all types of entity relationships and the trade-offs involved. The department-employee relationship in these examples is a parent-child relationship.
--mark -
How to create Parent Child relationship of Assets
Hi All
can any one provide the solution for the below mention requirment.
Problem Description: How to create Parent Child relationship of Assets in below case.
1. If asset Category of Child assets are different but both parent & child assets are already capitalized.
2. If asset Category of Child assets are same but both parent & child assets are already capitalized.
3. If asset Category of Child assets are same for new assets.Hi All
can any one provide the solution for the below mention requirment.
Problem Description: How to create Parent Child relationship of Assets in below case.
1. If asset Category of Child assets are different but both parent & child assets are already capitalized.
2. If asset Category of Child assets are same but both parent & child assets are already capitalized.
3. If asset Category of Child assets are same for new assets. -
Help needed in retrieving parent child relationship values
Hi,
I have a requirement to get parent child relationship values as below.
Ex: Address table
cont cont_code state state_code
C1 10 S1 1
C1 10 S2 2
C1 10 S3 3
C2 20 S4 4
C2 20 S5 5
C3 30 S6 6
C3 30 S7 7
C3 30 S8 8
I want a result of country/state and corresponding code like below.
corresponding states should be displayed under each country with some space appended to it.
Geography code
C1 10
S1 1
S2 2
S3 3
C2 20
S4 4
S5 5
C3 30
S6 6
S7 7
S8 8
I am using oracle 10g version.
Thanks in advance.Hi,
When you post formatted text (like your output) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
I think you're saying that you want this output:GEOGRAPHY CODE
C1 10
S1 1
S2 2
S3 3
C2 20
S4 4
S5 5
C3 30
S6 6
S7 7
S8 8
If so, UNION, as Hoek suggested, is a good way.
GROUP BY ROLLUP is more efficient, but harder to understand:SELECT CASE
WHEN GROUPING (state) = 1
THEN cont
ELSE ' ' || state
END AS geography
, CASE
WHEN GROUPING (state) = 1
THEN MAX (cont_code)
ELSE MAX (state_code)
END AS code
FROM t
GROUP BY cont
, ROLLUP (state)
ORDER BY cont
, state NULLS FIRST
By the way, this looks like a bad table design.
In a relational database, the fact that the name 'C1' belongs to cont_code 10 should only be stored in one place. You have the same information on 3 separate rows.
Also, if 'C1' and 'S1' are both names, they should probably be in the same column, so that (to give just one example) you can find the information about 'x1' without knowing if it is a cont or a state.
A better design would be.NAME CODE PARENT DSCR
==== ==== ====== ====
C1 10 CONT
S1 1 10 STATE
S2 2 10 STATE
S3 3 10 STATE
C2 20 CONT
S4 4 20 STATE
S5 5 20 STATE
C3 30 CONT
S6 6 30 STATE
S7 7 30 STATE
S8 8 30 STATE
If the data is this simple, then the dscr column isn't needed. Whether parent is NULL or not tells whether the rows represents a cont or a state.
To get the results you want from a table like this, you could use CONNECT BY. Using either UNION or ROLLUP, you have to know, at the time you write the query, how many levels there will be in the parent-child tree, and the length of the code is proportional to that depth, and the table has to be changed if you ever need to add another level. CONNECT BY can handle any number of levels, and the length and complexity of the code is the same whether you have just 2 levels (countries and strates), or 7 levels (continents, regions, countiries, states, districts, cities and neighborhoods) or 72 levels. The table doesn't need any more columns, no matter how deep the tree gets.
Edited by: Frank Kulash on Sep 16, 2010 11:54 AM -
Parent-Child Relationship between app
Hi,
I am trying to deploy 2 applications, which needs to have a parent-child relationship between them.
One option is i should driectly change server.xml, and put parent tag in this Xml file and restart the container.
Another option is i can use my Ant Target to invoke command line argument which uses admin.jar and which has parent attribute... so when i give the command to put parent-child relationship, the container gives the message that app2 has parent app1 but actually it doesnt put the required tag in server.xml and nor does it put the relationship in place.
So any workaround for this... how can i put that relationship in place without modifying server.xml.
We are running 9ias 9.0.2.3 on True64
Thanks in advanceHi,
Has anyone done sumthing like this before... even after trying everything i am still not able to do parent- child relationship between applications.
Thanks & Regards -
Question about File Content Conversion and parent-child relationships...
Hello!
I have read probably every blog, article and SAP Help document on the topic, but I am stuck on this one. I am trying to convert a General Ledger flat file to an IDoc using the classic file --> IDoc scenario. The setup is done and working, but the IDocs are formatted incorrectly and I believe at least part of the reason is how I am converting the file content.
The root of my problem is that the flat file has a parent-child relationship between the document header and the document item and I want to maintain that since the IDoc type (FIDCCP01) has the same structure in the BKPF and BSEG segments.
Here is the flat (non-XML) file layout that is coming into the file adapter:
FileHeader
DocumentHeader
DocumentItem
DocumentHeader
DocumentItem
and so on (until the number of documents is complete
I would really like the content to be converted so that the line items stay under their parent document headers like this:
<FileHeader></FileHeader>
<DocumentHeader>
<ItemHeader>
</ItemHeader>
</DocumentHeader>
<DocumentHeader>
<ItemHeader>
</ItemHeader>
</DocumentHeader>
But I keep getting this, where it lists the document headers first (one after another), and then all of the line items after the document headers like this:
<FileHeader></FileHeader>
<DocumentHeader></DocumentHeader>
<DocumentHeader></DocumentHeader>
<DocumentHeader></DocumentHeader>
<ItemHeader></ItemHeader>
Is is possible to maintain that parent-child relationship from the flat file and pass it over to the XML?
Thanks,
JohnHi,
Check some links on FCC.
/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
/people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
/people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Regards,
Phani
Reward points if Helpful -
Re: Circular Parent-Child relationship amongwidgets.
Alaiah,
Setting the parent to NIL is the proper thing to do to remove
a widget from a panel. Why don't you try just setting it
to NIL and not adding the new chart to the window to make
sure that it gets removed. If that doesn't work, maybe
Window.UpdateDisplay, but you shouldn't have to do that.
As far as the parent-child relationship issue, when you set
the widget's Parent to NIL, that is actually invoking a virtual
attribute that does more than just NIL out the reference. One
of the things that happens is that the child is removed from
the parent's Children array. Do a task.lgr.putline(<parent>.Children.Items)
to see how many items are in the array, then do the NIL, then
do a second putline and you'll see the array has one less item.
Bobby
At 06:10 PM 12/19/96 PST, Chandrashekar, Alaiah wrote:
>
I am trying to draw a Bar Graph on a panel which in turn sits on the main
window. The height policy of the panel widget is set to SP_TO_PARENT so that
when the window is resized the panel is also resized according to the parent
window. I have a situation that every time the panel is resized I need to
scale the Bar Graph in accordance with the new panel size and draw it. But
before drawing the newly scaled Bar Graph I am clearing out all the children
of the panel ( I am doing this just to refresh the panel) and then drawing
the newly scaled Bar Graph. But this does not work!!! I still find some
left over from the previous Bar Graph!!! Any help in this matter is greatly
appreciated.
Also I don't understand this circular parent-child relationship. If I assign
a NIL to Parent attribute of all the children of the panel, what will happen
to the Children attribute of the panel? Won't there be any memory leak by
adopting the above procedure of disconnecting a child from its parent? If
so, how do we take care of it?
Thanks in advance!
Alaiah Chandrashekar
The following is the segment of the code which could be useful for clarity:
// Draws the Bar Graph for the first time.
self.ShowChart(TestData);
self.Open();
event loop
when task.Shutdown do
exit;
// When the window is resized
// I am scaling the Bar Graph for the new
// panel size.
when self.window.AfterReSize do
self.ClearChartPanel();
// self.window.UpdateDisplay();
self.ShowChart(TestData);
end event;
self.Close();
Method ClearChartPanel is as follows:
for child in self.<ChartPanel>.Children do
child.Parent = NIL;
end for;Alaiah,
Setting the parent to NIL is the proper thing to do to remove
a widget from a panel. Why don't you try just setting it
to NIL and not adding the new chart to the window to make
sure that it gets removed. If that doesn't work, maybe
Window.UpdateDisplay, but you shouldn't have to do that.
As far as the parent-child relationship issue, when you set
the widget's Parent to NIL, that is actually invoking a virtual
attribute that does more than just NIL out the reference. One
of the things that happens is that the child is removed from
the parent's Children array. Do a task.lgr.putline(<parent>.Children.Items)
to see how many items are in the array, then do the NIL, then
do a second putline and you'll see the array has one less item.
Bobby
At 06:10 PM 12/19/96 PST, Chandrashekar, Alaiah wrote:
>
I am trying to draw a Bar Graph on a panel which in turn sits on the main
window. The height policy of the panel widget is set to SP_TO_PARENT so that
when the window is resized the panel is also resized according to the parent
window. I have a situation that every time the panel is resized I need to
scale the Bar Graph in accordance with the new panel size and draw it. But
before drawing the newly scaled Bar Graph I am clearing out all the children
of the panel ( I am doing this just to refresh the panel) and then drawing
the newly scaled Bar Graph. But this does not work!!! I still find some
left over from the previous Bar Graph!!! Any help in this matter is greatly
appreciated.
Also I don't understand this circular parent-child relationship. If I assign
a NIL to Parent attribute of all the children of the panel, what will happen
to the Children attribute of the panel? Won't there be any memory leak by
adopting the above procedure of disconnecting a child from its parent? If
so, how do we take care of it?
Thanks in advance!
Alaiah Chandrashekar
The following is the segment of the code which could be useful for clarity:
// Draws the Bar Graph for the first time.
self.ShowChart(TestData);
self.Open();
event loop
when task.Shutdown do
exit;
// When the window is resized
// I am scaling the Bar Graph for the new
// panel size.
when self.window.AfterReSize do
self.ClearChartPanel();
// self.window.UpdateDisplay();
self.ShowChart(TestData);
end event;
self.Close();
Method ClearChartPanel is as follows:
for child in self.<ChartPanel>.Children do
child.Parent = NIL;
end for; -
Find parent/child relationships At More Than 2 Levels
Hello,
Does anyone have a solution to find parent/child relationship for data more than 2 levels deep?
I have a solution when there's a simple parent-child relationship but not when there's a grandparent-parent-child relationship or deeper.
Ex. I have a table company_parent_child that stores the relationship betwen a company and it's direct parent.
create table TEMP_COMPANY_PARENT_CHILD
PARENT_ID NUMBER(10),
COMPANY_ID NUMBER(10)
insert into TEMP_COMPANY_PARENT_CHILD values (1, 10);
insert into TEMP_COMPANY_PARENT_CHILD values (1, 11);
insert into TEMP_COMPANY_PARENT_CHILD values (1, 12);
insert into TEMP_COMPANY_PARENT_CHILD values (2, 13);
insert into TEMP_COMPANY_PARENT_CHILD values (10, 100);
insert into TEMP_COMPANY_PARENT_CHILD values (10, 101);
insert into TEMP_COMPANY_PARENT_CHILD values (10, 102);
insert into TEMP_COMPANY_PARENT_CHILD values (11, 103);
1->
___10->
______100,101,102,
___11->103
Companies 100, 101 and 102 are under parent 10 and grandparent 1.
I need to create such a view or another temp table so that when I pass the parent ID, I will pull all the children on all levels. In addition, and this is the tricky part, when I join this new temp table or view to another data table without any parameters, the data should not be duplicate, ie. each company ID should appear only once.
create table TEMP_JOIN
company_id number(10),
order_id varchar2(10)
insert into TEMP_JOIN values (100, 'a');
insert into TEMP_JOIN values (101, 'b');
insert into TEMP_JOIN values (102, 'c');
insert into TEMP_JOIN values (103, 'd');
insert into TEMP_JOIN values (10, 'e');
insert into TEMP_JOIN values (11, 'f');
insert into TEMP_JOIN values (12, 'e');
insert into TEMP_JOIN values (13, 'f');
Thanks.start by learning CONNECT BY/START WITH. once you've
written a query to read the grandparent-parent-child
relationship, then come back with more questionsYes. we did look heavily into connect by/start with, in fact along with "connect_by_iscycle","connect_by_isleaf","connect_by_root" as well.
Our dilemma is that when a joint is made between those two tables mentioned above TEMP_COMPANY_PARENT_CHILD and TEMP_JOIN, we are not able to create a view that would contain distinct company_ids, each mapped to a unique order id.
The problem is we cannot have this type of joint when there are "n" level relationship between companies (or company_id). Basically, I think we should have our unique order id mapped to a unique key. This unique key should be a specialized key that we can know at anytime the entire path of the ancestry which we can know by sys_connect_by_path(company_id,'/') path.
How do we know which path to take. The best bet is to "connect_by_isleaf" and just have the distinct "deep" path which form the specialized unique key. If you need help on this let me know. (A hint, sort by LEVEL and then do a rank after partitioning by company id and then filter the records by rank = 1, try this one!!!)
So, we will eventually have a joint (say Table X) like
PATH ORDER_ID
/1/10/100 a
/1/10/101 b
/1/10/102 c
/1/10 e
/1
/1/11/103 d
/1/11 f
I think this is the best view we can have to maintain a joint with no repetition along PATH as well as ORDER_ID. If you have any other thoughts, let me know.
Then you query by path using INSTR to pull records by company_id.
for example, if you want to get all the children for company_id "10" you would just say
select * from X where INSTR(PATH,10,1,1) <> 0
or if you want to get all the children for company_id "11" you would just say
select * from X where INSTR(PATH,11,1,1) <> 0
What do you think? Has anyone used the path information for traversing the tree? Or is there any article that tells us how to make effective use of sys_connect_by_path(company_id,'/') path.
Thank you. Hope it made sense!
Maybe you are looking for
-
Lightroom 4 crashes when trying to open the slideshow module. I spent over three hours with both Adobe and Apple tech support and we know it is a permission issue but have not been able to get it solved. It started with the last upgrade to 10.8
-
Itunes for windows 8 cant get and icon
I have downloaded iTunes about 6 times. using run and save and I cant seen to get it to work on my PC. Any ideas.
-
Hi, we are using BPC 7.5 and we are trying to run a legal consolidation (SPRUNCONSO). The error we get is CSD-120: No Entity - Method available I have searched the forum for this error and found references to the ownership application. We do have one
-
Hi I am using catalyst 4507 R-E I did the password recovery and then when I reloaded the below info appears in the rommom mode please help as how can solve this problem I have reloaded several times but its the same * Welcome to Rom Monitor for
-
ViewCriteria doesn't work with SQL92SQLBuilderImpl
Hi, I use JDeveloper 11.1.1.1.0 and Informix 11.5 I have custom Sql builder class: public class InformixSQLBuilder extends SQL92SQLBuilderImpl{ @Override protected boolean getSupportsAliasInUpdateStatements() { return false; @Over