【发布时间】:2017-09-22 12:15:07
【问题描述】:
假设我有两个表,其列 Col1、Col2 和 Col3 分别是 VARCHAR2、CLOB 和 NUMBER 类型。
如何获得这些表的差异? (即表B中存在但表A中不存在的记录列表)
Table A:
╔═══════╦═════════════════╦══════╗
║ Col1 ║ Col2 ║ Col3 ║
╠═══════╬═════════════════╬══════╣
║ P1111 ║ some_long_text1 ║ 1234 ║
║ P1111 ║ some_long_text1 ║ 1233 ║
║ P1111 ║ some_long_text2 ║ 1233 ║
╚═══════╩═════════════════╩══════╝
Table B:
╔═══════╦═════════════════╦══════╗
║ Col1 ║ Col2 ║ Col3 ║
╠═══════╬═════════════════╬══════╣
║ P1111 ║ some_long_text1 ║ 1234 ║
║ P1111 ║ some_long_text1 ║ 1235 ║
║ P1112 ║ some_long_text2 ║ 1233 ║
╚═══════╩═════════════════╩══════╝
Expected results:
╔═══════╦═════════════════╦══════╗
║ Col1 ║ Col2 ║ Col3 ║
╠═══════╬═════════════════╬══════╣
║ P1111 ║ some_long_text1 ║ 1235 ║
║ P1112 ║ some_long_text2 ║ 1233 ║
╚═══════╩═════════════════╩══════╝
【问题讨论】:
-
您可以查看
MINUS运算符 - LINK。不确定 CLOB 变量会如何表现。 -
MINUS不适用于LOB类型。