Subject | Re: [firebird-support] Execute statement and sum |
---|---|
Author | Martijn Tonies |
Post date | 2007-06-19T20:32:56Z |
Hi,
can go beyond the int range.
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> I ran into a strange problem and I'm trying to understand why it worksbigint, I believe. Kinda makes sense, given that summing up ints
> like this. What should be the data type of SUM() function over an
> integer column?
>
> I thought that SUM(integer) yields integer, but it looks like it is
> not the case as "execute statement" fails with error about
> incompatible types. Consider this simple example:
can go beyond the int range.
>Martijn Tonies
> create table t1
> (
> x integer
> );
> commit;
>
> set term !! ;
> execute block
> as
> DECLARE VARIABLE sumx integer;
> begin
> execute statement 'select sum(x) from t1'
> into :sumx;
> end!!
>
>
> I get this error:
>
> Variable type (position 0) in EXECUTE STATEMENT 'select sum(x) from
> t1' INTO does not match returned column type.
>
> I know I can work around it by casting the SUM to integer, but I'd
> like to know why it works this way. Perhaps this is a question for
> devel list?
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com