SYS_CONNECT_BY_PATH
Syntax
Description of the illustration sys_connect_by_path.gif
Purpose
SYS_CONNECT_BY_PATH
is valid only in hierarchical queries. It returns the path of a column value from root to node, with column values separated by char
for each row returned byCONNECT
BY
condition.
Both column
and char
can be any of the data types CHAR
, VARCHAR2
, NCHAR
, or NVARCHAR2
. The string returned is of VARCHAR2
data type and is in the same character set as column
.
See Also:
"Hierarchical Queries" for more information about hierarchical queries andCONNECT
BY
conditionsExamples
The following example returns the path of employee names from employee Kochhar
to all employees of Kochhar
(and their employees):
SELECT LPAD(' ', 2*level-1)||SYS_CONNECT_BY_PATH(last_name, '/') "Path" FROM employees START WITH last_name = 'Kochhar' CONNECT BY PRIOR employee_id = manager_id; Path ------------------------------ /Kochhar/Greenberg/Chen /Kochhar/Greenberg/Faviet /Kochhar/Greenberg/Popp /Kochhar/Greenberg/Sciarra /Kochhar/Greenberg/Urman /Kochhar/Higgins/Gietz /Kochhar/Baer /Kochhar/Greenberg /Kochhar/Higgins /Kochhar/Mavris /Kochhar/Whalen /Kochhar
http://download.oracle.com/docs/cd/E14072_01/server.112/e10592.pdf
'SQL' 카테고리의 다른 글
Recursive CTE Structure [ ;WITH .... AS (... UNION ALL ...) SELECT ] (0) | 2011.07.22 |
---|---|
CREATE OR REPLACE PROCEDURE EJMIS.Ledger_Migration_Daily (0) | 2011.07.20 |
ANSI Standards (0) | 2011.07.15 |
SQL:2008 is the sixth revision of the ISO and ANSI standard for the SQL database query language.해 주세요. (0) | 2011.07.15 |
SQL-92 was the third revision of the SQL database query language (0) | 2011.07.15 |