int findMatchingRangeVariableIndex(RangeVariable[] rangeVarArray) {

    for (int i = 0; i < rangeVarArray.length; i++) {
      RangeVariable rangeVar = rangeVarArray[i];

      if (rangeVar.resolvesTableName(this)) {
        return i;
      }
    }

    return -1;
  }
  private boolean resolveColumnReference(RangeVariable rangeVar) {

    Expression e = rangeVar.getColumnExpression(columnName);

    if (e != null) {
      opType = e.opType;
      nodes = e.nodes;
      dataType = e.dataType;

      return true;
    }

    int colIndex = rangeVar.findColumn(this);

    if (colIndex == -1) {
      return false;
    }

    switch (rangeVar.rangeType) {
      case RangeVariable.PARAMETER_RANGE:
      case RangeVariable.VARIALBE_RANGE:
        {
          if (tableName != null) {
            return false;
          }

          ColumnSchema column = rangeVar.getColumn(colIndex);

          if (column.getParameterMode() == SchemaObject.ParameterModes.PARAM_OUT) {
            return false;
          } else {
            opType =
                rangeVar.rangeType == RangeVariable.VARIALBE_RANGE
                    ? OpTypes.VARIABLE
                    : OpTypes.PARAMETER;
          }

          break;
        }
      case RangeVariable.TRANSITION_RANGE:
        {
          if (tableName == null) {
            return false;
          }

          if (schema != null) {
            return false;
          }

          if (!rangeVar.resolvesTableName(tableName)) {
            return false;
          }

          opType = OpTypes.TRANSITION_VARIABLE;

          break;
        }
      default:
        {
          if (!rangeVar.resolvesSchemaName(schema)) {
            return false;
          }

          if (!rangeVar.resolvesTableName(tableName)) {
            return false;
          }

          break;
        }
    }

    setAttributesAsColumn(rangeVar, colIndex);

    return true;
  }