Describes the names and types of columns contained in an ESRI shapefile. This system feature is for use with the spatial data features.
sa_describe_shapefile(
shp_filename
, srid
[, encoding ]
)
Column Name | Data Type | Description |
---|---|---|
column_number | INTEGER | The ordinal position of the column described by this row, starting at 1. |
name | VARCHAR(128) | The name of the column. |
domain_name_with_size | VARCHAR(160) | The data type name, including size and precision (as used in CREATE TABLE or CAST functions). |
The sa_describe_shapefile system procedure is used to describe the name and type of columns in an ESRI shapefile. This information can be used to create a table to load data from a shapefile using the LOAD TABLE or INPUT statements. Alternately, this system procedure can be used to read a shapefile by specifying the WITH clause for OPENSTRING...FORMAT SHAPEFILE.
BEGIN DECLARE create_cmd LONG VARCHAR; SELECT 'create table if not exists esri_load( record_number int primary key, ' || (SELECT list( name || ' ' || domain_name_with_size, ', ' ORDER BY column_number ) FROM sa_describe_shapefile( 'c:\\esri\\tgr36069trt00.shp', 1000004326 ) WHERE column_number > 1 ) || ' )' INTO create_cmd; SELECT create_cmd; EXECUTE IMMEDIATE create_cmd; END
LOAD TABLE esri_load USING FILE 'c:\\esri\\tgr36069trt00.shp' FORMAT SHAPEFILE;