• 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

Execution of stored procedure using for loop

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to use the below procedure in java.



But, while i executed query in sql console, it returned 300 records.

while i execute the proc, I am getting the ouput as just "Names: ". The usernames are displaying.

Please let me know, is this a correct way to display output while using query in for loop.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any help for this..please
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Honestly I did not understand what are you trying to do? Can you explain it a bit more? Are you trying to return values as ref cursor from pl/sql to java?

Regards,

Fatih.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, i am trying to return values from pl/sql to java using ref cursor. I am getting those values and am displaying that in my java output also.

You can see that i am using "dbms_output.put_line" in this procedure. While i execute this procedure in oracle console, I am getting the ouput as just "Names: ". The usernames that were suppose to display in a loop are not displaying beside "Names:".

My question is am i using the "dbms_output.put_line" statement in a right place as in the below procedure or do i need to put all the retrieved values from a loop to some storage like cursor and then use dbms_output.put_line to display values
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From java perspective dbms_output.put_line has no practical use. You should handle by getting resultset which is your out parameter and then iterate over the resulset and display or whatever you want.

From oracle perspective I have not seen such a usage till now. Does it really display all values from cursor? If I were you I would use a for loop for displaying results of cursor in sqlplus/toad/sql developer/etc. but again it has no benefit for java code.

But I guess your code is already working fine, or does not?

Regards,

Fatih.
 
reply
    Bookmark Topic Watch Topic
  • New Topic