PL/SQL to find column names from given table
Posted on 2004-11-10
I will be writing multiple ( > 100) import programs for all the tables in the database. We are going from a system that uses text files as the database, and we are going to be using those text files to create a external table in Oracle. Then we will run my import program to scrub the data, so that it fits the new constraints, and move the data to an normal table in the database.
I already have a template for the import routine, but it will be a major pain to write all the select, update, and insert statements to put into these programs. What I would like to do is write a helper function that I pass the tablename to, and that function will then find all the column names in the table, and spit out a select statement, insert and update. I would also like to create variable declarations with this function to, it should be easy since my naming convention for these is
Anyway, I hope my explanation kind of tells you what I need to do. I just need help finding all the column names from a table and then someway to manipulate then. I was thinking of dumping the output in a large string into a TEMP table so that I can copy and paste into my template routine.
ANY help would be appreciated, especially a SQL statement to find all the column names in a table. Thanks