Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8788353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:07:32+00:00 2026-06-13T22:07:32+00:00

For getting current date i use this.. select extract(year from sysdate) from dual; For

  • 0

For getting current date i use this..

select extract(year from sysdate) from dual;

For getting the date that my database hold i use this..

select extract(year from startdate) from staff;

But now i am trying to update a field call serviceYears inside staff, by using

current year - year of start date

to get the amount of years the staff have committed to work. how do i achieve it..

i am using oracle sql

Thanks!

I tried to use

SQL> select dual.sysdate-staff.startdatefrom dual,staff;

select dual.sysdate-staff.startdatefrom from dual,staff
            *
ERROR at line 1:
ORA-01747: invalid user.table.column, table.column, or column specification

I also tried

select SYSDATE-to_date('01-jan-2007','dd-mon-yyyy') from dual;

But it return me
SYSDATE-TO_DATE('01-JAN-2007','DD-MON-YYYY')
--------------------------------------------
                                  2136.93719

How do i just get the year?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:07:33+00:00Added an answer on June 13, 2026 at 10:07 pm

    You can do this

    UPDATE STAFF
    SET serviceYear = ROUND((sysdate - startDate)/365)
    

    Ex:

    select ROUND((sysdate - to_date('01-JAN-2007','DD-MON-YYYY'))/365) 
    from dual; -- returns 6
    
    
    select ROUND((sysdate - to_date('01-JAN-2005','DD-MON-YYYY'))/365,2) 
    from dual; -- returns 7.85
    

    Updated:

    SELECT 
    FLOOR((SYSDATE - TO_DATE('01-JAN-2005','DD-MON-YYYY'))/365) YEARDOWN,
    CEIL((SYSDATE - TO_DATE('01-JAN-2005','DD-MON-YYYY'))/365) YearUP
    FROM DUAL;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this script $(date +%Y-%m-01) -$i months +%Y-%m)-01 that works great for getting
Is there an API that works for pre OS 3.2 for getting the current
i keep getting this error, The current value 'String.Empty' type is not compatible with
Can anyone help me getting started with this? We have a current keygen for
i want to generate current date and time in a format like this Mon,
In my application i have edit text that will show the current date and
I have a MySQL database , with a column that is date type DATETIME
I'm getting the date from an sms message in android as a time stamp
I'm getting the current date/time using [NSDate date] . The value returned is an
I want to calculate whats the date 20 yrs back from current time in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.