Solved

JAVA PL/SQL OUTPUT

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Via a live example, show how to take different types of Oracle backups using RMAN.
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 …

777 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