SELECT
  LTRIM('  John Smith  ') 
  AS "LTRIM"
FROM DUAL;
SELECT
  RTRIM('  John Smith  ') 
  AS "RTRIM"
FROM DUAL;
SELECT
  TRIM('  John Smith  ') 
  AS "TRIM"
FROM DUAL;

SELECT
  LTRIM('$0019.99', '$0')
  AS "LTRIM2"
FROM DUAL;
SELECT
  TRIM('$' FROM '$0019.99')
  AS "TRIM2"
FROM DUAL;

SELECT
  LPAD('$19.99', 15)
  AS "LPAD1"
FROM DUAL;
SELECT
  LPAD('$2150.78', 15)
  AS "LPAD2"
FROM DUAL;
SELECT
  LPAD('$2150.78', 15, '.')
  AS "LPAD3"
FROM DUAL;
SELECT
  RPAD('John', 15)
  AS "RPAD1"
FROM DUAL;
SELECT
  RPAD('John', 15, '.')
  AS "RPAD2"
FROM DUAL;

SELECT
  LOWER('CA')
  AS "LOWER"
FROM DUAL;
SELECT
  UPPER('ca')
  AS "UPPER"
FROM DUAL;
SELECT
  INITCAP('john smith')
  AS "INITCAP"
FROM DUAL;
SELECT
  INITCAP('JOHN SMITH')
  AS "INITCAP2"
FROM DUAL;

SELECT
  NVL('Fresh Corn Records', 'Unknown Company Name')
  AS "NVL1"
FROM DUAL;
SELECT
  NVL(NULL, 'Unknown Company Name')
  AS "NVL2"
FROM DUAL;
SELECT
  NVL2('Fresh Corn Records', 'Known', 'Unknown')
  AS "NVL2_1"
FROM DUAL;
SELECT
  NVL2(NULL, 'Known', 'Unknown')
  AS "NVL2_2"
FROM DUAL;

SELECT
  SUBSTR('(559) 555-1212', 1, 5)
  AS "SUBSTR1"
FROM DUAL;
SELECT
  SUBSTR('(559) 555-1212', 7, 3)
  AS "SUBSTR2"
FROM DUAL;
SELECT
  SUBSTR('(559) 555-1212', 7)
  AS "SUBSTR3"
FROM DUAL;

SELECT
  INSTR('(559) 555-1212', ' ')
  AS "INSTR1"
FROM DUAL;
SELECT
  INSTR('559-555-1212', '-')
  AS "INSTR2"
FROM DUAL;
SELECT
  INSTR('559-555-1212', '-', 5)
  AS "INSTR3"
FROM DUAL;
SELECT
  INSTR('559-555-1212', '1212')
  AS "INSTR4"
FROM DUAL;

SELECT
  LENGTH('(559) 555-1212')
  AS "LENGTH1"
FROM DUAL;
SELECT
  LENGTH('  (559) 555-1212  ') 
  AS "LENGTH2"
FROM DUAL;

SELECT
  REPLACE('559-555-1212', '-', '.')
  AS "REPLACE1"
FROM DUAL;
SELECT
  REPLACE('559-555-1212', '-', '')
  AS "REPLACE2"
FROM DUAL;