On 3 May 2010, at 6:14pm, Stefan Keller wrote:

> But in SQLite if a view column comes from a function result or some
> computation, then the column type is NULL...!? It's not taking the
> result-type as mentioned in the manual
> (http://www.sqlite.org/lang_select.html) - even when I try to do a
> CAST in the projection clause, like this:
> 
>  SELECT id, name, CAST(salary + 10 AS INTEGER) "salaryplus10" FROM mytable;
> 
> I mean that a VIEW should behave like a (read only) TABLE in any case.
> => Is there a way to give such columns a type anyway?

You get two chances to CAST, one when you define the VIEW, and another when you 
SELECT from the VIEW.  If one of them doesn't enforce the type of evaluation 
you want, the other probably will.  As you say, VIEW columns don't have types 
at all.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to