Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2007, 09:55 PM
syntego@gmail.com
Guest
 
Posts: n/a
Default Creating Function Template in UDB 8.2 with TABLE return type for Federation

Is it possible to create a Function Template in UDB 8.2 with a TABLE
return type?

I would like to have a function federated that has a table return
type.

When I try:

CREATE FUNCTION MFP.MFBESTPRICE_TB(CUSIP VARCHAR(9), EFFDATE DATE)
RETURNS TABLE(DECIMAL(19,9), DATE)
SPECIFIC MFP.MFBESTPRICE_TB
AS TEMPLATE
NOT DETERMINISTIC
NO EXTERNAL ACTION
;

I get the following error:

[IBM][CLI Driver][DB2/6000] SQL0104N An unexpected token "(" was
found following "ETURNS TABLE(DECIMAL". Expected tokens may include:
"NUMERIC". LINE NUMBER=3. SQLSTATE=42601

I am able to successfully create a Function Template that returns a
scalar value.

Is this a limit of DB2 8.2, or is there a trick to getting the job
done?

Thanks,

Bob

  #2  
Old July 20th, 2007, 12:35 AM
Serge Rielau
Guest
 
Posts: n/a
Default Re: Creating Function Template in UDB 8.2 with TABLE return typefor Federation

syntego@gmail.com wrote:
Quote:
Is it possible to create a Function Template in UDB 8.2 with a TABLE
return type?
>
I would like to have a function federated that has a table return
type.
>
When I try:
>
CREATE FUNCTION MFP.MFBESTPRICE_TB(CUSIP VARCHAR(9), EFFDATE DATE)
RETURNS TABLE(DECIMAL(19,9), DATE)
SPECIFIC MFP.MFBESTPRICE_TB
AS TEMPLATE
NOT DETERMINISTIC
NO EXTERNAL ACTION
;
>
I get the following error:
>
[IBM][CLI Driver][DB2/6000] SQL0104N An unexpected token "(" was
found following "ETURNS TABLE(DECIMAL". Expected tokens may include:
"NUMERIC". LINE NUMBER=3. SQLSTATE=42601
DB2 is complaining because you don't have names for the columns
(it thinks DECIMAL is the name and now wants a type...)
Try (a DECIMAL(19, 0), b DATE)
Quote:
I am able to successfully create a Function Template that returns a
scalar value.
Is this a limit of DB2 8.2, or is there a trick to getting the job
done?
I don't know whether it's supported, never tried. But once you fix the
syntax error I'm sure DB2 will tell you...

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
  #3  
Old July 20th, 2007, 09:55 PM
syntego@gmail.com
Guest
 
Posts: n/a
Default Re: Creating Function Template in UDB 8.2 with TABLE return type for Federation

Tried with column names in the return clause:

CREATE FUNCTION MFP.MFBESTPRICE_TB(CUSIP VARCHAR(9), EFFDATE DATE)
RETURNS TABLE(a DECIMAL(19,9), b DATE)
SPECIFIC MFP.MFBESTPRICE_TB
AS TEMPLATE
NOT DETERMINISTIC
NO EXTERNAL ACTION

and received:

[IBM][CLI Driver][DB2/6000] SQL0628N Multiple or conflicting keywords
involving the "RETURNS TABLE" clause are present. LINE NUMBER=3.
SQLSTATE=42613

Another other ideas?

 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles