View Single Post

   
  #3 (permalink)  
Old 02-27-2008, 04:07 AM
Serge Rielau
 
Posts: n/a
Default Re: FUNCTION: MODIFIES SQL DATA

db2sysc@yahoo.com wrote:
> I am getting SQL0628N when I run function with INSERT and MODIFIES SQL
> DATA
>
> Version:
>
> DB2 v8.1.7.445 Fixpack 7.
>
> Create function test1( a int, b int)
> returns integer
> language sql
> modifies sql data
> begin atomic
> insert into test1 values(1,2);
> return 1;
> end@
>
> Am I missing something?
>

Only SQL Table functions are allowed to be MODIFIES SQL DATA.
(see syntax diagram)
The reason is that modifying SQL data inside of a WHERE clause or SELECT
list get srather bizarre semantically.
Note that the usage of SQL Table functions which modify SQL dat ais also
limited. Only in to level queries, and if there is a join they must
correlate to all other joined tables to enforce a clear ordering.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Reply With Quote