Dovberman
asked on
Limit a string to a specific substring
I have a function that iterates through rows of a cursor.
Each row of the cursor is a comma delimited set of string valaues.
"Name1, Name2, Name3, Name4"
"Name1, Name2"
"Name1, Name2, Name3"
I need to iterate through the rows as follows:
Most of this in in pseudocode.
intCommaCount := 0;
FOR cur_rec in CUR_CURSOR
LOOP
select cur_rec.PL into strLetterNameGroup from dual;
-- count the number of commas as intCommaCount
if intCommaCount >=3 --"Name1, Name2, Name3, Name4" ;
--strLetterNamesGroup needs to be "Name1, Name2, Name3 ;
-- extract the substring only to the character to the left of the 3rd comma
end if
end loop;
return strLetterNameGroup ;
END;
Each row of the cursor is a comma delimited set of string valaues.
"Name1, Name2, Name3, Name4"
"Name1, Name2"
"Name1, Name2, Name3"
I need to iterate through the rows as follows:
Most of this in in pseudocode.
intCommaCount := 0;
FOR cur_rec in CUR_CURSOR
LOOP
select cur_rec.PL into strLetterNameGroup from dual;
-- count the number of commas as intCommaCount
if intCommaCount >=3 --"Name1, Name2, Name3, Name4" ;
--strLetterNamesGroup needs to be "Name1, Name2, Name3 ;
-- extract the substring only to the character to the left of the 3rd comma
end if
end loop;
return strLetterNameGroup ;
END;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.