attr - Retrieve attributes of columns in fetched data set

Syntax

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

Description

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

cols, columnnames, columns, cursor.fetch,dmd, get, tables, width

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS