Documentation Center

  • Trial Software
  • Product Updates

attr

Retrieve attributes of columns in fetched data set

Syntax

attributes = attr(curs, colnum)
attributes = attr(curs)

Description

attributes = attr(curs, colnum) retrieves attribute information for the column number colnum in the fetched data set curs.

attributes = attr(curs) retrieves attribute information for all columns in the fetched data set curs and stores the data in a cell array.

attributes = attr(colnum) displays attributes of column colnum.

A list of returned attributes appears in the following table.

AttributeDescription
fieldName

Name of the column.

typeName

Data type.

typeValue

Numerical representation of the data type.

columnWidth

Size of the field.

precision

Precision value for floating and double data types; an empty value is returned for strings.

scale

Precision value for real and numeric data types; an empty value is returned for strings.

currency

If true, data format is currency.

readOnly

If true, data cannot be overwritten.

nullable

If true, data can be NULL.

Message

Error message returned by fetch.

Examples

Example 1 — Get Attributes for One Column

Get column attributes for the fourth column of a fetched data set:

attr(curs, 4)

ans = 
      fieldName: 'Age'
       typeName: 'LONG'
      typeValue: 4
    columnWidth: 11
      precision: []
          scale: []
       currency: 'false'
       readOnly: 'false'
       nullable: 'true'
        Message: []

Example 2 — Get Attributes for All Columns

  1. Get column attributes for curs and assign them to attributes.

    attributes = attr(curs)
    
  2. View the attributes of column 4.

    attributes(4)
    ans = 
          fieldName: 'Age'
           typeName: 'LONG'
          typeValue: 4
        columnWidth: 11
          precision: []
              scale: []
           currency: 'false'
           readOnly: 'false'
           nullable: 'true'
            Message: []
    

See Also

| | | | | | |

Was this topic helpful?