Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a level pseudo column in Oracle, Can anyone explain me in this?

Tags:

sql

oracle

What is a level pseudo column in Oracle, Can anyone explain me in this?

like image 391
user338292 Avatar asked Dec 16 '22 23:12

user338292


2 Answers

You use LEVEL with the SELECT CONNECT BY statement to organize rows from a database table into a tree structure. LEVEL returns the level number of a node in a tree structure. The root is level 1, children of the root are level 2, grandchildren are level 3, and so on.

In the START WITH clause, you specify a condition that identifies the root of the tree. You specify the direction in which the query walks the tree (down from the root or up from the branches) with the PRIOR operator.

like image 108
Gabriel Magana Avatar answered Dec 28 '22 06:12

Gabriel Magana


    SELECT LEVEL N
      FROM DUAL
CONNECT BY LEVEL < 76;

The previous statement generates all the integers starting from 1 and ending to 75. It uses the LEVEL pseudocolumn.

like image 23
UltraCommit Avatar answered Dec 28 '22 07:12

UltraCommit