This question is related to THIS topic
What I have is:
LOOP
FETCH l_get_data INTO
l_first_name, l_last_name, l_email, l_phone, l_us_id, l_us_fullname, l_user_type,
l_line_manager_1, l_line_manager_2, l_line_manager_3, l_line_manager_4, l_line_manager_5,
l_us_flags, l_business_unit, l_position, l_middlename ;
EXIT WHEN l_get_data%NOTFOUND;
l_jsonObj := json();
l_jsonObj.put('userFirstName', l_first_name );
l_jsonObj.put('userLastName', l_last_name);
l_jsonObj.put('userEmail', l_email);
IF l_phone IS NULL THEN l_jsonObj.put('userPhone', '');
ELSE l_jsonObj.put('userPhone', l_phone); END IF;
l_jsonObj.put('login', l_us_id);
l_jsonObj.put('userFullName', l_us_fullname);
l_jsonObj.put('userType', l_user_type);
IF l_line_manager_1 IS NULL THEN l_jsonObj.put('lineManager1', '');
ELSE l_jsonObj.put('lineManager1', get_full_name(l_line_manager_1)); END IF;
IF l_line_manager_2 IS NULL THEN l_jsonObj.put('lineManager2', '');
ELSE l_jsonObj.put('lineManager2', get_full_name(l_line_manager_2)); END IF;
IF l_line_manager_3 IS NULL THEN l_jsonObj.put('lineManager3', '');
ELSE l_jsonObj.put('lineManager3', get_full_name(l_line_manager_3)); END IF;
IF l_line_manager_4 IS NULL THEN l_jsonObj.put('lineManager4', '');
ELSE l_jsonObj.put('lineManager4', get_full_name(l_line_manager_4)); END IF;
IF l_line_manager_5 IS NULL THEN l_jsonObj.put('lineManager5', '');
ELSE l_jsonObj.put('lineManager5', get_full_name(l_line_manager_5)); END IF;
IF INSTR(l_us_flags, 'DIS', 1, 1) = 0 THEN l_jsonObj.put('active', 'Yes');
ELSE l_jsonObj.put('active', 'No'); END IF;
IF l_business_unit IS NULL THEN l_jsonObj.put('businessUnit', '');
ELSE l_jsonObj.put('businessUnit', l_business_unit); END IF;
IF l_position IS NULL THEN l_jsonObj.put('position', '');
ELSE l_jsonObj.put('position', l_position); END IF;
IF l_middlename IS NULL THEN l_jsonObj.put('userMiddleName', '');
ELSE l_jsonObj.put('userMiddleName', l_middlename); END IF;
l_jsonArray.append(l_jsonObj.to_json_value);
l_select_data.put(l_us_id, l_us_fullname);
END LOOP;
CLOSE l_get_data;
The problem is that I’m getting this error: invalid cursor
I have checked 100 times my code and there are no logical errors(at least I can’t see them). I’m fetching the data and then I’m trying to pass it to the parameters without success.
I’m asking for a small clue on where the problem is, or what is causing it, I’m sure it’s somthing really small, but important.
The above code is correct, what I had wrong was a the name of the parameter I was passing! Thanks for trying to help me!