cancel
Showing results for 
Search instead for 
Did you mean: 

Error on a specific query to get the ordinal position of the column

Former Member
3,288

Hi,

I'm using ultraliteJ version: 12.0.1 ebf: 3605. I got a problem when I try to get the ordinal position of a duplicated column when the table on the query has an alias. Below I will give some examples to explain it more:

My query: "SELECT idState, idState as state2 FROM bzState s" -> If I try to use this sentence rs.getOrdinal("idState"); (after executing and fetching the row) I get the error -143 (column not found). And if I remove the table alias (in my case the 's' value) the getOrdinal works without a problem.

Is there a limitation on ultraliteJ on this case?

tks

VolkerBarth
Contributor
0 Kudos

Your using the ResultSet interface, I guess.

What happens when you call

rs.getOrdinal("state2");

does this work as expected? I'm not aware if you can add table names here, too, such as rs.getOrdinal("s.idState");...

Former Member
0 Kudos

The "rs.getOrdinal("state2");" works just fine with the table alias. If I use the "s.idState" I get the same error as before, but I have figure out a workaround. In the "getOrdinal" method, I have to use the prefix "<table_name>." to get the right position of the "idState".

So in this query "SELECT idState, idState as state2 FROM bzState s" If I want to get the position of the first column I must retrieve with "rs.getOrdinal("bzState.idState");".

I don't know why this happens, but for now I will have to use it.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Renato,

That would seem to be a problem with the UltraLite C runtime. I expect the same result would occur if you used ULResultSetSchema::GetCoulmnID in the UltraLite C++ API. (This is what UltraLiteJ on Android uses).

Another workaround I could suggest is changing your query to

SELECT idState as state1, idState as state2 FROM bzState s
You could then retrieve the position of the first column with
rs.getOrdinal("state1")

I will add the issue to a list to investigate, but it will be low priority since there are workarounds.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello, I had the same problem, but in my case I needed a table alias to do a join. I fixed my problem changing the table alias for the name of table, for example:

SELECT bzState.idState, bzState.idState as state2 FROM bzState