The document outlines the objectives and functions covered in Chapter 10 of Oracle 12c: SQL, focusing on single-row functions for manipulating character strings, numeric data, and dates. It details various functions such as UPPER, LOWER, SUBSTR, ROUND, and TO_DATE, along with their applications. Additionally, it discusses the use of regular expressions, handling NULL values, and the DUAL table for testing functions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
11 views51 pages
Chapter 10
The document outlines the objectives and functions covered in Chapter 10 of Oracle 12c: SQL, focusing on single-row functions for manipulating character strings, numeric data, and dates. It details various functions such as UPPER, LOWER, SUBSTR, ROUND, and TO_DATE, along with their applications. Additionally, it discusses the use of regular expressions, handling NULL values, and the DUAL table for testing functions.
Objectives • Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character strings • Manipulate character substrings with the SUBSTR and INSTR functions • Nest functions inside other functions • Determine the length of a character string using the LENGTH function • Use the LPAD and RPAD functions to pad a string to a certain width • Use the LTRIM and RTRIM functions to remove specific characters strings • Substitute character string values with the REPLACE and TRANSLATE functions
and TRUNC functions • Return the remainder only of a division operation using the MOD function • Use the ABS function to set numeric values as positive • Use the POWER function to raise a number to a specified power • Calculate the number of months between two dates using the MONTHS_BETWEEN function • Manipulate date data using the ADD_MONTHS, NEXT_DAY, LAST_DAY, and TO_DATE functions
Objectives (continued) • Differentiate between CURRENT_DATE and SYSDATE values • Extend pattern matching capabilities with regular expressions • Identify and correct problems associated with calculations involving NULL values using the NVL function • Display dates and numbers in a specific format with the TO_CHAR function • Perform condition processing similar to an IF statement with the DECODE function • Use the SOUNDEX function to identify character phonetics • Convert string values to numeric with the TO_NUMBER function • Use the DUAL table to test functions
Terminology • Function – predefined block of code that accepts arguments • Single-row function – returns one row of results for each record processed • Multiple-row function – returns one result per group of data processed (covered in the next chapter)
Case Conversion Functions • Case conversion functions alter the case of data stored in a column or character string – Used in a SELECT clause, they alter the appearance of the data in the results – Used in a WHERE clause, they alter the value for comparison
UPPER Function • Used to convert characters to uppercase letters • It can be used in the same way as the LOWER function – To affect the display of characters, it is used in a SELECT clause – To modify the case of characters for a search condition, it is used in a WHERE clause • The syntax for the UPPER function is UPPER(c) – Where c is the character string or field to be converted into uppercase characters
Summary (continued) • The TO_CHAR function lets a user present numeric data and dates in a specific format • The DECODE function allows an action to be taken to be determined by a specific value • The searched CASE expression enables you to evaluate conditions to determine the resulting value • The SOUNDEX function looks for records based on the phonetic representation of characters • The DUAL table can be helpful when testing functions