Thursday, October 23, 2008

Character Functions Returning Number Values

Character Functions Returning Number Values:

ASCII returns the decimal representation of the char given.
EX:SELECT ASCII('Q') FROM DUAL;Output is 81

INSTR function search for a given substring in a string.It returns an integer indicating the position of the first occurence of the character in string.
EX:SELECT INSTR('My Home Is Good','o',4,2) FROM DUAL;Output is 9.

In the above example searches the string 'My Home is good',beginning with the third character,for the string "O". It returns the position in 'My Home is good' at which the second occurrence of "o" begins.

LENGTH functions return the length of the string given.
EX:SELECT LENGTH('Home') from dual;Output is 4.

No comments:

Post a Comment

Disclaimer