db_column_type (public)

 db_column_type [ -dbn dbn ] [ -complain ] table_name column_name

Defined in packages/acs-tcl/tcl/01-database-procs.tcl

Switches:
-dbn (optional)
The database name to use. If empty_string, uses the default database.
-complain (optional, boolean)
throw an error when datatype is not found
Parameters:
table_name (required)
column_name (required)
Returns:
the Oracle Data Type for the specified column.
-1 if the table or column doesn't exist.
an error if table or column doesn't exist and -complain flag was specified
Author:
Yon Feldman <yon@arsdigita.com>

Testcases:
datamodel__acs_attribute_check
Source code:
    # Works for both Oracle and PostgreSQL:
    set datatype [db_string -dbn $dbn column_type_select {
        select data_type as data_type
        from user_tab_columns
        where upper(table_name) = upper(:table_name)
        and upper(column_name) = upper(:column_name)
    } -default -1]
    if {$complain_p && $datatype == -1} {
        error "Datatype for $table_name.$column_name not found."
    } else {
        return $datatype
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: