File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How to Read DBMS_OUTPUT from  a stored procedure in a java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to Read DBMS_OUTPUT from  a stored procedure in a java program" Watch "How to Read DBMS_OUTPUT from  a stored procedure in a java program" New topic
Author

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

Praveena Surapaneni
Greenhorn

Joined: Sep 13, 2001
Posts: 17
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

Joined: Oct 11, 2000
Posts: 1135

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

Joined: Sep 13, 2001
Posts: 17
Thanks Avi
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Originally posted by Praveena Surapaneni:
Thanks Avi


Yes as Avi said use a out parameter in oracle Sp


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1135

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

Joined: Sep 28, 2004
Posts: 1228
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

Joined: Oct 11, 2000
Posts: 1135

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

Joined: Sep 28, 2004
Posts: 1228
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

Joined: Oct 11, 2000
Posts: 1135

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

Joined: Sep 28, 2004
Posts: 1228
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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Read DBMS_OUTPUT from a stored procedure in a java program