public static int ExecuteNonQuery(string commandText, CommandType commandType, int arrayBindCount, UserIdentity objUserIdentity = null, params OracleParameter[] parameters)
        {
            int returnCode = 0;

            using (OracleConnection conn = new OracleConnection(GetConnectionString()))
            {
                OracleCommand cmd = new OracleCommand();
                cmd.CommandText    = commandText;
                cmd.CommandType    = commandType;
                cmd.Connection     = conn;
                cmd.ArrayBindCount = arrayBindCount;

                foreach (OracleParameter p in parameters)
                {
                    cmd.Parameters.Add(p);
                }

                cmd.BindByName = true;
                cmd.Connection.Open();
                OracleTransaction txn = cmd.Connection.BeginTransaction();

                if (objUserIdentity != null)
                {
                    SetOracleUserContextForDBTransaction(cmd, objUserIdentity);
                }

                //Execute the command
                //If we get an ORA-04068: existing state of packages has been discarded
                //then automatically retry the command
                int retries = 1;
                while (retries-- >= 0)
                {
                    try
                    {
                        returnCode = cmd.ExecuteNonQuery();
                        txn.Commit();
                        break;
                    }
                    catch (OracleException ex)
                    {
                        if (ex.Number != 4068)
                        {
                            txn.Rollback();
                            throw ex;
                        }
                    }
                }
            }
            return(returnCode);
        }
 public static int ExecuteNonQuery(string commandText, CommandType commandType, UserIdentity objUserIdentity = null, params OracleParameter[] parameters)
 {
     return(ExecuteNonQuery(commandText, commandType, 0, objUserIdentity, parameters));
 }