aspose file tools*
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ResultSet cannot seem to find aliased columns