473,395 Members | 1,456 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,395 software developers and data experts.

need help with UDF

MAXRC is UDF Returns GREATEST Value of list of COLUMNS – TYPE CHARACTER
Example of use:
SELECT EMPNO, FIRSTNME,MIDINIT,LASTNAME,WORKDEPT,
MAXRC(FIRSTNME,MIDINIT,LASTNAME,WORKDEPT) AS MAX_IN_ROWS
FROM EMPLOYEE;

FIRSTNME MIDINIT LASTNAME WORKDEPT
MAX_IN_ROWS

------------ ------- --------------- -------- --------------------------------
----------------------------------------------------
CHRISTINE I HAAS A00
I

MICHAEL L THOMPSON B01
THOMPSON

SALLY A KWAN C01
SALLY

JOHN B GEYER E01
JOHN

IRVING F STERN D11
STERN

EVA D PULASKI D21
PULASKI

But when i try use it with Temp tables it is not working:

WITH T1(D_KEY,D_NAME) AS
(VALUES(1,'Barbara'),
(2,'John'),
(3,'Steve')),
T2 (T_KEY,T_NAME) AS
(VALUES (1,'Wattson'),
(2, 'Jackson'),
(3, 'Henry'),
(1,'Smith'))

SELECT D_NAME,T_NAME,MAXRC(T1.D_NAME,T2.T_NAME)
FROM T1,T2;
i got following error message
No authorized routine named "MAXRC" of type "FUNCTION
" having compatible arguments was found.

sqlcode: -440

Any ideas what is wrong?
Thank's in advance Leny G.

--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200803/1

Mar 2 '08 #1
2 1455
lenygold wrote:
>MAXRC is UDF Returns GREATEST Value of list of COLUMNS – TYPE CHARACTER
Example of use:
SELECT EMPNO, FIRSTNME,MIDINIT,LASTNAME,WORKDEPT,
MAXRC(FIRSTNME,MIDINIT,LASTNAME,WORKDEPT) AS MAX_IN_ROWS
FROM EMPLOYEE;

FIRSTNME MIDINIT LASTNAME WORKDEPT
MAX_IN_ROWS

------------ ------- --------------- -------- --------------------------------
----------------------------------------------------
CHRISTINE I HAAS A00
I
Never mind. I find what is wrong. My Udf started with 3 arguments and more. I
fixed it
>
MICHAEL L THOMPSON B01
THOMPSON

SALLY A KWAN C01
SALLY

JOHN B GEYER E01
JOHN

IRVING F STERN D11
STERN

EVA D PULASKI D21
PULASKI

But when i try use it with Temp tables it is not working:

WITH T1(D_KEY,D_NAME) AS
(VALUES(1,'Barbara'),
(2,'John'),
(3,'Steve')),
T2 (T_KEY,T_NAME) AS
(VALUES (1,'Wattson'),
(2, 'Jackson'),
(3, 'Henry'),
(1,'Smith'))

SELECT D_NAME,T_NAME,MAXRC(T1.D_NAME,T2.T_NAME)
FROM T1,T2;
i got following error message
No authorized routine named "MAXRC" of type "FUNCTION
" having compatible arguments was found.

sqlcode: -440

Any ideas what is wrong?
Thank's in advance Leny G.
--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200803/1

Mar 2 '08 #2
Either redefine your function to accept VARCHAR, or cast your input to CHAR.
CHAR is lower in the promotion chain that VARCHAR.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Mar 2 '08 #3

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

Similar topics

0
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
15
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
3
by: Bob.Henkel | last post by:
I write this to tell you why we won't use postgresql even though we wish we could at a large company. Don't get me wrong I love postgresql in many ways and for many reasons , but fact is fact. If...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
4
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is...
8
by: Sai Kit Tong | last post by:
In the article, the description for "Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" suggests the creation of the class ManagedWrapper. If I...
2
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.