473,396 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UDF in GENERATED ALWAYS column

Hi,

DB2 UDB 8.2.2, Win32

I'm trying to create GENERATED ALWAYS column with UDF in definition
My code

CREATE FUNCTION ADM.F_AAAA(par_InStr VARCHAR(10))
RETURNS VARCHAR(10)
SPECIFIC F_AAAA
DETERMINISTIC
NO EXTERNAL ACTION
RETURN par_InStr
@

create table adm.aaa(
f1 varchar(10),
f2 varchar(10) generated always as (adm.F_AAAA(f1))
)

I recive error SQLSTATE=42621. What is wrong?
Can anybody help me? I am looking for simple example

Thanks
Yaro
Nov 12 '05 #1
2 1932
A SQL FUNCTION is READS SQL DATA by default, and that is not allowed in
a GENERATED expression. So, specify CONTAINS SQL.

B.

Nov 12 '05 #2
A SQL FUNCTION is READS SQL DATA by default, and that is not allowed in
a GENERATED expression. So, specify CONTAINS SQL.
B.


Works, thank you
Yaro


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: db2group88 | last post by:
i would like to know when i create a table with identity column, should i used generated by default or generated as always. since when i create this table, i might copy some data from another table...
1
by: Robert Stearns | last post by:
I have two related questions. Why did I have to: SET INTEGRITY FOR is3.animals OFF; before doing: alter table is3.animals add column pseudo_id generated always as (coalesce(regnum,...
2
by: valerio | last post by:
Hi all, I've some problem to import data to DB2 using the db2move and db2look tools. Follow the problem : I have exported data from db2 v. 7 database on windows server, using the db2look and...
3
by: Jurgen Haan | last post by:
Hi Can I convert a plain integer column (non-key) in a table to a generated column using the ALTER TABLE .. ALTER COLUMN statement? If not, should I use the ALTOBJ statement? -R-
1
by: Ben.Combrink | last post by:
Hi We're using an iSeries running v5r3. I am trying to add a generated column to a table, using the statement below. The card_status column is a bitset. ALTER TABLE cards ADD COLUMN...
17
by: Darek | last post by:
Hi, I have a table, something similar to: create table my_table ( id char(32) not null primary key, num integer not null, code varchar(2) not null, name varchar(60) not null,
5
by: Veeru71 | last post by:
Given a table with an identity column (GENERATED BY DEFAULT AS IDENTITY), is there any way to get the last generated value by DB2 for the identity column? I can't use identity_val_local() as...
4
by: Bernard Dhooghe | last post by:
Table definition: CREATE TABLE "SCHEMA1 "."X2" ( "C1" CHAR(20) NOT NULL , "C2" CHAR(10) NOT NULL , "C3" CHAR(30) NOT NULL GENERATED ALWAYS AS (C1|| C2) ) IN "USERSPACE1" ; -- DDL...
1
by: Frank Swarbrick | last post by:
We're trying to take advantage of the new ROW CHANGE TIMESTAMP option. Here is a simple table: CREATE TABLE "ACCTASGN"."NUMBER_STATUS" ( "STATUS_CODE" CHAR(1) NOT NULL , "STATUS_DESCRIPTION"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.