我有一個表,其中包含一個字段BEGDATE,這是一個varchar2幷包含值,如「20170405142030」。我試圖創建一個包含兩個字段的視圖。 第一個領域是一年(例如:2017),第二個領域是學期。該學期是以月份爲基礎的。查看基於學期和年份
when the month is : 01 or 02 or 03 or 04 --> then semester contains value:sem1
when the month is : 05 or 06 or 07 or 08 --> then semester contains value:sem2
when the month is : 09 or 10 or 11 or 12 --> then semester contains value:sem3.
我有這個簡單的查詢現在:
CREATE VIEW V_EMP AS
SELECT SUBSTR(BEGDATE, 1, 4) AS ANNEE,SUBSTR(BEGDATE, 5, 2)
FROM EMP
,但我不知道如何單獨多年,並涉及基礎上,今年的學期。 請幫忙嗎?
也許你應該更好地稱它[三個月](https://en.wikipedia.org/wiki/Trimester) –