![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
A rather long and windy post, but since the traffic in this group is moderate for the moment, I'll give it a shot. 9.5 fixpak 5, after a bit of struggling I managed to compile and install an external java function. Not sure whether it actually works, but it compiles and runs fine: db2 "values db2inst1.removeDiacritics('abcde')" 1 -------------------------------------------------- abcde Ultimately I would like to add a generated column like: create table T ( x varchar(20) not null, y generated always as ( db2inst1.removeDiacritics('abcde') ) ); |
#3
| |||
| |||
|
|
On 2011-06-10 22:20, Lennart Jonsson wrote: A rather long and windy post, but since the traffic in this group is moderate for the moment, I'll give it a shot. 9.5 fixpak 5, after a bit of struggling I managed to compile and install an external java function. Not sure whether it actually works, but it compiles and runs fine: db2 "values db2inst1.removeDiacritics('abcde')" 1 -------------------------------------------------- abcde Ultimately I would like to add a generated column like: create table T ( x varchar(20) not null, y generated always as ( db2inst1.removeDiacritics('abcde') ) ); - y generated always as ( db2inst1.removeDiacritics('abcde') ) + y generated always as ( db2inst1.removeDiacritics(x) ) Ensure that the UDF is defined as |
#4
| |||
| |||
|
|
Ensure that the UDF is defined as NO SQL NO EXTERNAL ACTION DETERMINISTIC |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Would t not be easer to write a bunch of nested calls to REPLCE() ? |
|
It would be faster than any external procedure. Then take the search condition and put into ait into a CHECK() in the DDL: CREATE TABLE Customers (.. cust_name VARCHAR(25) NOTNULL CHECK(cust_name = REPLACE (REPLACE ...), ..); The optimizer can see the logic and use it in DML statements. Now the \business is done one way, in one place, one time. :First you mop the floor, then stop the leak. |
![]() |
| Thread Tools | |
| Display Modes | |
| |