ResultSet结果集如何直接插入只知道表名的表(要插入的表的字段类型与结果集的字段类型完全对应,但不知道具体类型)
例如:
select table1.colName1,table1.colName2,table2.colName3 from table1,table2 where table1.colName1=table2.colName1
jdbc查询该sql返回ResultSet已经知道
要把该ResultSet直接插入table3,table3只有三个字段colName1,colName2,colName3 且类型一致。在线等。
例如:
select table1.colName1,table1.colName2,table2.colName3 from table1,table2 where table1.colName1=table2.colName1
jdbc查询该sql返回ResultSet已经知道
要把该ResultSet直接插入table3,table3只有三个字段colName1,colName2,colName3 且类型一致。在线等。
可以获取每项数据,另外用一个SQL语句插入,
或者直接用一句SQL语句完成select与insert操作。insert into table3 select table1.colName1,table1.colName2,table2.colName3 from table1,table2 where table1.colName1=table2.colName1;
难道只有组织数据以后再插入吗,数据格式已经是完全一样的了,除非必须否则不想这么做。