CHARACTER FUNCTION IN SQL

•UPPER (column / expr)
•UPPER (‘Oracle’) = ‘ORACLE’
•LOWER (column / expr)
•LOWER (‘ORACLE’) = ‘oracle’
•INITCAP (column / expr)
•INITCAP (‘oRacLe’) = ‘Oracle’
•CONCAT (column / expr, column / expr)
•CONCAT (‘Ram’, ‘Chandra’) = ‘Ram Chandra’
•SUBSTR (column / expr, x, y)
•SUBSTR (‘Database Systems’, 5, 4) = ‘base’
5: Starting character position.
4: Number of characters to be extracted.


•INSTR (column / expr, c)
–Returns position of the supplied character
– INSTR (‘abcdefgh’, ‘e’) = 5
•TRIM (‘c’ FROM column / expr)
–Removes leading and trailing characters.
– TRIM (‘ ’ FROM ‘ alok’) = ‘alok’
•LENGTH (column / expr)
– Returns number of characters.
–LENGTH (‘IBAT’) = 4
•LPAD (column / expr, n, ‘str’)
– Pads values with ‘str’ to the left to total width of n
–PAD (salary, 9, ‘*’) = ***243000

No comments: