I am trying to make a JSON_OBJECT that stores my data from my table. I just have no idea how to append data after the creation of JSON_OBJECT. the reason of I did not include the two remaining columns is with regard to hired_date and emp_status, I will make some if else condition before adding on the json_object.
DECLARE
v_output_data CLOB;
CURSOR get_info(in_dept_id VARCHAR2) IS
SELECT last_name,first_name, hired_date, emp_status
FROM emp_directory_info
WHERE source_system_id = in_dept_id ;
BEGIN
FOR record_ctr IN get_info('acct') LOOP
v_output_data:= v_output_data ||JSON_OBJECT
('Souce' VALUE record_ctr.last_name,
'Received' VALUE record_ctr.first_name
);
--Want to put some if else condition here, after that I will append the 'hired_date' and 'emp_status' column from the existing JSON_OBJECT above.
END LOOP;
END;