| Database Toolbox User's Guide | Search  Help Desk |
| attr | Examples See Also |
Get attributes of columns in fetched data set
Syntax
attributes = attr(cursor, column) attributes = attr(cursor)
Description
attributes = attr(cursor, column)
gets attribute information for the specified column in the fetched data set, cursor.
attributes = attr(cursor)
gets attribute information for all columns in the fetched data set, cursor, and stores it in a cell array. Use attributes(n) to display the attributes for column n.
The returned attributes are:columnName |
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, the data cannot be overwritten |
nullable |
if true, the data can be null |
Message |
error message returned by fetch |
Examples
Example 1 - Get attributes for one column
Get the column attributes for the fourth column of a fetched data set:attr(cursorA, 4)
ans =
columnName: 'Age'
typeName: 'LONG'
typeValue: 4
columnWidth: 11
precision: []
scale: []
currency: 'false'
readOnly: 'false'
nullable: 'true'
Message: []
Example 2 - Get attributes for all columns
Get the column attributes forcursorA, and assign them to attrA:
attrA = attr(cursorA)View the attributes of column 4:
attrA(4)MATLAB returns the attributes of column 4:
ans =
columnName: 'Age'
typeName: 'LONG'
typeValue: 4
columnWidth: 11
precision: []
scale: []
currency: 'false'
readOnly: 'false'
nullable: 'true'
Message: []
See Also
cols, columnnames, fetch, width