Solved

JAVA PL/SQL OUTPUT

Posted on 2012-04-02
5
644 Views
Last Modified: 2012-04-02
Greetings,

Does anyone have an example where from JAVA, I can call an ORACLE PL/SQL Stored Procedure, then capture the ORACLE output message (success or failure).  Basically, what I want to know is if I can call the PL/SQL Stored Procedure, and capture (in JAVA) whether it ran successfully, or not.

Thank you.
0
Comment
Question by:Evan Cutler
  • 2
  • 2
5 Comments
 
LVL 20

Assisted Solution

by:gatorvip
gatorvip earned 150 total points
ID: 37797921
>>capture (in JAVA) whether it ran successfully, or not.

What does this mean - what do you consider a successful execution? Are you expecting a string/varchar2 result from the PL/SQL procedure, or an exception? Or, alternatively, are you looking for an OUT parameter?

In any of those cases, you can catch a SQLException, or examine the string result.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37797922
Have you looked around on the web?  Examples are everywhere.

http://www.mkyong.com/jdbc/jdbc-callablestatement-stored-procedure-in-parameter-example/

http://www.mkyong.com/jdbc/jdbc-callablestatement-stored-procedure-in-parameter-example/

Trapping the error is just like any other call:  try/catch.
0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 37797947
I am looking for the OUT parameter...
How do I catch a SQLException?
Thanks.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 350 total points
ID: 37798055
I just realized I posted the same link twice...
not sutre what happened but here is the other link I meant to post:
http://www.dbforums.com/oracle/989076-calling-oracle-stored-procedure-java.html

>>How do I catch a SQLException?

Did you look at the link I posted in the first post?

catch (SQLException e) {
 
                  System.out.println(e.getMessage());
 
            }

>>I am looking for the OUT parameter...

Example here:
http://www.java2s.com/Code/Java/Database-SQL-JDBC/CallStoredProcedureInOracleAndPassInOutParameters.htm
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 37798114
Thanks guys...Java's just still new to me.
Appreciate it.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now