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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ORACLE SQL - Combing SYSDATE and WHERE STATEMENT

I have this query that produces what I want within a year. All the terms for the current year. I also want to add another statement where, when the month of December is current I want now the future term that contain 2025. I made a separate query identifying those terms but not sure on how I can “mesh” them together to produce the current terms but switch to future term when the month of December is current. Thanks in advance

Query#1
SELECT DISTINCT AL1.academic_period AS "TERM" 
FROM odsmgr.MST_GENERAL_STUDENT  AL1 
WHERE (to_number(substr(AL1.academic_period, 1, 4)) = EXTRACT(YEAR FROM SYSDATE));

TERM
202480
202410
202413
202460
202416

Quer#2
SELECT DISTINCT al1.academic_period
FROM odsmgr.mst_general_student AL1
WHERE (to_number(substr(AL1.academic_period, 1, 4)) = EXTRACT(YEAR FROM SYSDATE) + 1);


TERM
202510
202560
202580
This post has been answered by Solomon Yakobson on Feb 6 2024
Jump to Answer
Comments
Post Details
Added on Feb 5 2024
6 comments
298 views