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 SYSDATE - Oracle Database Tutorial
From the course: Oracle Database 12c: Basic SQL
Using SYSDATE
- Oracle has a special, built-in function called sysdate. Which allows us to retrieve and format the current date and time of the Oracle database server. Let's see it in action. Let's start with the simplest example. Select sysdate from dual. Running this query will display the current date and/or time depending on how my session NLS or date/time parameters have been configured. We can override the default values and get a sysdate output that is formatted to our specific requirement using a combination of the to_char functions with sysdate. So let's add to_char to our query, specifying sysdate as the first parameter for the function, comma and a formatting mask, such as: day day/MON/year year year year so that we'll get 4 digits representing the year, HH24:MI:SS, which signifies a time-formatting mask. Running this query again, will show us the current date and time. Running the query again, an additional time, will show us an updated value. We can, of course, change the formatting…
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
-
(Locked)
Using SUBSTRING, LENGTH, and CONCAT2m 50s
-
(Locked)
Using LENGTH1m 4s
-
(Locked)
Using CONCAT4m 48s
-
(Locked)
Using LOWER and UPPER2m 44s
-
(Locked)
Using INSTR4m 32s
-
(Locked)
Using RPAD and LPAD3m 31s
-
(Locked)
Using TO_CHAR to convert numbers1m 34s
-
(Locked)
Using TO_CHAR to format DATE values2m 59s
-
(Locked)
Using TO_CHAR to filter DATE values1m 57s
-
(Locked)
The special Oracle DUAL table1m 18s
-
(Locked)
Using ROUND1m 15s
-
(Locked)
Using TRUNC1m 36s
-
(Locked)
Using SYSDATE1m 59s
-
(Locked)
Using SYSTIMESTAMP1m 37s
-
(Locked)
Using MONTHS_BETWEEN3m 2s
-
(Locked)
Using ADD_MONTHS1m 17s
-
-
-
-
-
-