Since the LONG
and LONG RAW
types are basically obsolete, reading those values correctly requires great care. The problem is that, although it is not apparent at first glance, when a query includes columns of that type, Oracle opens a special stream or flow for those types. But to be able to read them without problems, you must make sure of 2 things:
That you read the columns LONG
/ LONG RAW
in your loop before to read the other columns.
That you read the columns LONG
/ LONG RAW
only once in the loop.
Regarding the first point, according to the code you have shared, it does not seem to be the problem. But the way you've been modifying the code in your question and how you still do not seem clear how to create a minimal, complete and verifiable example , I would not be surprised if the code still does not correspond to reality.
But, at least as regards the second point, with your last edition it is clear that there is a problem. You are reading the column data_default
2 times, what you can not do. When the value of the column data_default
is not null
, the second reading is the one that gives you an error, because the flow was already closed after the first reading.
The solution is to read the value once and assign it to a variable to avoid a second reading:
ResultSet resultColumns = stm.executeQuery(query);
while(resultColumns.next())
{
String col_default = resultColumns.getString("data_default");
col_default = col_default == null ? "" : " DEFAULT " + col_default;
//trato los datos después...
}
If this does not solve the problem, then most likely the code in the question still does not reflect what you actually have. In order to receive correct answers to these types of questions, and to avoid turning the matter over unnecessarily, the key always lies in creating a minimum example, complete and verifiable . If you have not read the link yet, please do so. So you help yourself and us too.