We Recommend

SQL Cookbook SQL Cookbook
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.


Posted By

rengber on 09/25/07


Tagged

Oracle PLSQL DateTime


Versions (?)


Simple Technique to Subtract Years from an Oracle Date


Published in: SQL 


  1. to_number(to_char(sysdate,'YYYYMMDD'),'99999999')-50000)
  2. --subtracts 5 years from a date.
  3. -- 20070924
  4. -- -50000
  5. -- =20020924

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: xer0x on January 24, 2008

--Yet another method to do the same thing: sysdate - interval '5' year

i find this a little easier to read..

You need to login to post a comment.