Using the SUBSTR() Oracle Function
Using SUBSTRING() in the SELECT clause
The SUBSTR() function is used to extract a character string from a
given starting position for a given length.
SELECT
SUBSTR(COURSE_DESIGNATER,6,3) as "Course number"
FROM COURSES
WHERE COURSE_DESIGNATER LIKE 'Excel%'
Format a column using SUBSTR() and LOWER() and UPPER() functions
It is possible to use the Oracle LOWER() and UPPER() functions in
conjunction with the SUBSTR() function to accomplish different types
of formatting.
SELECT
UPPER(SUBSTR(lastname,1,1)) || LOWER(SUBSTR(lastname,2,29)) AS "Lastname"
FROM Students
|