connect-by Questions

4

Solved

In Oracle, if I have a table defined as … CREATE TABLE taxonomy ( key NUMBER(11) NOT NULL CONSTRAINT taxPkey PRIMARY KEY, value VARCHAR2(255), taxHier NUMBER(11) ); ALTER TABLE taxonomy ADD ...
Chondrule asked 22/7, 2014 at 22:6

1

Solved

Test #1: I have a user-defined function and a CONNECT BY LEVEL query: with function custom_function(p_id in number) return number is begin return p_id; end; select custom_function(level) from...
Amphoteric asked 5/7, 2022 at 15:4

2

Solved

I have a Oracle query with a NOCYCLE clause which I have to translate to Postgres: SELECT FG_ID,CONNECT_BY_ROOT FG_ID as Parent_ID FROM FG t START WITH t.Parent_filter_group_id is null CONNECT B...
Tenebrae asked 31/7, 2014 at 12:30

3

Solved

I've got this Oracle code structure I'm trying to convert to SQL Server 2008 (Note: I have used generic names, enclosed column names and table names within square brackets '[]', and done some forma...
Cleasta asked 5/8, 2015 at 8:55

1

Solved

I tried to find some informations about connect by "engine". I found this post: Confusion with Oracle CONNECT BY User krokodilko answered and says: The analyze of the last query: select level fr...
Upperclassman asked 19/10, 2018 at 21:4

4

Solved

I would like to get all countries separated by N (1,2,3,4 ...) borders from a specified country. N should also be specified. For example I have the table "borders" and "country": border | ne...

3

Does PostgreSQL have a pseudo-column like "LEVEL" in Oracle? If not, then how can we create a column similar to "LEVEL"?

2

Following query shows that select * combined with connect by and left join doesn't return all columns, but only columns used in these conditions. This behavior was useful for me, given that select ...
Dropforge asked 11/2, 2016 at 10:35

4

Solved

Using CONNECT BY LEVEL seems to return too many rows when performed on a table. What is the logic behind what's happening? Assuming the following table: create table a ( id number ); insert into...
Checkerwork asked 24/11, 2012 at 11:15

3

Solved

Relationship model is 1 3 \ / \ 2 4 \ 7 5 8 \ / / 6 9 Table is : select 2 child, 1 father from dual union all select 2 child, 3 father from dual union all select 4 child, 3 father from d...
Derina asked 10/5, 2013 at 19:42

2

Solved

In simplified terms, I'm trying to calculate the percentage of the root of a tree owned by its parents, further up the tree. How can I do this in SQL alone? Here's my (sample) schema. Please note t...
Gameness asked 10/12, 2012 at 18:25

1

Solved

I have a query requirement from ----. Trying to solve it with CONNECT BY, but can't seem to get the results I need. Table (simplified): create table CSS.USER_DESC ( USER_ID VARCHAR2(30) not n...
Schofield asked 14/10, 2012 at 20:44

3

Solved

Oracle ships with a very handy feature. You can create hierarchical queries (recursive behaviour) using the following clause: CONNECT BY [NOCYCLE] {condition [AND condition...]} [START WITH condit...
Lotti asked 19/6, 2011 at 7:51

3

Solved

Given a simple (id, description) table t1, such as id description -- ----------- 1 Alice 2 Bob 3 Carol 4 David 5 Erica 6 Fred And a parent-child relationship table t2, such as parent child ----...
Unity asked 22/9, 2008 at 20:44
1

© 2022 - 2024 — McMap. All rights reserved.