How to select id of father from the child id recursively I have in the field cod_categorizacao_pai the ID of the father, and I need to mount a select that just enter an ID and it will list the paternal IDs of this ID until it reaches the parent of all. How do I set a select to do this? Will I need a procedure? I am using PL / SQL.

The table: 

CREATE TABLE [dbo].[menu]
(
  id INT PRIMARY KEY
, name NVARCHAR(20)
, parent_id INT REFERENCES [dbo].[menu] ([id])
);


Suppose I am using the records below:

INSERT INTO menu VALUES (1,'Main Product',NULL); 
INSERT INTO menu VALUES (2,'Next Main Product',NULL); 
INSERT INTO menu VALUES (3,'Addon Product',1); 
INSERT INTO menu VALUES (4,'Addon Product',1); 
INSERT INTO menu VALUES (5,'Sub-Addon Product',3);
INSERT INTO menu VALUES (6,'Sub-sub-Addon Product',5);
INSERT INTO menu VALUES (7,'Addon Next Main Product',2);


I would like to have the following listing if I passed ID '6' as a parameter:
1,3,5,6
That is not Oracle syntax. Below is Oracle syntax:

drop table menu purge;
CREATE TABLE menu
(
  id INT PRIMARY KEY
, name NVARCHAR2(40)
, parent_id INT REFERENCES menu (id)
);

INSERT INTO menu VALUES (1,'Main Product',NULL); 
INSERT INTO menu VALUES (2,'Next Main Product',NULL); 
INSERT INTO menu VALUES (3,'Addon Product',1); 
INSERT INTO menu VALUES (4,'Addon Product',1); 
INSERT INTO menu VALUES (5,'Sub-Addon Product',3);
INSERT INTO menu VALUES (6,'Sub-sub-Addon Product',5);
INSERT INTO menu VALUES (7,'Addon Next Main Product',2);
commit;

select listagg(id, ',') within group (order by id) from menu
connect by id = prior parent_id
start with id = 6;

LISTAGG(ID,',')WITHINGROUP(ORDERBYID)
-------------------------------------
1,3,5,6