Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Create function error DB2 UDB v8.1.5 Linux
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 16th September 17:03
jan m. nelken
External User
 
Posts: 1
Default Create function error DB2 UDB v8.1.5 Linux



Correcting syntax errors renders function usable:

CREATE FUNCTION nalf_prefix(tattoo varchar(50))
returns varchar(50)
language sql
deterministic
no external action

begin atomic
declare result varchar(50);
set result = replace(upper(tattoo),' ','');
set result = substr(result,1,length(result)-1);
set result = replace(translate(tattoo,'','0123456789'),' ','');
return result; end @
E:\>db2 values nalf_prefix('a1b2c3 d4 e5')

1
--------------------------------------------------
abcde

1 record(s) selected.


Jan M. Nelken
  Reply With Quote


 


2 16th September 17:03
bob stearns
External User
 
Posts: 1
Default Create function error DB2 UDB v8.1.5 Linux



Thank you. The syntax diagram of the BEGIN statement (Page 767 of SQL
Reference Vol. 1) indicates that the ATOMIC clause is optional, at least
that is how I read it.
  Reply With Quote
3 16th September 17:03
serge rielau
External User
 
Posts: 1
Default Create function error DB2 UDB v8.1.5 Linux


http://publib.boulder.ibm.com/infoce...n/r0004240.htm
One word: ATOMIC

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
  Reply With Quote
4 16th September 17:03
serge rielau
External User
 
Posts: 1
Default Create function error DB2 UDB v8.1.5 Linux


That's the wrong statement.
Only SQL Procedures use the regular compound statement.
Triggers and functions use the dynamic compound statement (see my
earlier URL).

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
  Reply With Quote
5 16th September 17:03
bob stearns
External User
 
Posts: 1
Default Create function error DB2 UDB v8.1.5 Linux


The update documentation differs from the base; I should have looked
there before complaining (I do have it bookmarked). Sorry.
  Reply With Quote
Reply


Thread Tools
Display Modes




666