Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Result of function is truncated
Tue, Oct 22 2019 11:58 AMPermanent Link

Burkhard Schneider

I have this function in my Database (shortened for test purposes):

CREATE FUNCTION "NWPTypTest" (IN "PTyp" VARCHAR COLLATE "ANSI")
RETURNS VARCHAR COLLATE "ANSI"
BEGIN
   Return 'Ausbauplanung, Ing.-Bauwerke, Wasserbauwerke, Verkehrsanlagen, Ausführungsplanung, Erschließungsplanung...';
End

When I call it in a Select Statement like this:

SELECT NWPTypTest('A') FROM AnyTable

the function result is truncated to 60 charactes.

In ElevateDB Manager the Execute Function Dialog works correct.

What' wrong?

EDB 2.31 Build 4

Regards,
Burkhard Schneider
Wed, Oct 23 2019 4:13 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Burkhard

Firstly I'm assuming that "n ElevateDB Manager the Execute Function Dialog works correct." means you don't get an error message but that the result is truncated. If not then I have no idea what's going on.

If my assumption is correct then the reason is that ElevateDB does not know what size the result and so assumes VARCHAR(60)

Try

1. define a variable
2. set the variable to what you want
3. cast the variable to the length you want
4. return that variable

alternatively set the length of the return parameter (say to VARCHAR(1024), or wrap the function call in a cast

Roy
Wed, Oct 23 2019 8:33 AMPermanent Link

Burkhard Schneider

Roy Lambert wrote:

> Firstly I'm assuming that "n ElevateDB Manager the Execute Function Dialog works correct."
> means you don't get an error message but that the result is truncated.
> If not then I have no idea what's going on.

The EDB Execute Function Dialog deliveres a correct result that is not truncated.

> alternatively set the length of the return parameter (say to VARCHAR(1024),

That works, thank you
Image