From the course: Oracle Database 12c: Basic SQL
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using TO_CHAR to filter DATE values - Oracle Database Tutorial
From the course: Oracle Database 12c: Basic SQL
Using TO_CHAR to filter DATE values
- [Instructor] We can also use Oracle to_char sequel function when filtering for specific date values. Let's start by selecting the first name and hire date columns from our employees table. And let's assume that we want to see only employees who have been hired in the month of January. So in order to accomplish that using the to_char function you can just type where to_char, specify the hire date column and a MON format math inside quotation marks. So we essentially extract only the month from the hire date column. Equals, and inside quotation marks uppercase JAN signifying January. Running this query will show me only employees who have been hired during January. Keep in mind that if we change the format math from MON which returns the month name as a three letter code, so J A N for January for example to MM which returns two digits signifying the month numbers or 01 for January. And run the query as is. The query will return zero records. We'll also have to change JAN to 01 in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Introduction to functions1m 39s
-
Using SUBSTRING, LENGTH, and CONCAT2m 50s
-
Using LENGTH1m 4s
-
Using CONCAT4m 48s
-
Using LOWER and UPPER2m 44s
-
Using INSTR4m 32s
-
Using RPAD and LPAD3m 31s
-
Using TO_CHAR to convert numbers1m 34s
-
Using TO_CHAR to format DATE values2m 59s
-
Using TO_CHAR to filter DATE values1m 57s
-
The special Oracle DUAL table1m 18s
-
Using ROUND1m 15s
-
Using TRUNC1m 36s
-
Using SYSDATE1m 59s
-
Using SYSTIMESTAMP1m 37s
-
Using MONTHS_BETWEEN3m 2s
-
Using ADD_MONTHS1m 17s
-
-
-
-
-
-