Difference between revisions of "CHARACTER BUILT IN FUNCTIONS"

From rbachwiki
Jump to navigation Jump to search
Line 6: Line 6:
  SELECT INITCAP(firstname), INITCAP(lastname)
  SELECT INITCAP(firstname), INITCAP(lastname)
   FROM customers
   FROM customers
   WHERE LOWER(lastname)  
   WHERE LOWER(lastname) = 'nelson'
==LENGTH()==
==LENGTH()==
  LENGTH('JOHN')=4
  LENGTH('JOHN')=4
==LPAD and RPAD==
SELECT firstname, LPAD(firstname, 12 ' '), LPAD(firstname, 12 '*')
FROM customers
WHERE firstname LIKE 'J%'


==SUBSTR()==
==SUBSTR()==

Revision as of 20:47, 6 November 2017

UPPER()

UPPER('john') = JOHN

LOWER()

LOWER('John')=john

INITCAP

SELECT INITCAP(firstname), INITCAP(lastname)
 FROM customers
  WHERE LOWER(lastname) = 'nelson'

LENGTH()

LENGTH('JOHN')=4

LPAD and RPAD

SELECT firstname, LPAD(firstname, 12 ' '), LPAD(firstname, 12 '*')
FROM customers
WHERE firstname LIKE 'J%'

SUBSTR()

RETURNS PART OF A STRING. START FROM THE 2ND POSITION AND RETURN 3 CHARACHTERS

SUBSTR('JAMES',2,3)=AME

DECODE()

RETURNS THE VALUE MATCHING THE CONDITION TAKE THE 20 IN THE FRONT AND RETURN THE CORRESPONDING STRING

DECODE(20,10,'TEN',20,'TWENTY',30,'THIRTY') = TWENTY

Back To Top- Home - Category