Re: VARCHAR in table, CHAR in view
Posted in 1999
> So, I'm working on a system right now that has a requirement that the
> character columns in our tables be of CHAR data type. This is due to an
> interface with some legacy application and is not negotiable.
>
> My question is this- If I created a view against the table where the
> only difference was that the table used VARCHAR and the view used CHAR,
> would there be any kind of performance hit using the view? There
> wouldn't be any filtering or joining in the view, just a one-to-one
> mapping of tables to views with the data type conversion.
>
> Are there any internal issues I should know about before trying this?
It's possible that they changed things without telling me, but last time I looked,
you can't change data types with a view. The syntax is something like:
CREATE VIEW my_view
(vcol1, vcol2, vcol3, vcol4, vcol5)
AS SELECT column1, column9, column3, column6, sum(column5)
FROM my_table
GROUP BY column1, column9, column3, column6;
This allows you to change column names and assign names to aggregates, but does not
allow specifying or changing column types. This assumes Informix 7.x. I don't
know if 9.x still has this limit.
Mark Collins
mcollins@us.dhl.com
Don't anthropomorphize computers. They don't like it.