Retrieiving @@scope_identity()

Hi,

I am trying to retrieve scope_identity() value in the following code it it returns nothing.

      String Add = "{? call Add(?,?,?,?)}";
   
            try {
                dbConnection = getDBConnection();
                callableStatement = dbConnection.prepareCall(Add);
   
                callableStatement.registerOutParameter(1, Types.INTEGER);
                callableStatement.setString(1, o.Name);
                ...
   
                callableStatement.execute();
                o.Id = (int) callableStatement.getInt(1);

What is the correct way of doing the same?

ayha
LVL 7
ayha1999Asked:
Who is Participating?
 
Mark BullockQA Engineer IIICommented:
I think you should remove the question mark before ADD
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.