Solved

JAVA PL/SQL OUTPUT

Posted on 2012-04-02
5
645 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

863 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

22 Experts available now in Live!

Get 1:1 Help Now