Java Reference
In-Depth Information
classification model. Once the output table is created, the number
of customers selected in this table is reported. This is reflected in
the following code:
1. public void exportSample() throws SQLException {
2.
// 1- Prepare the SQL statement and execute it
String lSQLQuery "create table " mOutputTableName " as select ";
3.
lSQLQuery mIdentifierColumnName;
4.
for (Iterator lColNamesIter mColumnNames.iterator();
5.
lColNamesIter.hasNext();) {
String lColName (String) lColNamesIter.next();
6.
lSQLQuery ", " lColName;
7.
8. }
9. lSQLQuery ", cast(NULL as INT) as RESPONSE";
10. lSQLQuery " from " mInputTableName;
11. lSQLQuery
" WHERE (mod(" mIdentifierColumnName ", 100)) " mRatio;
12. Statement lStatement mJDBCConnection.createStatement();
13. lStatement.executeQuery(lSQLQuery);
14. // 2- Now determine the exported number of records
15. String lSQLCountQuery " select count(*) from " mOutputTableName;
16. Statement lStatementCount mJDBCConnection.createStatement();
17. ResultSet lResultSetCount
lStatementCount.executeQuery(lSQLCountQuery);
18. lResultSetCount.next();
19. mSamplingCount lResultSetCount.getInt(1);
20. report("SamplingCount: " mSamplingCount);
21. mExportDate Calendar.getInstance().getTime();
22. mCurrentState CampaignOptimizerState.SAMPLE_SELECTED;
23. }
For example, if you have requested to extract two columns,
NAME and EMAIL, and a sample of 5 percent of the customer table
called CUSTOMERS for which the primary identifier is a column
called CUSTOMER_ID, the generated select statement follows:
create table STARTER_CUSTOMERS as
select CUSTOMER_ID, NAME, EMAIL, cast(NULL as INT) as RESPONSE
from CUSTOMERS
where (mod(CUSTOMER_ID, 100)) 5;
It is expected, in this specific scenario, that some period of time
will elapse between the previous operation and when TCA returns
the actual responses to the IT department for loading into the OMDB.
The RESPONSE column contains a “1” if the customer responded
 
Search WWH ::




Custom Search