Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / October 2008

Tip: Looking for answers? Try searching our database.

jdbc in/out parameter?

Thread view: 
laredotornado - 06 Oct 2008 18:47 GMT
Hi,

I'm using Oracle 10 with Java 1.5.  In our stored procedure, we have a
parameter that looks like:

PROCEDURE GET_LOG        (p_key_type          IN   VARCHAR2,
                         p_key_value         IN   VARCHAR2,
                         p_date_from         IN   VARCHAR2,
                         p_date_to           IN   VARCHAR2,
                         p_dataset_id        IN OUT  NUMBER,
                         p_dataset_seq_from  IN   NUMBER,
                         p_dataset_seq_to    IN   NUMBER,
                         p_rows_per_page     IN   NUMBER,
                         p_rows_to_insert    IN   NUMBER,
                         p_total_rows        OUT  NUMBER,
                         p_rm                OUT  VARCHAR2,
                         p_log_ds_csr        OUT  LOGDS_RC);

Notice parameter 5 is in/out.  How do I register an in/out parameter
with JDBC?  Thanks, - Dave
John B. Matthews - 06 Oct 2008 20:06 GMT
In article
<37ac7944-3aa7-45b4-8cf6-3711a09fe5e2@v15g2000hsa.googlegroups.com>,

> Hi,
>
[quoted text clipped - 16 lines]
> Notice parameter 5 is in/out.  How do I register an in/out parameter
> with JDBC?  Thanks, - Dave

It should work as long as you use the same type going in as you do in
registerOutParameter(). An alternative is to write a wrapper procedure
that separates the IN and OUT, as described here:

<http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
#06_16>

Signature

John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

Arne Vajhøj - 07 Oct 2008 00:00 GMT
> I'm using Oracle 10 with Java 1.5.  In our stored procedure, we have a
> parameter that looks like:
[quoted text clipped - 14 lines]
> Notice parameter 5 is in/out.  How do I register an in/out parameter
> with JDBC?

Have you tried the obvious:

cstmt.setBigDecimal(5, x);
cstmt.registerOutParameter(5, Types.DECIMAL);
...
cstmt.execute();
...
x = cstmt.getBigDecimal(5);

?

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.