sql - How do I get a value from a column comprising of multiple values separated by semicolon in teradata -
i have column mentioned below , need value of "cg" using teradata sql:
cat=0;cg=dbeca43414a0a5f16431a3e1ff446252;eb_trk=5 cat=20349;cat=15032;cat=9394;cg=578b0f761490a5f164 cat=9355;cat=15032;cg=975f70b714d0a2b143a56055fbfd cat=42428;cat=15032;cg=bceb58e114a0a5f165405b20f7f cat=9355;cat=15032;cg=d93dfc1714c0a5616b212801fd73
i believe regexp_substr()
in teradata same same function in oracle. following should work:
select regexp_substr(regexp_substr(col, 'cg=[^;]+', 1, 1), '[^=]+', 1, 2)
here sql fiddle oracle version.
Comments
Post a Comment