Skip to Main Content Skip to Search
Product Documentation

columns - Return database table column names

Syntax

l = columns(dbmeta, 'cata')
l = columns(dbmeta, 'cata', 'sch')
l = columns(dbmeta, 'cata', 'sch', 'tab')

Description

l = columns(dbmeta, 'cata') returns a list of all column names in the catalog cata for the database whose database metadata object is dbmeta.

l = columns(dbmeta, 'cata', 'sch') returns a list of all column names in the schema sch.

l = columns(dbmeta, 'cata', 'sch', 'tab') returns a list of columns for the table tab.

Examples

  1. Run columns for the arguments shown:

    l = columns(dbmeta,'orcl', 'SCOTT')
    l = 
        'BONUS'       {1x4 cell}
        'DEPT'        {1x3 cell}
        'EMP'         {1x8 cell}
        'SALGRADE'    {1x3 cell}
        'TRIAL'       {1x3 cell}
    

    The results show the names of the five tables in dbmeta, and cell arrays containing the column names in each table.

  2. View the column names for the BONUS table:

    l{1,2}
    ans = 
        'ENAME'    'JOB'    'SAL'    'COMM'
    

See Also

attr | bestrowid | cols | columnnames | columnprivileges | dmd | get | versioncolumns

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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