void setAttributesAsColumn(RangeVariable range, int i) {

    columnIndex = i;
    column = range.getColumn(i);
    dataType = column.getDataType();
    rangeVariable = range;

    if (range.rangeType == RangeVariable.TABLE_RANGE) {
      rangeVariable.addColumn(columnIndex);
    }
  }
  void setAutoAttributesAsColumn(RangeVariable range, int i) {

    columnIndex = i;
    column = range.getColumn(i);
    dataType = column.getDataType();
    columnName = range.getColumnAlias(i).name;
    tableName = range.getTableAlias().name;
    rangeVariable = range;

    rangeVariable.addColumn(columnIndex);
  }
  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(schema, tableName, columnName);

    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;
          }

          opType = OpTypes.TRANSITION_VARIABLE;

          break;
        }
      default:
        {
          break;
        }
    }

    setAttributesAsColumn(rangeVar, colIndex);

    return true;
  }