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
(boolean) (optional)
throw an error when datatype is not found
Parameters:
table_name
column_name
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>

Partial Call Graph (max 5 caller/called nodes):
%3 test_datamodel__acs_attribute_check datamodel__acs_attribute_check (test acs-tcl) db_column_type db_column_type test_datamodel__acs_attribute_check->db_column_type db_string db_string (public) db_column_type->db_string ad_column_type ad_column_type (public, deprecated) ad_column_type->db_column_type plpgsql_utility::generate_function_signature plpgsql_utility::generate_function_signature (public) plpgsql_utility::generate_function_signature->db_column_type plpgsql_utility::table_column_type plpgsql_utility::table_column_type (public, deprecated) plpgsql_utility::table_column_type->db_column_type xo::db::require proc default xo::db::require proc default xo::db::require proc default->db_column_type

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: