You are on page 1of 2

STRING Functions

Implement the following queries on strings using the Dual table:


1) Display a string in Lower Case
2) Display a string in Upper Case
3) Display a string in Camel Case
4)Show the ASCII value of a character in small case
5) Show the ASCII value of a character in upper case
6)Find the position where the character c appears in the word coChin
7) Find the position where the character C appears in the word coChin
8) Find the position where the second instance of the character c appears in the word cochin
9) Replace the letter c in the string cochin by the number 2
10)Replace the letters c and n by the numbers 5 and 8 respectively in the string cochin
11)Find the length of a string
12)Add characters in front of a string
13) Add characters at the back of a string

Maths Functions:
14)Truncate a decimal number up to one place
15)Display the floor value of a decimal number
16)Display the ceiling value of a decimal number
17)Find the absolute value of a number
18)Find the greatest number from a group of numbers
19)Calculate the square root of a number
20)Round up a decimal number
21)Find the power of a number
22)Find the modulus of a number
23)Find the exponential value of a number
24) Find the variant value of a number
Output: Math functions
1. select trunc(125.689,1)from dual
1. select lower ( CAT ) from dual 2. select trunc(125.689)from dual
2. select upper(rat) from dual 3. select floor(123.56) from dual
4. select ceil(123.56) from dual
3. select Initcap(rat) from dual 5. select abs(-19) from dual
6. select greatest(19,46,13,78,46,12,78) from
4.select ascii(a) from dual
dual
5. select ascii(A) from dual 7. select sqrt(36) from dual
8. select round(15.56,1) from dual
6. select instr('coChin','c') from dual 9. select round(15.56) from dual
10. select power(10,4) from dual
7. select instr('coChin','C') from dual
11. select mod(8,3) from dual
8. select instr('cochin','c',2) from dual 12. select exp(5) from dual
13. select variance(5) from emp
9. select replace('cochin','c',2) from dual 14. select concat(in,out) from dual
15. select cos(0) from dual
10. select translate('cochin','cn',58) from dual
16. select sin(0) from dual
11. select length('koyel') name from dual 17. select tan(0) from dual
18. select log(10,2) from dual
12. select lpad('rat',10,'#')from dual 19. select sign(-1) from dual
20. select compose(unistr('\0303')) from dual
13. select rpad('cat',10,'#')from dual
21. select ltrim(nisha,n) from dual
Math functions 22. select rtrim('nisha','a') from duals
23. select trim (leading x from xxxhanselxxx)
14. select trunc(125.689,1)from dual from dual
24. select trim (both 'x' from 'xxxhanselxxx')
15. select trunc(125.689,1)from dual
from dual
16. select floor(123.56) from dual 25. SELECT REVERSE('SQLServer') from dual
26. select CHR (65) from dual;
17. select ceil(123.56) from dual 27. select SIGN (-2.3) from dual
18. select abs(-19) from dual 28. select SUBSTR ('message', 4, 2) from dual

19. select greatest(19,46,13,78,46,12,78) from dual

20.select sqrt(36) from dual

21. select round(15.56,1) from dual

22. select power(10,4) from dual

23.select mod(8,3) from dual

24. select exp(5) from dual


25. select variance(5) from emp

You might also like