f



SQL0440N No authorized routine named "||" of type "FUNCTION" having compatible arguments was found.

Trying to concatenate two fields into one however I seem unable to do
so.

All I want is to execute the following

SELECT MONTH(L.DATE) ||' '|| YEAR(L.DATE) as MTH_OF_YEAR
FROM LOG L

But I get this error:

SQL0440N  No authorized routine named "||" of type "FUNCTION" having
compatible arguments was found.  SQLSTATE=42884

This is the only way I know how to concatenate??? Is there another way
to achieve this in DB2 8.2?

0
whitsey
8/22/2007 10:48:59 PM
comp.databases.ibm-db2 12448 articles. 3 followers. arunrocks (9) is leader. Post Follow

2 Replies
5616 Views

Similar Articles

[PageSpeed] 31

On Aug 22, 3:48 pm, whitsey <lysterfiel...@gmail.com> wrote:
> Trying to concatenate two fields into one however I seem unable to do
> so.
>
> All I want is to execute the following
>
> SELECT MONTH(L.DATE) ||' '|| YEAR(L.DATE) as MTH_OF_YEAR
> FROM LOG L
>
> But I get this error:
>
> SQL0440N  No authorized routine named "||" of type "FUNCTION" having
> compatible arguments was found.  SQLSTATE=42884
>
> This is the only way I know how to concatenate??? Is there another way
> to achieve this in DB2 8.2?

The concatenation function expects strings. Try
RTRIM(CHAR(MONTH(L.DATE)))

--Jeff

0
jefftyzzer
8/22/2007 11:05:35 PM
whitsey wrote:
> Trying to concatenate two fields into one however I seem unable to do
> so.
> 
> All I want is to execute the following
> 
> SELECT MONTH(L.DATE) ||' '|| YEAR(L.DATE) as MTH_OF_YEAR
> FROM LOG L
> 
> But I get this error:
> 
> SQL0440N  No authorized routine named "||" of type "FUNCTION" having
> compatible arguments was found.  SQLSTATE=42884
> 
> This is the only way I know how to concatenate??? Is there another way
> to achieve this in DB2 8.2?
You are concatenating numbers. You need to cast to CHAR, then concatenate.
In DB2 Viper 2 you can use TO_CHAR(L.DATE, 'MM YYYY')

Cheers
Serge


-- 
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
0
Serge
8/23/2007 12:38:35 AM
Reply: