Advertisement
Maks140888

Untitled

Jun 1st, 2022
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.44 KB | None | 0 0
  1. create or replace function find_parents_childs(obj_x VARCHAR2)
  2. RETURN objects_below as parents objects_below;
  3. begin
  4.     select LPAD(' ', 3*level)||name
  5.     bulk collect into parents
  6.     from objects start  WITH object_id =  (SELECT object_id from objects
  7.     where name = obj_x)
  8.     CONNECT by prior parent_id = object_id;
  9.    
  10.     return parents;
  11. end;
  12.  
  13. select find_parents_childs(name) from objects where name = 'Томас Шелби'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement