Questions tagged [sysdate]

SYSDATE is an Oracle specific SQL function which serves to give the current date and time of the database. Use for questions related to the SYSDATE function.

SYSDATE returns the current date and time set for the database. The return type is DATE. It can be used as follow to get the current date/time:

SELECT SYSDATE
FROM dual;

sample result

SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY HH24:MI:SS') AS DATE_TIME
FROM DUAL;

sample result

Sources:

153 questions
54
votes
4 answers

Check if current date is between two dates Oracle SQL

I would like to select 1 if current date falls between 2 dates through Oracle SQL. I wrote an SQL after reading through other…
Avinesh Kumar
  • 1,389
  • 2
  • 17
  • 26
53
votes
4 answers

How can I use DB side default value while use Hibernate save?

I have a column in DB with default value as sysdate. I'm looking for a way to get that default value inserted while I'm not giving anything to corresponding property on app side. By the way, I'm using annotation-based configuration. Any advice?
BruceCui
  • 731
  • 1
  • 6
  • 11
9
votes
2 answers

Oracle subtracting days and minutes

I want to subtract "X" days and "X" minutes from sysdate, where the days and minutes are an integer as input parameter. For instance, 10 days and 5 minutes. I found many examples to subtract either minutes or hours but not a combination of days and…
Carlos
  • 456
  • 2
  • 7
  • 21
4
votes
4 answers

Using SYSDATE() without DUAL table

I'm surprised this question hasn't been asked. I must be missing something very obvious here, and I'm prepared for all the down votes and the 3 second answer. In MSSQL you're able to call GETDATE() without having to depend on a database table but in…
jgozal
  • 1,480
  • 6
  • 22
  • 43
4
votes
1 answer

How to fix "ORA-01801: date format is too long for internal buffer" error in SQL in Oracle

I am working on an assignment where I need to display the system date in a very specific way in SQL. The form is supposed to be as follows: Day of the week with just the first letter capitalized, the month number in Roman Numerals (capitalized), the…
user147219
  • 355
  • 1
  • 4
  • 13
4
votes
2 answers

sysdate and dbtimezone different in Oracle Database

With this query: select sysdate from dual; the result is: 27-09-2018 07:50:50 -- this UK time with : Select dbtimezone from dual; output: +10:00 I want the sysdate to be of the same timezone of dbtimezone I was trying to do it with alter database…
User123
  • 1,498
  • 2
  • 12
  • 26
4
votes
3 answers

Append sysdate to a table name in Oracle

I need to append SYSDATE while creating a table in Oracle. Please let me know if there is a direct way of doing it (Using only SQL) or I have to use PL/SQL for the same. E.g. If table name is ABC, I need to create table as ABC_20130416. Let me know…
Sid
  • 195
  • 1
  • 4
  • 11
4
votes
3 answers

to_date function with sysdate

select TO_CHAR(to_date(sysdate, 'DD-MON-YYYY'), 'DAY') FROM DUAL; When I run this query the output was : SUNDAY. But we know today is Tuesday(1-1-2013). And then changed the query as select TO_CHAR(to_date('01-JAN-2013', 'DD-MON-YYYY'), 'DAY')…
3
votes
0 answers

how to use libfaketime to setting system date

I use docker container to run tomcat. Now I want to modify system date to use date -s '2012-12-25', but can not have privilege. So I use libfaketime to faketime,as below $LD_PRELOAD=/usr/local/lib/faketime/libfaketime.so.1 FAKETIME="+1d" but only…
3
votes
3 answers

How to convert sysdate to UTC time in oracle

I am having a query to subtract a date from the sysdate. However the date object I have is in UTC but sysdate doesn't give me UTC time. How to I convert sysdate to give me date in UTC. I have already tried using sys_extract_utc select…
Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400
3
votes
2 answers

Getting last day of previous month in HIVE query

I am new to HIVE and I need to get the last day of previous month from a table in hive. SQL equivalent --- select last_day(add_months(sysdate,-1)) from dual; I could only get previous day in the internet which is something like select * from…
3
votes
1 answer

Oracle sysdate is not equal to a stored date

Database: Oracle Simplified version: Table T has a column: D ( DATE type ) Now the table is empty. INSERT INTO T (D) VALUES (sysdate); Now the table has one row containing 22-AUG-14. Why is the following WHERE clause false ? SELECT * FROM T …
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
2
votes
1 answer

Oracle SQL, Date and Time in GMT (UTC)

This coding is giving the correct answer for SYSDATE select round((SYSDATE - date '1970-01-01')*24*60*60) from dual; 1662482430 (seconds) I need to return the date / time in GMT/UTC. I need help with the syntax. Thanks, Pete
Pete
  • 37
  • 4
2
votes
1 answer

Comparing date type column with a timestamp column

I have a table say demo with three columns create table demo(demo_id number, created_date date, mod_date systimestamp(6) ); my requirement is to return a refcursor with two columns 1. Demo_id…
2
votes
3 answers

SQL: How to data of current date from timestamp field in oracle?

How to data of current date from timestamp field in oracle? select jobstatus0_.JOBNAME as JOBNAME1_21_, jobstatus0_.STARTDATE as STARTDATE2_21_, jobstatus0_.ENDDATE as ENDDATE3_21_, jobstatus0_.REMARKS as REMARKS4_21_, jobstatus0_.STATUS as…
fatherazrael
  • 5,511
  • 16
  • 71
  • 155
1
2 3
10 11