Home » SQL & PL/SQL » SQL & PL/SQL » How do I...?
How do I...? [message #188669] Mon, 21 August 2006 03:08 Go to next message
Messages: 21
Registered: August 2006
Junior Member
Having a varchar2 variable with value 20060125123030 (in the format of YYYYMMDDHHMMSS), how do I know if this value is +- X minutes from the current system time?

Don't know how to write this code. Can anyone point me in a direction(s)?
Re: How do I...? [message #188671 is a reply to message #188669] Mon, 21 August 2006 03:12 Go to previous messageGo to next message
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You need to convert the format mask th YYYYMMDDHHMISS
You may alsoe want to convert the HH to HH24.

You should also store dates in DATE types, not strings.

  1  SELECT abs(sysdate - to_Date('20060125123030', 'YYYYMMDDHHMISS'))*(24*60) minutes_from_sysdate
  2* FROM dual
SQL> /

Re: How do I...? [message #188674 is a reply to message #188669] Mon, 21 August 2006 03:17 Go to previous message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
Another solution:

  2                           SYSDATE),
  3                 SYSDATE,
  4                 '-',
  5                 '+')
  6    FROM dual;

Previous Topic: Conversion of VARCHAR2 to XMLTYPE possible?
Next Topic: n number of CREATE statements in single procedure
Goto Forum:

Current Time: Sun Oct 23 21:02:46 CDT 2016

Total time taken to generate the page: 0.15628 seconds