ORA-01422: exact fetch returns more than requested number of rows
CREATE OR REPLACE PROCEDURE TP_TID_GID (tid in number) AS
V_PARAM_GROUP_ID NUMBER(20);
V_PARENT_PARAM_GROUP_ID NUMBER(20);
EXEC_TXT VARCHAR2(2000);
CURSOR C1
IS
select distinct param_group_id from TEST_PARAMETER_GROUP WHERE test_instance_id=tid;
BEGIN
FOR C1REC IN C1
LOOP
EXEC_TXT := 'SELECT PARAM_GROUP_ID, PARENT_PARAM_GROUP_ID FROM (SELECT * FROM TEST_PARAMETER_GROUP START WITH PARENT_PARAM_GROUP_ID=' || C1REC.param_group_id || ' CONNECT BY PRIOR PARAM_GROUP_ID=PARENT_PARAM_GROUP_ID ORDER BY PARENT_PARAM_GROUP_ID ASC) VT_PCT WHERE test_instance_id=' || tid;