Meaningless Drivel is fun!*
The moose likes JDBC 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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.
 
Don't get me started about those stupid light bulbs.
 
subject: ResultSet cannot seem to find aliased columns
 
Similar Threads
Callable Statement Resultset
Select Statement Stored Procedures in MS sql server not returning anything...
Java and Sybase nested stored procedures
Java and Sybase nested stored procedures
Facing problem when using CallableStatement execute() api