This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Praveena Surapaneni
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Avi
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • 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: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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..
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic