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'
No comments:
Post a Comment