1
MERGE INTO A
USING (
SELECT B_1,B_2,B_3,SUM(B_4)
FROM B
GROUP BY B_1,B_2,B_3) srt
ON (
A.A_1 = B.B_1
AND NVL (A.A_2, 0) =
NVL (B.B_2, 0)
AND NVL (A.A_3, ' ') =
NVL (B.B_3, ' '))
WHEN MATCHED
THEN 'DML STATEMENT';
以上拋出一個錯誤NVL(EXPR1,0)VS NVL(EXPR1,-1)
Caused by: java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-30926: unable to get a stable set of rows in the source tables
但是當你用下面替換NVL上面的查詢(EXPR,-1),它的工作原理,而不任何錯誤。人們可以預見我無法看到的任何理由?
MERGE INTO A
USING (
SELECT B_1,B_2,B_3,SUM(B_4)
FROM B
GROUP BY B_1,B_2,B_3) srt
ON (
A.A_1 = B.B_1
AND NVL (A.A_2, -1) =
NVL (B.B_2, -1)
AND NVL (A.A_3, ' ') =
NVL (B.B_3, ' '))
WHEN MATCHED
THEN 'DML STATEMENT';
這很奇怪。什麼是列的數據類型?你能顯示兩個表的CREATE TABLE語句嗎?你有沒有嘗試過這種外部的Java? –
* _1和* _3是varchar,* _2是數字。我在從java程序調用的存儲過程中嘗試了這一點。 –
這是一個固定的聲明?還是動態SQL? –