If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error on select query for UDT in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-08-04, 04:22
Manish Jain Manish Jain is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Error on select query for UDT in DB2

Hi all,
I am working on User Defined Structured Types. Here are the sqls for creating types and using it in a table.


CREATE TYPE db2admin.Person_t AS (Name VARCHAR(20), Age INT, Address VARCHAR(200)) INSTANTIABLE REF USING VARCHAR(13) FOR BIT DATA MODE DB2SQL

create table db2admin.emp (ID INT, EMP_DETAILS db2admin.Person_t)

CREATE FUNCTION db2admin.person_to_sql (A DB2ADMIN.PERSON_T) RETURNS ROW(Name VARCHAR(20), Age INT, Address VARCHAR(200)) LANGUAGE SQL RETURN values(A..Name, A..Age, A..Address)

CREATE FUNCTION db2admin.person_from_sql(Name VARCHAR(20), Age INT, Address VARCHAR(200)) RETURNS DB2ADMIN.PERSON_T LANGUAGE SQL CONTAINS SQL RETURN DB2ADMIN.PERSON_T()..Name(Name)..Age(Age)..Address (Address)

CREATE TRANSFORM FOR DB2ADMIN.PERSON_T DB2_PROGRAM (TO SQL WITH FUNCTION db2admin.person_from_sql, FROM SQL WITH FUNCTION db2admin.person_to_sql)


Now for getting the contents of table I am running the following query from command center

SELECT * from db2admin.emp

and getting the following Error Message. Can any body tell what is wrong in the whole process ..

SQL0390N The function "DB2ADMIN.PERSON_TO_SQL" resolved to
specific function "SQL040408135726000
" that is not valid in the context where it is used.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On