Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8507

Re: Recursive Query in HANA

$
0
0

Thank you very much for your comments,

 

The alternative seems to be faster to use a procedure but is inefficient and it will take time to implement in complex queries.

 

In Bratislava we were shown 'Father-Son Hierarchies' with a very basic example, do you think this can be used for the recursive query that I need?

 

If so, do you know where I can find more information / documentation on how to parameterize 'Father-Son Hierarchies' type queries?

 

I show the example of 'Father-Son Hierarchies' that was provided:

 

CREATE COLUMN TABLE h_mini_src ( pred CHAR(2), succ CHAR(2) PRIMARY KEY );

INSERT INTO h_mini_src VALUES ( null, 'A1' );

INSERT INTO h_mini_src VALUES ( 'A1', 'B1' );

INSERT INTO h_mini_src VALUES ( 'A1', 'B2' );

INSERT INTO h_mini_src VALUES ( 'B1', 'C1' );

INSERT INTO h_mini_src VALUES ( 'B1', 'C2' );

INSERT INTO h_mini_src VALUES ( 'B2', 'C3' );

INSERT INTO h_mini_src VALUES ( 'B2', 'C4' );

INSERT INTO h_mini_src VALUES ( 'C3', 'D1' );

INSERT INTO h_mini_src VALUES ( 'C3', 'D2' );

INSERT INTO h_mini_src VALUES ( 'C4', 'D3' );

 

CREATE COLUMN VIEW h_mini TYPE HIERARCHY WITH PARAMETERS (

'hierarchyDefinitionType' = 'select',

'hierarchyDefinition' = '{

"sourceType":"recursive",

"nodeType":"string",

"runtimeObjectType":"blob",

"sourceQuery":"SELECT pred, succ FROM h_mini_src" }' );

 

--Display all nodes and their attributes :

SELECT * FROM h_mini;

 

--Display all nodes subordinate to node B2 :

SELECT result_node FROM h_mini WITH PARAMETERS ( 'expression' = 'subtree("B2",1,99)' );


Viewing all articles
Browse latest Browse all 8507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>