How to return today's date to a variable in Oracle

后端 未结 2 1179
独厮守ぢ
独厮守ぢ 2021-02-19 01:34

I want to do this:

DECLARE @today as smalldatetime
SELECT @today = GetDate()

But i need an oracle translation

2条回答
  •  青春惊慌失措
    2021-02-19 01:43

    While not a strict translation, I prefer the following construction in Oracle:

    v_today date; -- needs to go where variables are declared
    
    v_today := sysdate; -- used where code is run.
    

    Or even:

    v_today date := sysdate;
    

提交回复
热议问题