It looks like you're using an Ad Blocker.

Please white-list or disable AboveTopSecret.com in your ad-blocking tool.

Thank you.

 

Some features of ATS will be disabled while you continue to use an ad-blocker.

 

stringbuffer in java

page: 1
0

log in

join
share:

posted on Apr, 10 2023 @ 05:34 AM
link   
I want the Variable Model class to return the row number:

As contrast to the PreparedStatement in the examples I explored, row number is not a native or physical column of the table. How to make the values dete method return values as if they were physical table columns. It would also be pointless to add a new column to the table solely to store these values. I also do not want to return these values using triggers. It is possible to perform this without error in the code below.


final StringBuffer lSql = new StringBuffer();
lSql.append("SELECT ");
lSql.append(" TABLE_NAME.ROW_NUMBER() OVER (ORDER BY COLUMN_DAY) ");
lSql.append("FROM ...");
// ...
final List listData = new ArrayList();
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rset = null;
try[
conn = getConnection1();
stmt = conn.prepareStatement(lSql.toString());
int count = 1;
//stmt.setLong(count+, classModelParameterThisFunctionDAO.getVarColumnSequence());
//...
rset = stmt.executeQuery(); // ERROR THIS LINE NI DEBUG
while(rset.nex())[
final classModel lClassModel = new classModel();
lClassModel.setColumnSequence(rset.getInt("ROW_NUMBER() OVER (ORDER BY COLUMN_DAY)")); //error in this line
listData.add(lClassModel);

edit on 10-4-2023 by Mobo01 because: code typo



new topics
 
0

log in

join