Hello everybody.
I would like to ask a question about sqlplus COLUMN command which I use in order to set the length of my queries output columns. So for example, I run something like:
COLUMN market FORMAT a20
Therefore any column with the name 'market' will be typeset by sqlplus as long as 20 characters.
Currently I'm working on a PL/SQL script that makes this procedure automatique, that is, instead of writing manually for each column the above mentioned COLUMN command, it uses the DBMS_SQL. First it reads as input the name of the table and then inside a loop it detects the max length.
For those who are interested, here is the page in Oracle documentation that I found (Example 8)
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm
So everything worked pretty well I managed to retrieve the max length of each column in my table, except that I don't know how to use the sqlplus COLUMN command in my PL/SQL block. I would like to do something like this (it is just a pseudo code)
FOR colIndex in 1 .. numberOfColumns LOOP
currentColumnName = getColumnName(tableDescriptionObject, colIndex);
currentColumnLength = getColumnLength(tableDescriptionObject, colIndex);
COLUMN currentColumnName FORMAT a -- and here after 'FORMAT a' I have to write currentColumnLenth but I don't know how to proceed.
END LOOP;
I would like to know is there any command in PL/SQL allowing to set the appropriate length of column typeset in sqlplus?
Thanks in advance,
Dariyoosh