• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC Stored Procs and Temp tables

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using a java program to call a stored procedure using the PreparedStatement.

The Stored Procedure uses a select statement to select a particular column and insert the values into a temp table. I do a query of temp table at the end of the stored procedure. the output of stored procedure is a CURSOR.

The output is coming fine when I run the S tored Procedure on SQL Plus. But in Java I am not getting the output. I use the SYSREFCURSOR to get the cursor in Java.

In one of the articles on net I read that PreparedStatement when used like select count(*) from temp table will not work. Is this the same case for stored procedures also?

http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/67b10d74-e94f-4b58-8ee3-59ff390db1cf

Please guide me. Thanks.

Nags
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Nags.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nags,

Welcome to JavaRanch.

Using temp table is always tricky with Java.

Temporary table in oracle is always bound to user's connection. remember the connection i am referring to is the physical connection with your oracle server, if your environment is using connection pooling then you can not be certain if you will get the results because if it is same connection which populated the temporary table then you will get result else you will not.

could you please provide us the environment details .

Shailesh
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic