Am using Oracle 19c database
Below is my string value
variable B1 varchar2(60)
exec :B1:='(199,''TEST121''),(156,''TEST''),(1561,''TEST99'')';
I want the output as
| ID | NAME |
| -------- | -------------- |
| 199| TEST121 |
| 156| TEST |
| 1561| TEST99 |
select regexp_substr(regexp_substr(:b1,'[^A-Z+0-9][0-9]+', 1,level),'[0-9]+') as id , regexp_substr(:b1,'[A-Z]+[0-9]', 1,level) as name from dual connect by regexp_substr(:b1,'[0-9]', 1,level) is not null;
This query is only giving output for string values ending with digits.
Here's one option:
What does it do?
),(
with#
(to get a simpler separator); remove leading and trailing bracketsID
andNAME
out of each row