Several foreign key joins between two tables
HelloI have a question about the creation of a repository.
I have a date and a fact dimension. The fact table has about 10 columns in foreign key to the date Dimension.
In this case I should create 10 aliases to create joins in the physical layer and MDB or y at - it another way to handle this situation.
I ask this question because 10 aliases can get very confusing for me at the later stage of time when creating reports.
With the help of OBIEE 10.1.3
If you want to see in the industry as
End date, start date, date etc. nearby
you need to create 10 aliases for this purpose in the physical layer, make them drag in MDB and model, and then drag to the area of topic
Score pls correct/good
Tags: Business Intelligence
Similar Questions
-
Left join between two tables using two different conditions
I have following three tables with their data, as shown below.
CREATE TABLE TIREMASTERPROCESS_TEMP
(
PRODUCTIONCODE TANK (12 BYTES),
FIELDNAME CHAR (12 BYTES),
DATACHR VARCHAR2 (60 BYTE),
REVISIONNO TANK (3 BYTES),
DATANUM NUMBER (9.4)
)
Whether the table c. and its sample data are like
FIELDNAME DATACHR REVISIONNO DATANUM PRODUCTIONCODE
AB No. Nch 1 100 0
AB No. Nch 1 108 0
AB No.-of-Nch 1 1 0
Ass42 teased dishes 1 0
Ass42 BTDrumNo1 BTD-051 1 0
AB53 BTDrumNo1 BTD-051 104 0
CREATE TABLE materialcode
(
UPPERMATERIALCODE CHAR (20),
PROCESSNO TANK (3),
PROCESSADOPTDATE TANK (9)
)
Whether the table b. and its sample data are like
UPPERMATERIALCODE PROCESSNO PROCESSADOPTDATE
Ass42 1 20120717
AB53 108 20121121
111 20111104 AS05
104 20120928 AS30
CREATE TABLE BUILDINGSCHEDULEMASTER
(
BUILDINGSIZE TANK (5 BYTES),
GTCODE FLOAT (4 BYTES),
TIREPERCART NUMBER (3.0).
BUILDINGLOT NUMBER (3.0)
)
Whether table and its sample data are like
BUILDINGSIZE GTCODE TIREPERCART BUILDINGLOT
AB42A 4 12 ass42
AB53A 4 88 AB53
AS30A AS30 4 80
BF03A 1 90 BF03
Now, I need to get some data in these fields by using the suite of mappings.
« PR_ » || Trim (a.BUILDINGSIZE) | ' / MPL2' Processid,--PRIMARY KEY
TO_DATE (substr (NVL(b.PROCESSADOPTDATE,'19800101'), 7, 2) |) » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 5, 2) | » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 1, 4). (' 01:00:00 ',' dd-mm-yyyy hh24:mi:ss') starteff, to_date (SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 7, 2) |) » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 5, 2) | » /'|| SUBSTR (NVL(b.PROCESSADOPTDATE,'19800101'), 1, 4). (' 01:00:00 ',' dd-mm-yyyy hh24:mi:ss') startDate.
b.PROCESSNO revisioncodeid,
a.BUILDINGLOT tirepercart ,
CASE WHEN c.FIELDNAME = 'BTDrumNo1' then c.DATACHR end drumtype1.
BOX WHEN (trim (C.DATACHR) = '1' and trim (C.FIELDNAME) = "No. Nch") and THEN click 'YES '.
ANOTHER 'NO '.
END may-BUG,
case
When c.FIELDNAME = 'Wavy'
AND c.DATACHR = 'Use' THEN on 'YES '.
When c.FIELDNAME = 'Wavy'
AND c.DATACHR <>'Use' THEN 'NO '.
fine wavy
Now for the tables A and B I have the simple join as condition
a.GTCODE = b.UPPERMATERIALCODE
But I have to use two different left join conditions to join the table B and C to calculate the RESP fields according to the condition.
Now, I have to use
(trim (b.UPPERMATERIALCODE)). » -'|| Trim (b.PROCESSNO) = Trim (c.PRODUCTIONCODE) | » -'|| Trim (c.REVISIONNO)
condition to get the data for the WAVY and DRUMTYPE1 fields.
But at the same time, I have to use
substr (Trim (b.UPPERMATERIALCODE), 1, 2). » -'|| Trim (b.PROCESSNO) = Trim (c.PRODUCTIONCODE) | » -'|| Trim (c.REVISIONNO)
conition to derive the CHAFER field.
And for this reason I am come so many duplicates and do not correct results for JUNEBUG, WAVY, DRUMTYPE1, and STARTDATE field.
I need some advice as how can I do so that I get the correct results without duplicates for the PRIMARY KEY.
Thank you
MaheshIt would have been easier to answer if you gave us your example query that gives incorrect results - which both show us what you are doing and give us a starting point.
Insert instructions for data, rather than only the data would have helped too, making it more quick to test this point.
You do not show what you have done with your two outer join criteria, but I think you need to list TIREMASTERPROCESS_TEMP in your query twice, with alias names. Here's what I did:select a.BUILDINGSIZE, a.GTCODE, b.PROCESSNO , c1.FIELDNAME, c1.DATACHR, C2.FIELDNAME, C2.DATACHR , CASE WHEN c1.FIELDNAME='BTDrumNo1' then c1.DATACHR end drumtype1 , CASE WHEN (trim(c2.DATACHR) = '1' and trim(c2.FIELDNAME) = 'No-of-Nch') THEN 'YES' ELSE 'NO' END CHAFER , case when c1.FIELDNAME='Wavy' AND c1.DATACHR='Use' THEN 'YES' when c1.FIELDNAME='Wavy' then 'NO' else null end wavy from BUILDINGSCHEDULEMASTER A join materialcode b on a.GTCODE=b.UPPERMATERIALCODE left outer join TIREMASTERPROCESS_TEMP c1 ON trim(b.UPPERMATERIALCODE)||'-'||trim(b.PROCESSNO) = trim(c1.PRODUCTIONCODE)||'-'||trim(c1.REVISIONNO) left outer join TIREMASTERPROCESS_TEMP c2 ON substr(trim(b.UPPERMATERIALCODE),1,2)||'-'||trim(b.PROCESSNO) = trim(c2.PRODUCTIONCODE)||'-'||trim(c2.REVISIONNO)
C1 is an alias for the TIREMASTERPROCESS_TEMP line which is necessary for drumtype1 and wavy, c2 is an alias for the TIREMASTERPROCESS_TEMP line required for JuneBug. There was some minor errors in your calculations of field I tried to correct.
The results are:
BUILD GTCO PRO FIELDNAME DATACHR FIELDNAME DATACHR DRUMTYPE1 CHA WAV ----- ---- --- ------------ ---------- ------------ ---------- ---------- --- --- AB53A AB53 108 No-of-Nch 1 YES AB42A AB42 1 BTDrumNo1 BTD-051 No-of-Nch 1 BTD-051 YES AB42A AB42 1 Wavy NotUse No-of-Nch 1 YES NO AS30A AS30 104 NO
Hope this helps,
David -
two relationships between two tables
Hi all
I created a cube in my db (using OWB) of two relationships to my time dimension. A relationship shows the start time of a process, that the other represents the date of termination or end.
example of the cube:
Fact1
Fact2
Dim_Time1
Dim_Time2
where Dim_time1 and Dim_Time2 link to the same dimension.
Unfortunately I have trouble this manually import in obiee administrator. I imported the fact table and the dimension of the physical layer table. Can I move to the business layer and create the two joins between two tables. But the overall consistency check up a mistake, I shouldn't have two relationships between two tables and remove a foreign key.
What I am doing wrong?
Kind regards
KnutKnut,
In your example, you should have a time dimension in the phyiscal layer and alias of this 2 x, for Dim_time1 and for Dim_time2, in this way aliases are separate tables as the BI server point of view and you define releations separate on the same table, you can define specific to each alias dim relevant time joins.
In this way, you will have two time decreases intensity in MDB layer also, has 'Dim-Start Time' and a ' Sun - term time "or similar.
Hope this helps,
Alastair -
getting data between two tables
Hi everyone, I need help with a query that seems simple, but I can't understand. consider the following data.
with data as (
s élire 802 cd from dual union all
select 803 cd from dual union all
select 804 cd from dual
data2 as
( select 804 cd from dual )
I want to join the two tables so that the result will be as follows:
in the above data, we can see that 804 is common in both tables. in this case, the output should be 804.
Similarly, if 2 data include the following:
data2 as
( select 804 cd from dual union all
Select 803 cd from dual
)
the output is then 803 804.
Now consider the following data
with data as (
s élire 802 cd from dual union all
select 803 cd from dual union all
select 804 cd from dual
)
take data2 table is empty
I want to join the two tables, and in this case, the output should be 802,803,804. data2 table is empty, then the default behavior is to get all the data in the data table. Since there is no line that corresponds to rows in the data table,
the default behavior is to display output all data in the data table. in this case 802,803,804
can someone write a query for this?
Hello
elmasduro wrote:
Hi Frank, thanks for the request. These are very good questions. Here are the answers
What happens if data2 rows, but none of them match data CD?
It won't happen because the integrity of the data.
...
I see it; a data line 2 will be in the data. You have a FOREIGN KEY constraint, or something similar, so if cd = 804 exists in database2, then it must also exist in the data.
What happens if the data is empty and data2 is not?
If data is empty and data2 is not, then the data2 data should be released.
for example
with the data as)
data table is empty
data2 as
(select cd 804 Union double all the)
Select cd 805 double
)
When you join data and data2 account with the above data, then the output should be 804 805. data2 data should be the display if the data table is empty. ...
Doesn't that contradict what you said earlier? Previously, it seemed to say that each row of data2 will be in the data, but now you give an example where all data2 lines are not in the data.
If the first is true, then the solution in response #2 should work.
If the latter is true, you can change the query like this:
WITH got_r_num AS
(
SELECT NVL (d.cd, d2.cd) AS cd
DENSE_RANK () (ORDER IN CASE
WHEN d.cd IS NOT NULL
AND d2.cd IS NOT NULL
THEN "A".
WHEN d.cd IS NOT NULL
THEN 'B '.
ANOTHER 'C '.
END
) AS r_num
DATA d
FULL OUTER JOIN data2 d2 ON d.cd = d2.cd
)
SELECT cd
OF got_r_num
WHERE r_num = 1
ORDER BY cd
;
-
I got a prob while creating a link/link between two tables in a jdeveloper11g
Hi guys...
I got a prob while creating a link/link between two tables in a jdeveloper11g, help me.
I use two table employee, Department.
Unfortunately there is no primary key and foreign key in these tables.now i updated on those of table structure.
I want to create a form like it should be a link between the Department data, i.e. data and employee while the Department is changed then only present corresponding employees in this block...
Table structure as follows
Employee:
-------------------
employe_id,
name,
Department,
GR,
Date of birth
Department of justice
Department:
--------------------
department_id,
department_name;
Note: in the employee department table is the same as in the department table department_id...
So, you want to build master / detail between Department & sub_departments?
In the same way, create a new, yet another link between departments & sub_departments, so that the connection is:
Department.Department_Id = sub_departments.department_id
-
Foreign keys of a logical Table
Hi all
I want to know in what scenarios, we create the foreign key of a logical Table. Once we have create the foreign key for the logical table, this means he automatically substitute if joins are here.
Physical table A, B (without physical joins)
Logic table A, B (B (Sun)--> (Fact) A logical join)
created the foreign key in the logical table A with b. (A.1 = B.1)
The RPD will generate sql with A.1 = B.1 join condition for the reports.
I tried to create the logical foreign key for table logical, I couldn't see any option from the table. Here is his
http://Tinypic.com/r/jq1gkz/6
Thank you
ViratIn general when we go to the complex joins in the physical layer, we opt for logical foreign key joins in layer MDB, best examples is SCD Type II.
Physical table A, B (without physical joins)
--> You must have a physical join so that it can be override by layer MDBcreated the foreign key in the logical table A with b. (A.1 = B.1) the RPD will generate sql with A.1 = B.1 join condition for the reports.
--> Yes, you can see this join in the physical BI query.I tried to create the logical foreign key for table logical, I couldn't see any option from the table. Here is his
--> 2 cases: 1) you must remove existing logical joins 2) you could not have involved physical layer.Hope this helps
Let me know for questionsPublished by: Srini VIEREN on 18 January 2013 13:29
BTW: You got a very good reputation, why don't update you your profile to see your name instead of a number
Published by: Srini VIEREN on 18 January 2013 13:29
-
Use a where clause clause if there is a relationship between two tables
Is it possible to use a where clause clause if there is a relationship between two tables.
I have a relationship between two tables:
And a.customer = b.customer (+)
If b.customer exists in a.customer I would add this in where clause
And b.info = 'X '.
But how?It's the outer joins by chance?
If so, why not just:
and b.customer(+) = a.customer and b.info(+) = 'X'
BTW, I put the two "b" on the left column to make it easier to read. Some people mix that makes me crazy, but makes no difference to the query.
-
Join of two tables in two different schemas
Hi all
I have an obligation to join two tables on two different schemas. How to join these two tables in the object view.
Thanks in advance.
Concerning
Kaushik GuillauminYou can do just that using schema name in the +' view object.table name ' + according to the query object and also grant select the another schema to this schema user
ex
you need schem is test and another Act you need to a view object based on the test to join a table on shcema Actyou write semply object sql view code:
Act.table name
and you can also give him select statement on Bill schem table to test
concerning
-
I need to implement Drag N Drop between two tables that saves the two records
I need to implement Drag N Drop between two tables that saves the two records on a third page, using drag 'n drop.Check out this video http://baigsorcl.blogspot.com/2011/01/drag-and-drop-collection-in-oracle-adf.html
-
problem with join of two tables
Hi, consider the following data
what I want to do, is to join data2 with data by isi, ri or southern id table and produce this output.WITH data AS ( SELECT 123 cid, 'aaa' isi, 'kkk' sud, 'ttt' ri FROM dual UNION ALL SELECT 222 cid, 'bbb' isi, 'gggg' sud, 'hhh' ri FROM dual ) , data2 AS ( SELECT 'aaa' isi, 'yyy' sud, 'ooo' ri FROM dual UNION ALL SELECT 'qqq' isi, 'ggg' sud, 'ooo' ri FROM dual UNION ALL SELECT 'uuu' isi, 'ppp' sud, 'ttt' ri FROM dual UNION ALL SELECT 'ppp' isi, 'mmm' sud, 'nnn' ri FROM dual )
It's how I got the above output:cid txt === ==== 123 aaa 222 ggg 123 ttt
first try to join isi in database2 with isi in "features" and discover if line matches. If this is the case, display the cid of the data table and the use of the value to match.
e.g. in the first line of table data2, we can see that isi = aaa matches line an isi data table. If the output displays 123 and value aaa.
If the rank table two of the Data2 isi = qqq. When join them with the data table, we find not all isi with qqq. in this case, it must join with column of South. We can see that South = ggg data2 games
the second line in the table of output so will bee 222 and value ggg.
now, take a look at the third row in Database2. ISI = uuu is not found in the data table when join them. then try to join to the South. South = ttt is also not found in any row of the data table. so join with ri. We
can see that ri = ttt data2 matches with ri = ttt in the table of data online 1. Therefore, we display the value.
can someone help me write a sql query that joins these two tables by isi. If no line found then join South, if no found rows then join in ri? Thank youHello
elmasduro wrote:
Hi Frank, data2.sud = 'Gay' (4 characters) assume to be South = "ggg". by mistake, I type extra g.I have another question about the request. What happens if I want to bring rows of data.2 even if they do not exist in the data table for the entire column was join?
for example, I want to show this:cid txt === ==== 123 aaa 222 ggg 123 ttt ppp --row from data2
the columns of the last row of data.2 does not match any column in the data table. in this case, I want to make but cid will be null. I tried outer join on your request, but it looks like I can not clause or with outer join
SELECT d1.cid , CASE WHEN d1.isi = d2.isi THEN d2.isi WHEN d1.sud = d2.sud THEN d2.sud ELSE d2.ri END AS txt FROM data d1 JOIN data2 d2 ON d1.is(+)i = d2.isi OR d1.sud(+) = d2.sud OR d1.ri(+) = d2.ri ;
How can I re - write the query for this case? Thanks again for your help
Here is the outer join syntax:
SELECT d1.cid , CASE WHEN d1.isi = d2.isi THEN d2.isi WHEN d1.sud = d2.sud THEN d2.sud WHEN d1.ri = d2.ri THEN d2.ri ELSE d2.isi END AS txt FROM data2 d2 LEFT OUTER JOIN data d1 ON d1.isi = d2.isi OR d1.sud = d2.sud OR d1.ri = d2.ri ;
The + sign for outer joins only works with the old join syntax, non-ANSI. Do not try to mix the two different ways to do joins.
Not to mention that the outer join, don't forget to change the CASE expression, to include the new possibility of any columns 3 join matching.
-
How to remove the extra space between two Table HTML
Hello
I wrote a code for printing costs. But there is more space between two Table Html, how I can remove it.
Please run that Code
Start
HTP.p (')
< html >
(< body > ');
HTP.p (')
< TABLE align = "left" width = "500" cellspacing = "0" cellpadding = "0" border = "1" >
< tr > < td align = 'right' white-space: nowrap; > Ph-2201751 < table >
< td > < table >
< /tr >
< tr > < td align = "center" white-space: nowrap; > < B > < table > < /B > SATYAM MODERN PUBLIC SCHOOL
< td > < table >
< /tr >
< b >
< td align = "center" white-space: nowrap; > < i > < H3 > (AFFILIATED to THE CBSC, NEW DELHI CODE No. 53544) < / H3 > < /I > < table >
< td > < table >
< /tr >
< tr > < td align = "center" white-space: nowrap; > new colony Braham, - 131001 (h) < table >
< td > < table >
< /tr >
< tr > < td align = "center" white-space: nowrap; > RECEPTION COSTS < table >
< td > < table >
< /tr >
< /table >
< TABLE width = "500" cellspacing = "0" cellpadding = "0" border = "1" >
< b >
< td width = "100" white-space: nowrap; > receipt no.: < table >
< td width = "100" white-space: nowrap; > Date received: < table >
< /tr >
< b >
< td width = "100" white-space: nowrap; > name: < table >
< td width = "100" white-space: nowrap; > father name: < table >
< /tr >
< b >
< td width = "100" white-space: nowrap; > class & s: < table >
< td width = "100" white-space: nowrap; > A/C No. : < table >
< /tr >
< b >
< td width = "100" white-space: nowrap; > from: < table >
< td width = "100" white-space: nowrap; > to: < table >
< /tr >
(< /table > ');
HTP.p (')
< / body >
(< / html > ');
end;
Thank you
EdHello
HTML is valid, that your code print?
Wouldn't be as below?
BR, Jari
Published by: jarola on December 18, 2009 15:22
I test your code
http://Apex.Oracle.com/pls/OTN/f?p=40323:25
I can't see any extra space between the tablesHow it warns Oracle to use an index for the join of two tables...
How to prevent the Oracle to use an index for the join of two tables to get a view online that is used in an update statement?
O.K. I think I should explain what I mean:
When you join two tables that have many entries sometimes there're better is not to use an index on the column that is used as a criterion to join.
I have two tables: table A and table B.
Table A has 4,000,000 entries and table B has 700,000 entries.
I have a join of two tables with a numeric column as join criteria.
There is an index on this column in A table.
So I instead of
I want to usewhere (A.col = B.col)
in order to avoid Oracle using the index.where (A.col+0 = B.col)
When I use the join in a select query, it works.
But when I use the join as inline in an update statement I get the error ORA-01779.
When I remove the '+ 0' the update statement works. (The column is unique in table B).
Any ideas why this happens?
Thank you very much in advance for any help.
Hartmut cordiallyYou plan to use a NO_INDEX hint as shown here: http://www.psoug.org/reference/hints.html
- Hi gurus,
I learned that it is not practical to use the foreign key is associated with the Business model layer and mapping. Why is - this, I tried a simple diagram of sample Star that only uses the foreign key instead of complex joins joins in the diagram of MDB, the RPD is consistent and runs correctly on the BI server.
What's the downside if I did it, and why is not recommended?
Kind regards
Anthony.Complex joins allow the BI server to choose the best route between logical tables in layer based MDB on the phyiscal joins that exist for logical table sources in these tables.
With a FK join your limiting the choice Server BI has when it generates the ideal SQL to fulfill the request.
The complex joins allow:
easy config,
BI server to navigate through different levels (for example, day and month) when using a different level facts.Hello
I have two tables USERS and LISTS:
And I want that there is a comparison between these two tables executed when user table USERS connect to the application.
They must compare the columns between the SEXES and AGE and if some users have the same attributes in its ranks as in a line in the table LISTS (here is unique each line) so that the user gets in his line in the column 'LIST_ID' the ID of the line with which attributes between GENDER and AGE.
Example:
USERS TABLE: exampleuser | Boby | McGrahem | Male | 18. -------
LISTS OF TABLE: 28 | examplelist | Male | 18
Once the Login of the user Boby gets in its ranks the ID = 28 because the SEX and AGE corresponds to the row of table LIST:
Result:
USERS TABLE: exampleuser | Boby | McGrahem | Male | 18. 28
CREATE TABLE "USERS" ( "USERNAME" VARCHAR2(15) NOT NULL ENABLE, "FORRNAME" VARCHAR2(15) NOT NULL ENABLE, "SURNAME" VARCHAR2(15) NOT NULL ENABLE, "GENDER" VARCHAR2(10) NOT NULL ENABLE, "AGE" NUMBER, "LIST_ID" NUMBER, CONSTRAINT " USERS_PK" PRIMARY KEY ("USERNAME") USING INDEX ENABLE
CREATE TABLE "LISTS" ( " LIST_ID" NUMBER NOT NULL ENABLE, " LISTNAME" VARCHAR2(50) NOT NULL ENABLE, "GENDER" VARCHAR2(10) NOT NULL ENABLE, "AGE" VARCHAR2(3) NOT NULL ENABLE, CONSTRAINT " LISTS_PK" PRIMARY KEY ("LIST_ID") USING INDEX ENABLE
I need help for coding this, if someone be so good.
This is my essay:
DECLARE v_listid varchar2(100); BEGIN SELECT LIST_ID into v_listgid FROM LISTS WHERE GENDER = (SELECT GENDER FROM USERS WHERE UPPER(TRIM(USERNAME)) = UPPER(TRIM(:APP_USER))) AND AGE = (SELECT AGE FROM USERS WHERE UPPER(TRIM(USERNAME)) = UPPER(TRIM(:APP_USER))); UPDATE USERS SET LIST_ID = v_listid WHERE UPPER(TRIM(USERNAME)) = UPPER(TRIM(:APP_USER)); END;
I'd like to REALLY shy away using the USER name as the primary key, because the fact that users can create duplicate user names... YOU should NEVER base a PK on the entry of user, the better to let the database create and maintain this element of date...
FIX:
UPDATE to users U
SET List_Id = (SELECT List_Id OF lists L WHERE L.Gender = U.Gender and L.SOMENUMBER = U.SOMENUMBER) AND
Upper (U.UserName) = UPPER(:APP_USER);
Don't really want to cut the strings, Oracle which will do since they are of type varchar2 columns...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILLconnect before between two tables
I have this table structure
I have what it takes to return the value on prior connection
create table OBJECT_LIST ( cal_objid NUMBER(4) not null, obj_name VARCHAR2(100), obj_type VARCHAR2(20), obj_title VARCHAR2(20), description VARCHAR2(50) ); alter table OBJECT_LIST add constraint OBJECT_LIST_PK primary key (CAL_OBJID); create table CAL_ERD ( obj_child NUMBER(5) not null, obj_parent NUMBER(5) not null, obj_rel_type VARCHAR2(50) ); alter table CAL_ERD add constraint CAL_ERD_PK primary key (OBJ_CHILD, OBJ_PARENT); alter table CAL_erd add constraint cal_parent_FK foreign key (obj_parent) references object_list (CAL_objid); alter table CAL_erd add constraint cal_child_FK foreign key (obj_child) references object_list (cal_objid); insert into object_list (cal_objid, obj_name, obj_type) values(1192, 'MainObject', 'Form'); insert into object_list (cal_objid, obj_name, obj_type) values(1193, 'SecondObject', 'Form'); insert into object_list (cal_objid, obj_name, obj_type) values(1194, 'ThirdObject', 'Form'); insert into object_list (cal_objid, obj_name, obj_type) values(1195, 'FourthObject', 'Form'); insert into object_list (cal_objid, obj_name, obj_type) values(1196, 'FirthObject', 'Form'); insert into cal_erd values(1193,1192,null); insert into cal_erd values(1194,1193,null); insert into cal_erd values(1195,1194,null);
in the first table values
CAL_OBJID OBJ_NAME, OBJ_TYPE OBJ_TITLE DESCRIPTION
1192 MainObject form
1193 SecondObject form
1194 ThirdObject form
1195 FourthObject form
1196 FirthObject formthe second value of the table
OBJ_CHILD OBJ_PARENT OBJ_REL_TYPE
1192 1193
1194 1193
1195 1194SQL script that I am trying
WITH t AS (SELECT li.obj_name, li.obj_type, li.obj_title, li.DESCRIPTION, LEVEL AS lvl, SYS_CONNECT_BY_PATH(li.obj_name, '/')paths FROM object_list li,cal_erd er where li.cal_objid = er.obj_parent(+) START WITH obj_parent IS NULL CONNECT BY NOCYCLE PRIOR obj_child = obj_parent) SELECT obj_name, LEAD(obj_name) OVER(ORDER BY paths) AS child_name, obj_type , obj_title , DESCRIPTION , substr(paths, INSTR(paths, '/', 1, CASE WHEN lvl > 1 THEN lvl-1 END) + 1 , INSTR(paths, '/', 1, CASE WHEN lvl > 1 THEN lvl END) - INSTR(paths, '/', 1, CASE WHEN lvl > 1 THEN lvl-1 END) - 1 ) AS parent_name FROM t;
get valueOBJ_NAME, OBJ_TYPE OBJ_TITLE DESCRIPTION PARENT_NAME CHILD_NAME
FirthObject FourthObject form
FourthObject formI what like to be like that
OBJ_NAME, OBJ_TYPE DESCRIPTION OBJ_PARENT OBJ_TITLE OBJ_CHILD
SecondObject MainObject form
ThirdObject SecondObject form MainObject
fourthObject ThirdObject shape SecondObject
I would like if possible show the id of ojb_name
Hello
Here's a way to achieve the expected results, you want to:
WITH t AS (SELECT obj_parent , li.obj_name , li.obj_type , li.obj_title , li.DESCRIPTION , LEVEL AS lvl , SYS_CONNECT_BY_PATH(li.obj_name, '/')paths FROM object_list li LEFT JOIN cal_erd er ON (li.cal_objid = er.obj_child) START WITH obj_parent IS NULL CONNECT BY NOCYCLE PRIOR cal_objid = obj_parent), t2 AS ( SELECT LEAD(obj_name) OVER(PARTITION BY substr(paths, 1 , CASE WHEN INSTR(paths, '/', 1, 2)> 0 THEN INSTR(paths, '/', 1, 2)-1 ELSE LENGTH(paths) END) ORDER BY paths) AS child_name , obj_name , obj_type , obj_title , DESCRIPTION , substr(paths, INSTR(paths, '/', 1, CASE WHEN lvl > 1 THEN lvl-1 END) + 1 , INSTR(paths, '/', 1, CASE WHEN lvl > 1 THEN lvl END) - INSTR(paths, '/', 1, CASE WHEN lvl > 1 THEN lvl-1 END) - 1 ) AS parent_name FROM t) SELECT * FROM t2 WHERE child_name IS NOT NULL;
Result:
CHILD_NAME OBJ_NAME, OBJ_TYPE OBJ_TITLE PARENT_NAME DESCRIPTION
SecondObject MainObject form
ThirdObject SecondObject form MainObject
FourthObject ThirdObject shape SecondObject
Kind regards
Steve
Maybe you are looking for
-
Remove the tab Active white border outline FF29?
Hello I want to remove the border from white outline around the active tabs in FF29. I want that it to blend the background as the inactive tabs. I have Tab mix plus and restorer of classic theme installed. They fine only would like the transparent b
-
Toshiba virtual store - blank white page
Hello! I have a problem with the virtual store. I did probably all things with my Tablet I found on this forum. Update my soft, hard reset, soft reset. and I can not open the virtual store. When I opened VS I have a blank white page, and anything els
-
I have a model VPC-f1190x what Bios FRIEND R0280Y6 2.6. I've put a bios password on it and can not remember for the life of me. I can still use the computer, but I need to get the bios to change some settings and cannot. How can I remove this passwor
-
Compac CQ58: CQ58 BIOS password does not
Laptop is asking to specify a password for the system. I tried the password only I have ever used and it does not work. After three attempts, it gives me disable the code 78503941. Help, please
-
Hello, I installed shieldvpn of http://download46.mediafire.com/mqzqxr6x2r8g/albnomnfktn35x2/11in1_ShieldVPN_5.1.7z When I connect it says expired reconnection I have replace the S by G (globe) and I use 64-bit windows 7