Solved

JAVA PL/SQL OUTPUT

Posted on 2012-04-02
5
658 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 77

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 77

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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
The viewer will learn how to implement Singleton Design Pattern in Java.

729 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