How to retrive the last word in the Sentence in Teradata ?

Database
gkk
Enthusiast

How to retrive the last word in the Sentence in Teradata ?

Hai...
i am new to Teradata . my objective is to retrieve the last word in the sentence with out hard coding . i got the sql query in Oracle but don't know how to accomplish the same in Teradata Sql. i am posting the Oracle Sql systax for retrieving the last word in the sentence .
SQL>
SELECT SUBSTR(sentence_column, INSTR(sentence_column,' ',-1) + 1)
FROM Text_table;

column : sentence_column, data type : varchar2(100)
Eg data :
1 All information must be store in table as data values
2 All views that are theoretically updateable are also updateable by the system.
3 The integrity constraints should store in the system catalog or in the database.

etc...

O/P : values
system
database

I need it in Teradata Sql query , please kindly help me . Thanks in Advance .

Thanks & Regards ,
Kiran

Tags (1)
4 REPLIES
WAQ
Enthusiast

Re: How to retrive the last word in the Sentence in Teradata ?

INSTR equilant in Teradata is INDEX or POSITION.
have a look at this:
http://forums.teradata.com/forum/database/finding-the-index-of-last-occurrence
gkk
Enthusiast

Re: How to retrive the last word in the Sentence in Teradata ?

Hai , Either of the two teradata functions INDEX and POSITION Syntax has NO negative integer option to search for a sub sting from back of the main string .

Thanks for responding ,
Kiran
gkk
Enthusiast

Re: How to retrive the last word in the Sentence in Teradata ?

Hai Teradata Professionals,
Please someone solve my doubt i am waiting from many days .

Thanking you all in advance,
kiran
Enthusiast

Re: How to retrive the last word in the Sentence in Teradata ?

Take a look at the link WAQ provided. This tells you how to use the Oracle UDF's to find it in Teradata.