Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem Java Stored Procedure

  Asked By: Jody    Date: Nov 26    Category: Java    Views: 661
  

I have java program which call procedure using callablestatement
which update some fields in table
I am not able to get the status of my procedure. I tried both using
execute and executeUpdate method both are returning me false & o
respectively.
But it is updating my record fine. Can anybody help for this problem

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Silvia Chapman     Answered On: Nov 26

If you can add an output parameter to your stored  proc and retrieve it after
you execute the query that is how I usually do it. Or you can try
Statement.SUCCESS_NO_INFO which is described as:

The constant indicating that a batch statement executed successfully but
that no count of the number of rows it affected is available.

 
Answer #2    Answered By: Ty Thompson     Answered On: Nov 26

I am just putting my code ...

Stored procedure  ...
*************************************
CREATE OR REPLACE
PROCEDURE remUpdNostro(flg IN varchar2,crtime IN varchar2,usr IN varchar2,upldt
IN varchar2,uplrefno IN varchar2,entrycurrno IN varchar2) AS
BEGIN
update nostro_entry
set CRCNF_FLAG = flg, CRCNF_TIME = to_date(crtime,'yyyy-MM-dd HH24:MI:SS'),
CRCNF_REMARKS = usr
where UPLOAD_INITIATION_DATE = to_date(upldt,'dd-MON-yy') and
UPLOAD_SOURCE_REF_NO = uplrefno and
ENTRY_CURRENT_NO = to_number(entrycurrno);
END remUpdNostro;

*************************************

java code ...........
*************************************
conn = DriverManager.getConnection(url,properties);
CallableStatement stmt1 = conn.prepareCall("BEGIN ? remUpdNostro(?,?,?,?,?,?);
END;");
stmt1.setString(1, "Y");
stmt1.setString(2, crdt);
stmt1.setString(3, usrid);
stmt1.setString(4, strUpload_dt);
stmt1.setString(5, strUploadrefno);
stmt1.setString(6, strEntrycurrno);

int res = stmt1.executeUpdate();
//I tried using execute() also it return me flase

if(res == 1) { flgStatus = true; }
else {flgStatus =false; }
stmt1.close();
*************************************

 
Didn't find what you were looking for? Find more on Problem Java Stored Procedure Or get search suggestion and latest updates.




Tagged: