Re: gen. include file for column definitions??

From: Happl Oberlin <hanspeter.oberlin_at_gmz.migros.ch>
Date: 1997/10/07
Message-ID: <343A656E.6314_at_gmz.migros.ch>#1/1


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 CEST

Original text of this message