oracle语句insertintoselect如何加后续插入条件?

如题所述

oracle中有批量插入语句insertintotableA(列1,列2,列3)select列1,列2fromtableB。现在问题是这样的,tableA有3列,而通过最后的select语句所能获得的列只有列1和列2。但列3是非空的,所以插入时必须填写。

A中有3例,B表中你只能获得2列,可以用常量占位解决

insertintotableA(列1,列2,列3)select列1,列2,常量 fromtableB

例:如下

insertintotableA(列1,列2,列3)select列1,列2,'123' fromtableB【字符串常量】
insertintotableA(列1,列2,列3)select列1,列2,123 fromtableB【数值常量】

温馨提示:答案为网友推荐,仅供参考
相似回答