3 Replies Latest reply: Aug 4, 2011 12:57 PM by gdarling - oracle RSS



      I am trying to query an Index which is created on Oracle 11 g from Visual Studio. NET. I am using .net framework 4 and using Oracle Client. But the problem is, it halts when I try to get the result as follows:

      sample code:,

      Dim comm As New Data.OracleClient.OracleCommand("*SELECT TO_NUMBER (NVL (a.cur_val, 0)) + 1 FROM schema.APP_PARMS a WHERE UPPER(a.parm_nm) = 'ID' FOR UPDATE*", connOra)

      Dim OraSelectAdapter As New OracleDataAdapter
      OraSelectAdapter.SelectCommand = comm
      Dim ds As New DataSet

      OraSelectAdapter.Fill(ds) ----> Here it Halts!!!

      how can I fix this?

      Best Regards.
        • 1. Re: .NET -  SELECT FOR UPDATE PROBLEM???
          gdarling - oracle
          What do you mean by "halts" exactly? You get an error? You get wrong results? It hangs? You simply find that the "for update" is released?

          The default behavior per ADO spec is to autocommit, so if you don't use a transaction you'll pretty much commit right as you execute the statement, releasing the lock.

          • 2. Re: .NET -  SELECT FOR UPDATE PROBLEM???
            It hangs...no error
            • 3. Re: .NET -  SELECT FOR UPDATE PROBLEM???
              gdarling - oracle
              Is this behavior specific to that query? I tried the following and it worked fine for me, can you please try the same?

              Note however, that if I lock the EMP table before executing the app (via issuing the select * for update from a sqlplus session), the app hangs until I release the lock, and I'd say that's expected, just as if you executed the query from two different sqlplus sessions.

              using System;
              using System.Data;
              using Oracle.DataAccess.Client;
              class Program
                  static void Main(string[] args)
                      using (OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl"))
                          using (OracleCommand cmd = new OracleCommand("", con))
                              cmd.CommandText = "select * from emp for update";
                              OracleDataAdapter da = new OracleDataAdapter(cmd);
                              DataSet ds = new DataSet();