Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: gen. include file for column definitions??
Dietmar Leibecke wrote:
> I'm looking for a way to generate a C include file with the column
> length definitions of all varchar fields in a database. The result
> should look like
>
> #define MAX_<TABLENAME>_<COLNAME> <COLUMNLENGTH>+1
>
> where TABLENAME is the name of the table, COLNAME the name of the column
> and COLUMNLENGTH the length of the varchar field.
Try this SELECT. It creates a file columns.h with what you wanted.
set echo off termout on verify off pagesize 0 heading off feedback off
column c format a65
column l format 99990
spool columns.h
select '#define MAX_'||table_name||'_'||column_name c, data_length+1 l
from user_tab_columns
where data_type = 'VARCHAR2'
order by table_name, column_name
/
spool off
Happl Received on Tue Oct 07 1997 - 00:00:00 CDT
![]() |
![]() |