• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How to Read DBMS_OUTPUT from a stored procedure in a java program

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

I am wondering if we can read the DBMS_OUTPUT from a stored procedure in a java program. If so, how?

Thanks
Praveena
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Praveena,
As far as I know, you cannot read the output from DBMS_OUTPUT in a java program.

Perhaps try creating a PL/SQL function that returns the string you are trying to read. That's something you can obtain from a java program (using the "execute()" method in "java.sql.CallableStatement").

Good Luck,
Avi.
 
Praveena Surapaneni
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Avi
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Praveena Surapaneni:
Thanks Avi



Yes as Avi said use a out parameter in oracle Sp
 
Avi Abrami
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srini,


Avi said use a out parameter in oracle Sp


No, I did not suggest using an OUT parameter in an Oracle stored procedure, I suggested using an Oracle stored function. I do believe that the two are different.

Good Luck,
Avi.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Avi Abrami:
Srini,

No, I did not suggest using an OUT parameter in an Oracle stored procedure, I suggested using an Oracle stored function. I do believe that the two are different.

Good Luck,
Avi.



Oh ! i'm sorry Avi, i mis-understood it .. What about out parameter ? Is it not a good design ? Please throw some light on it.
Also Avi, if possible Can you guide me Here.
[ January 01, 2005: Message edited by: srini vasan ]
 
Avi Abrami
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srini,
I believe there are situations where OUT parameters are a "good design" (as you put it). However, based on the information that Praveena has supplied, I think that a (PL/SQL) function is more appropriate.

Good Luck,
Avi.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok.
Where to use a Pl/SQL function & where to use a OutParameter
Any Idea on it ?
Does it make any differnece on the execution time ?
 
Avi Abrami
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srini,
I use OUT parameters when I need to return more than one value from a (PL/SQL) routine -- since a function can only return one value.

If I only return one value, then I prefer to use a function.

I don't know if there's a performance difference between using OUT parameters or functions.

Good Luck,
Avi.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Avi Abrami:
Srini,
I use OUT parameters when I need to return more than one value from a (PL/SQL) routine -- since a function can only return one value.

If I only return one value, then I prefer to use a function.

I don't know if there's a performance difference between using OUT parameters or functions.

Good Luck,
Avi.



Humm Thanks Avi..
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic