我有以下想執行的PL/SQL語句。來自Oracle的返回值變量
DECLARE
V_REFNUM NUMBER := 0;
BEGIN
SELECT NEXT_NUMBER_VALUE INTO V_REFNUM FROM SETTINGS WHERE SETTINGS_ID = 1;
V_REFNUM := (V_REFNUM + 1);
-- SELECT V_REFNUM FROM DUAL
END;
問題是,我似乎無法得到變量返回形式我。這工作正常,在T-SQL在我的發言是這樣
DECLARE @refNum int = 0
SELECT @refNum = NEXT_NUMBER_VALUE FROM SETTINGS WHERE SETTINGS_ID = 1
SET @refNum = (@refNum + 1)
SELECT @refNum
這似乎是一個很簡單的事Microsoft SQL Server上。爲什麼這很難找出甲骨文?誰能幫忙?
您的選擇是否總是返回一個值?如何確定是你,這是不扔發現異常 – Shankar
因爲這個數據是建立在安裝的時候沒有數據,然後遞增 –