alexarcan

dbd_lab7->pt test!

Nov 7th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. --1.
  2. select LEVEL, lpad(' ',2*(level-1)) ||categoryname
  3. from categories
  4. start with othercatid is null
  5. connect by prior categoryid = othercatid ;
  6.  
  7.  
  8. --2.
  9. select LEVEL, lpad(' ',2*(level-1)) ||c.categoryname
  10. from
  11. (SELECT c.categoryid, upper(c.categoryname) categoryname, c.othercatid
  12. FROM categories c
  13. UNION
  14. select p.productid *1000, lower(p.productname) productname, p.categoryid
  15. from products p,categories c
  16. WHERE p.productid = c.categoryid) c
  17. start with othercatid is null
  18. connect by prior c.categoryid = c.othercatid ;
  19. --de pus in view
Add Comment
Please, Sign In to add comment