"import java.sql.Timestamp
import java.math.BigDecimal
import java.sql.PreparedStatement
import java.sql.ResultSet
import org.compiere.util.DB
import org.compiere.model.MLocation
String sql = "select distinct(ct_addr1) from adempiere.z1_pcust";
PreparedStatement pstmt = DB.prepareStatement(sql, A_TrxName);
// pstmt.setInt(1, A_AD_Client_ID);
ResultSet rs = pstmt.executeQuery();
// 只試作 10筆
while (rs.next()) {
String address1 = rs.getString("ct_addr1");
MLocation location = new MLocation(A_Ctx, 0, A_TrxName);
location.setAD_Client_ID (1000000);
location.setC_Country_ID (316);
location.setAddress1 (address1);
location.save();
}
rs.close();
pstmt.close();
result="""
沒有留言:
張貼留言