Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

The POSITION Function

The POSITION function Returns the actual position of the character which occurs first. POSITION function is ANSI standard.

Teradata has an equivalent function called INDEX.

Both the POSITION and INDEX functions returns position of character's first occurrence in a string.

Examples for the POSITION function

SELECT POSITION( 'u' IN 'formula');  Displays Result as '5' 
SELECT POSITION( 'fo' IN 'formula'); Displays Result as '1' 
SELECT POSITION( 'e' IN 'formula');  Displays Result as '0'  

Examples for the INDEX function.

SELECT INDEX('formula', 'u');   Displays Result as '5'   
SELECT INDEX('formula', 'mu');  Displays Result as '4'   
SELECT INDEX('formula', 'e');   Displays Result as '0'   


This post first appeared on Teradata SQL Reference, please read the originial post: here

Share the post

The POSITION Function

×

Subscribe to Teradata Sql Reference

Get updates delivered right to your inbox!

Thank you for your subscription

×