C # Gets the SQL statement for the column name and data type of a table in the Oracle database: Select Column_name,data_type, Data_length,data_precision,data_scale from User_tab_ columns [where table_name= table name] Description of this SQL statement: column_name: A table column name (VARCHAR2 ());d Ata_type: The data type of a table column (VARCHAR2 (106)); Data_length: Length of a table column (number); use instance: DataSet ds = CFO. Returndataset ("Select Column_name,data_type, data_length from User_tab_columns where table_name= '" + TableName + "'", tab Lename);//tablename for the specified table name string strcreatesql = ""; for (int j = 0; J < DS. Tables[tablename]. Rows.Count; J + +) {if (j = = ds. Tables[tablename]. Rows.count-1) {Strcreatesql + = ds. Tables[tablename]. rows[j]["column_name"]. ToString () + "" + ds. Tables[tablename]. rows[j]["Data_type"]. ToString () + "(" + DS. Tables [tablename]. rows[j]["Data_length"]. ToString () + ")";} Else{strcreatesql + = ds. Tables[tablename]. rows[j]["column_name"]. ToString () + "" + ds. Tables[tablename]. rows[j]["Data_type"]. ToString () + "(" + DS. Tables [tablename]. rows[j]["Data_length"]. ToString () + ")" + ",";}} StRing Strcreatesqlvale = "CREATE TABLE" + TableName + "(" + Strcreatesql + ")"; Creates a table's SQL statement based on the table column name obtained and the database type length. There's another way. C # Gets the column name and data type of a table in the Oracle database: SELECT * from a table name where 1<>1 can get an empty data table and loop through the column names that return a table.
C # Gets the column name and data type of a table in Oracle database "reprint"