Connecting Tech Pros Worldwide Help | Site Map

Error using old table() in UDF

  #1  
Old November 8th, 2008, 02:25 PM
Arun Srinivasan
Guest
 
Posts: n/a
I wrote an udf which can be outlined as
create <>
modifies sql data
returns select * from old table (update <set <>);
end;

The error I get is
SQL0278N [IBM][CLI Driver][DB2/NT64] SQL0628N Multiple or conflicting
keywords involving the "MODIFIES SQL DATA" clause are present. LINE
NUMBER=15. SQLSTATE=42613

If I don't specify, it says it needs it. Is there a work around, I am
supposing db2 considers select statement as the only operation and it
wont need the modifies sql data. Please help.
  #2  
Old November 8th, 2008, 02:45 PM
Serge Rielau
Guest
 
Posts: n/a

re: Error using old table() in UDF


Arun Srinivasan wrote:
Quote:
I wrote an udf which can be outlined as
create <>
modifies sql data
returns select * from old table (update <set <>);
end;
>
The error I get is
SQL0278N [IBM][CLI Driver][DB2/NT64] SQL0628N Multiple or conflicting
keywords involving the "MODIFIES SQL DATA" clause are present. LINE
NUMBER=15. SQLSTATE=42613
>
If I don't specify, it says it needs it. Is there a work around, I am
supposing db2 considers select statement as the only operation and it
wont need the modifies sql data. Please help.
You likely created a SCALAR UDF. Scalar UDF cannot modify SQL data.
Imagine such a function in a WHERE clause. *shudder*

Make is a TABLE function and you;re all set as long as you are careful
where to use it.

Btw you need: RETURNS TABLE(....)
and RETURN (no "s") (SELECT ....)

Cheers
Serge



--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing Form data in an SQL Query MikeBreslin answers 4 September 21st, 2007 04:58 AM
Access and SQL Server - Module Problem adserte@gmail.com answers 7 April 11th, 2006 11:55 AM
SQL1224N A database agent could not be started to service a request Marvin Libson answers 6 November 12th, 2005 06:51 AM