Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Date functions aren't really standard in SQL, so it's a question of what RDBMS you're using. For Sybase and SQL server, you could use datediff(yy, @date1, @date2).

    Looks like you've got Oracle. In which case I think if you used months, you wouldn't have to worry about leap years:

    months_between(date1, date2)/12

    But I haven't tested that.

    As usual, Ask Tom has a nice answer: an implementation of DateDiff in PL/SQL []. Looks nice and tidy too.