This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes ResultSet cannot seem to find aliased columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ResultSet cannot seem to find aliased columns" Watch "ResultSet cannot seem to find aliased columns" New topic
Author

ResultSet cannot seem to find aliased columns

Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
In my stored procedure, I am returning a "derived" resultset similar to the following:

SELECT CASE WHEN @var1 IS NOT NULL THEN 1 ELSE 0 END columnVar1,
CASE WHEN @var2 IS NOT NULL THEN 1 ELSE 0 END columnVar2,
CASE WHEN @var3 IS NOT NULL THEN 1 ELSE 0 END columnVar3,
CASE WHEN @var4 IS NOT NULL THEN 1 ELSE 0 END columnVar4,
CASE WHEN @var5 IS NOT NULL THEN 1 ELSE 0 END columnVar5;

when I run the procedure from SqlYog I get the expected values .. however when I get the resultset after a call to the execute command, it only returns the first column, columnVar1. The rest are coming back null. It fails to work whether I use the AS keywork or not. Also, I am using the connector 5.1.6. Any help would be greatly appreciated.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: ResultSet cannot seem to find aliased columns
 
It's not a secret anymore!