Please show how you defined the parms to DISPLAYVAL. If you said that the second parm was char 2, then you will need to wrap '02' with char() to get it to match. When using functions and procedures, the data type you pass must match what it's expecting. In this example you are passing a varchar by default. So if you defined that second parm as char then try this.
Displayval(1001,char('02',2))
Personally, I've never tried just calling the function from STRSQL. You may need to select displayval(1001,char('02',2)) from sysibm/sysdummy1
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of James Lampert
Sent: Tuesday, March 29, 2011 2:50 PM
To: Midrange Systems Technical Discussion
Subject: SQL UDF help
I'm trying to write a UDF to convert from a "code" to a "display value."
I think I managed it,
Function DISPLAYVAL was created in MERCURY.
but I'm having trouble testing it (probably from not knowing what I'm doing)
I try
displayval(1001, '02')
and I get
Token DISPLAYVAL was not valid. Valid tokens: ( CL END GET SET CALL
I try
create procedure myproc3
begin
signal SQLSTATE '70000' set message_text = displayval(1001, '02')
end
and I get
Variable DISPLAYVAL not defined or not usable.
I'm obviously doing *something* wrong, but I haven't a clue *what*.
--
JHHL
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/midrange-l.
________________________________
Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.
As an Amazon Associate we earn from qualifying purchases.