Instr equivalent in Teradata....

Database
N/A

Instr equivalent in Teradata....

Hi All,

Please help...

How to convert this...
select instr('E-CONS-001.1130','-',1,2) from tab1

to teradata Equivalent....

Thanks in advance...

Alem
5 REPLIES

Re: Instr equivalent in Teradata....

Hi,

Maybe with the INDEX or POSITION functions...
Junior Contributor

Re: Instr equivalent in Teradata....

Hi Alem,
instr('abc', 'a') -> position('a' in 'abc')
instr('abc', 'a', start) -> position('a' in substring('abc' from start))
instr('abc', 'a', start, occurence) -> ugly SQL using nested substring/position/case

But there's a UDF available from teradata.com for that function, that makes life easier...

Dieter
Enthusiast

Re: Instr equivalent in Teradata....

One more addition to what Dieter had highlighted.
Use position instead of index.
Index function has been retained for backword compatibility (I think).

Vinay
Enthusiast

Re: Instr equivalent in Teradata....

> But there's a UDF available from teradata.com for
> that function, that makes life easier...

> Dieter

Any suggestions as to where on teradata.com to find that UDF? I looked under "Oracle functions" and "string processing" and didn't see anything that sounded like this UDF?

NMadson
Junior Contributor

Re: Instr equivalent in Teradata....

It's one of the Oracle UDF's, have a second look :-)

Dieter