UPDATE FILE_BANK_TRANS_HELP T1 JOIN FILE_BANK_TRANS T2 ON T2.REFER_NO_FULL = T1.TR_XSERNO AND T1.TR_DATE = '#{BATCH_WORK_DATE}' SET T1.TERM_ID = T2.TERM_ID, T1.CARD_NO = T2.CARD_NO;转换为Oracle语句
时间: 2023-08-02 09:10:47 浏览: 96
FILE_TRANS_SOCKET.rar_FILE_TRANS_SOCKET_PowerBuilder_socket_传输
在Oracle中,可以使用类似如下的语法来将MySQL中的语句转换为等价的Oracle语句:
```
MERGE INTO FILE_BANK_TRANS_HELP T1
USING (
SELECT T2.TERM_ID, T2.CARD_NO, T2.REFER_NO_FULL
FROM FILE_BANK_TRANS T2
WHERE T2.REFER_NO_FULL IN (
SELECT TR_XSERNO FROM FILE_BANK_TRANS_HELP WHERE TR_DATE = '#{BATCH_WORK_DATE}'
)
) T2
ON (T2.REFER_NO_FULL = T1.TR_XSERNO)
WHEN MATCHED THEN UPDATE SET T1.TERM_ID = T2.TERM_ID, T1.CARD_NO = T2.CARD_NO;
```
注意,在Oracle中,在使用MERGE INTO语法时必须指定WHEN MATCHED或WHEN NOT MATCHED子句。在这里,我们使用WHEN MATCHED子句来更新已经匹配的行。另外,需要注意的是,Oracle中不支持MySQL的JOIN语法,因此我们使用了子查询来代替JOIN子句。
阅读全文