我有一个PreparedStatement和CallableStatement:
String sql = "INSERT INTO parcels (cadastr,the_geom,status_id) VALUES(?,PolygonFromText(?, 4326),?)";
PreparedStatement stmt = ce.prepareStatement(sql);
stmt.setString(1, ts.getPackage().getSpecifyParcels().getExistParcel()
.get(0).getCadastralNumber());
stmt.setString(2, WKT);
// stmt.setString(3, deleted);
stmt.setInt(3, status_id);
stmt.execute();
stmt.close();
java.sql.CallableStatement proc1 = ce
.prepareCall("{call insert_into_wgs()}");
proc1.execute();
proc1.close();
可以在一个语句中执行此查询和函数insert_into_wgs()
吗?
答案 0 :(得分:1)
使用RETURNING关键字!
INSERT INTO parcels (cadastr,the_geom,status_id)
VALUES (?, PolygonFromText(?, 4326), ?)
RETURNING insert_into_wgs()