Sybase jconnect stored procedure temporary tables issue

Posted on 2005-03-03
Medium Priority
Last Modified: 2008-03-06
From isql I run my stored procedure and it returns the expected results.  However, from Java the


method returns nothing.  The stored procedure contains temporary tables and two select statements.  If I instead replace this with just one select statement and no temporary tables I get results from java.  Any ideas?
Question by:r2umam
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 24

Expert Comment

by:Joe Woodhouse
ID: 13456002
Not very helpful to you I'm afraid, but I've seen a lot of applications and connectivity tools expect only one result set per statement.

If that's the case for Java as well, do you have the ability to split your procedure into two subprocedures and call them one per statement? Of course, you wouldn't be able to share information between them with the #temp tables anymore, though.

I'm not a Java person but I'm guessing there might be some way to concatenate result sets...?

Author Comment

ID: 13456032
actually, in both cases there is only one result set. In the first sp I create a temp table and then select from it, returning one result set but java says no results, whereas isql returns many lines of results.  In the second case there is also one result set, but this time no temp table, this time java has no problem and returns results.
LVL 24

Accepted Solution

Joe Woodhouse earned 2000 total points
ID: 13456053
Huh. Ok, so it isn't that.

Java doesn't like temp tables? Hmm.

What version of ASE? If you're in any of the recent versions (12.5.1+, I think), you can use a derived table rather than a temp table, ie. treat the query that populates the temp table as a table in the FROM clause:

SELECT   ...
FROM     (SELECT ... FROM ... WHERE ...) as derived_table
,            other_table

If the inner query doesn't have to be built programatically (ie. is the same every time it runs), you could use a VIEW instead.
LVL 29

Expert Comment

ID: 13460293
Does you application have the same rights as then you are running it from isql?

As a test create a procedure to insert a single value into a temp table and select it out. Do you get it from Java?
LVL 24

Expert Comment

by:Joe Woodhouse
ID: 13463816
Glad that helped!

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question