Solved

JAVA PL/SQL OUTPUT

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

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

Suggested Solutions

Title # Comments Views Activity
jboss 7.1 start up error 1 42
SQL Server group with two values 4 35
Error in creating a view. 8 23
learn programming 8 43
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

821 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