Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getting year from sysdate question

Roger25Apr 2 2009 — edited Apr 2 2009
Hello guys,

i have a table SCHOOLMATES, a table SCHOOL_YEAR, and a table SEMESTER. in the 2nd table, i store the school years like 2008-2009, 2009-2010, and so on. for that i used a varchar2 column(also, added check constraint to this).
my first question is that is it recommended to store like this, or is better to have 2 columns, start_year and end_year, both of them being date columns(not varchar). if so, nevermind what i store at day, month parts, i'm interested only in year.

and in big lines, my SEMESTER table looks like:

id int(pk),
school_year_id int references SCHOOL_YEAR(id), -- to know which school year corresponds to a semester
semester int,
start_date date,
end_date date

so i wanna know, the current year and semester for a schoolmate. i think is possible with date manipulation, using also sysdate, but don't know exactly how..
Can you help me please?

Best regards,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2009
Added on Apr 2 2009
10 comments
4,274 views