Up until now I've used PL/JSON for very simple stuff and it works perfectly.
I'm working with a project planning tool which can for 1 add rows(tasks) above and below a current task.
So I'm thinking I will need to use a oracle table with a single CLOB column. I think I will need to use JSON path to properly position the inserts.
This is where I'm stuck on several points :
- how would I read the CLOB into json (select clob into tempclob) -> then
obj:=json(tempclob);
- how to position the insert. But I think I could help myself by altering my JSON stuckture?
My current structure is a standard oracle table with column, where I htp() it returns:
Currently I have standrard oracle table called ori_project_mgmt(PROJECT_MGMT_ID, PROJECT_MGMT_NAMe …etc). When I htp the select * from ori_projects I get output as:
You're not thinking this all the way through. You should have another table that maps "PROJECT_MGMT_ID" to "TASK_ORDER_NUMBER" (or similar). If you insist on keeping only one table, then you need another column for the task order number. You would then use an ORDER BY clause to sort your query results into the correct order.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually come to think of it, that's not such a bad idea, this way I could simply invert the order of the task with +1 -1 (or what ever else). Perfect example of KISS. Kicking myself now.
Thanks
Jan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello All,
Up until now I've used PL/JSON for very simple stuff and it works perfectly.
I'm working with a project planning tool which can for 1 add rows(tasks) above and below a current task.
So I'm thinking I will need to use a oracle table with a single CLOB column. I think I will need to use JSON path to properly position the inserts.
This is where I'm stuck on several points :
- how would I read the CLOB into json (select clob into tempclob) -> then
- how to position the insert. But I think I could help myself by altering my JSON stuckture?
My current structure is a standard oracle table with column, where I htp() it returns:
I'm not sure how to go from a table structure to a json structure while retaining the the aboe output.
- I can stay wtih the current structure
OR
-
Can anybody offer some insight?
Jan.
I'm not sure if I understand your question. But it seems that you should be using json_list instead of json as your outer type.
Hello Jonas,
Currently I have standrard oracle table called ori_project_mgmt(PROJECT_MGMT_ID, PROJECT_MGMT_NAMe …etc). When I htp the select * from ori_projects I get output as:
I would like to be able do things like add row (New task #3) before project_mgmt_id: 2
I'm assuming I would like to convert my my standard table into a JSON_LIST (as you suggested).
How would I tell PL/JSON, insert the new record before record project_mgmt_id: 2?
Its hard to explain, but in short the front EXTJS Store does things like insert row at rowindex +1 or rowindex -1.
And I would need to replicate this behavior inside oracle column (JSON CLOB) while still returning HTP in a simple format.
Thanks
Jan
You're not thinking this all the way through. You should have another table that maps "PROJECT_MGMT_ID" to "TASK_ORDER_NUMBER" (or similar). If you insist on keeping only one table, then you need another column for the task order number. You would then use an ORDER BY clause to sort your query results into the correct order.
Hi,
Actually come to think of it, that's not such a bad idea, this way I could simply invert the order of the task with +1 -1 (or what ever else). Perfect example of KISS. Kicking myself now.
Thanks
Jan