getColumnCount() ???

P

pincopallo_it

In my project I have a query like this:

query= "SELECT ID_STEZ, B.ID_PAR, B.VALORE WHERE
A.ID_STEZ = B.ID_STEZ AND B.ID_PAR = C.ID_PAR(+) AND A.ID_RET =
D.ID_RET AND A.ID_STEZ IN " +
stuz + " AND B.ID_PAR IN " + clim + " AND C.ID_PAR = B.ID_PAR"

which is perfectly working.
The variable stuz is like this : (12,45,64,85,127,476)
The variable clim is like this : (122,5,164,45,27,46)

The result of the query at the moment is stored in a TreeMap.
The problem is that if there is no data for clim (let's say) 5
i have not the column for clim 5

ResultSet rset = stmt.executeQuery (query);
result.setNumCols(rset.getMetaData().getColumnCount());
.... and the getColumnCount() don't consider the clim "5"

but I need a column for clim 5 as I have to fill the column
with "nodata" when I publish the web page !!!

How to solve it ????
 
T

Thomas Kellerer

(e-mail address removed), 11.09.2007 10:17:
In my project I have a query like this:

query= "SELECT ID_STEZ, B.ID_PAR, B.VALORE WHERE
A.ID_STEZ = B.ID_STEZ AND B.ID_PAR = C.ID_PAR(+) AND A.ID_RET =
D.ID_RET AND A.ID_STEZ IN " +
stuz + " AND B.ID_PAR IN " + clim + " AND C.ID_PAR = B.ID_PAR"

which is perfectly working.
No it's not.
The above is not a valid SQL Statement (the FROM part is missing).
The variable stuz is like this : (12,45,64,85,127,476)
The variable clim is like this : (122,5,164,45,27,46)

The result of the query at the moment is stored in a TreeMap.
The problem is that if there is no data for clim (let's say) 5
i have not the column for clim 5

ResultSet rset = stmt.executeQuery (query);
result.setNumCols(rset.getMetaData().getColumnCount());
... and the getColumnCount() don't consider the clim "5"

but I need a column for clim 5 as I have to fill the column
with "nodata" when I publish the web page !!!

Your SELECT only has three columns (id_stez, id_par and valore) so you
will never get more columns.

If there is a row (!) with id_par = 5 (that's your "clim 5") then you'll
get more rows, not more columns.

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top