0
DECLARE
thisyear number(4,0);
BEGIN
thisyear := year(getdate());
END;
DECLARE
thisyear number(4,0);
BEGIN
thisyear := year(getdate());
END;
可以使用EXTRACT
功能:
DECLARE
thisyear number(4,0);
BEGIN
thisyear := extract(year from sysdate);
END;
或者,你可以使用TO_CHAR
与格式字符串:
DECLARE
thisyear number(4,0);
BEGIN
thisyear := to_number(to_char(sysdate, 'YYYY'));
END;
这SQLdevloper是工作,但在表单中出现错误。 “期待下列其中一项时,从符号”FROM“中得到......()* @ $%&.....” – Hussain
@Hussain - 增加了另一种方法。请参阅最新的答案。 – GurV
非常感谢@Gurwinder – Hussain