I have the following situation, my select returns me 3 micro (child), descr (descr child) and macro fields ) micro fields and macros are integers and can be any number not following standard (when I say default I mean micro 2 for example does not necessarily have 1 as macro can be 3) and I need to fill a treeview
with these information, I can get my query to return the records in the orders in which it has to be added.
My table in the database has the following structure:
ID_HIERARQUIA NUMBER
MICRO NUMBER
DESCR VARCHAR2(300 BYTE)
MACRO NUMBER
POSICAO VARCHAR2(50 BYTE)
I used these insert
's for testing:
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM
HIERARQUIA),'08','EQUIPAMENTO 08','','01');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'04','EQUIPAMENTO 04','08','0101');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'02','EQUIPAMENTO 02','04','010101');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'03','EQUIPAMENTO 03','04','010102');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'05','EQUIPAMENTO 05','08','0102');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'06','EQUIPAMENTO 06','05','010201');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'07','EQUIPAMENTO 07','05','010202');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'01','EQUIPAMENTO 01','07','01020201');
INSERT INTO HIERARQUIA VALUES((SELECT NVL(MAX(ID_HIERARQUIA)+1,1) FROM HIERARQUIA),'09','EQUIPAMENTO 09','07','01020202');
I tried the solution of this link
Where he feeds his list, I have adapted to receive the following query SELECT MICRO, DESCR, MACRO FROM HIERARQUIA ORDER BY POSICAO
But despite feeding correctly, it only creates the first node and does not even add its children. If you can help me, I'm grateful.