Oracle SYSDATE: Get Current Time in Oracle

In Oracle database, the SYSDATE function can be used to retrieve the current system time.

Here is an example query for retrieving the current time:

SELECT SYSDATE FROM DUAL;

This will return a result set that includes the current system date and time. Please note that DUAL is an Oracle system table which is a virtual table used for performing certain special operations.

You can also assign the current time to a variable for future use.

DECLARE
  current_time DATE;
BEGIN
  current_time := SYSDATE;
  DBMS_OUTPUT.PUT_LINE('Current Time: ' || TO_CHAR(current_time, 'YYYY-MM-DD HH24:MI:SS'));
END;

This example utilizes a PL/SQL block to declare a variable called current_time and assign the value of SYSDATE to it. Subsequently, it outputs the current time to the console using the DBMS_OUTPUT.PUT_LINE procedure.

bannerAds