Question

1
Replies
3221
Views
JonatanL Member since 2017 3 posts
Rulesware LLC
Posted: November 6, 2017
Last activity: December 21, 2017
Closed

How translate a SQL function into a SQL alias in Pega to be used in a report definition?

Hello.

I have created a SQL function which gives me the reverse of a string and what I want to do is translate that function into a SQL function alias and used it in a report definition.

The SQL function is this one:

CREATE FUNCTION reverse (@instr varchar(40))
RETURNS VARCHAR(40)
AS
begin
declare @revstr varchar(40), @reststr varchar(40), @len int
SET @reststr = @instr
SET @len = len(@instr)
WHILE @len > 0
BEGIN
SET @revstr = CONCAT(SUBSTRING(@reststr, 1, 1) , @revstr)
SET @reststr = SUBSTRING(@reststr, 2, @len - 1)
SET @len = @len - 1
END
RETURN @revstr
END

Then, I save the rule with the previous sql function and don't get any error but when I execute the report definition I get the next SQLSTATE = 42601.

I attached an image with my SQL function.

Thanks

Reporting
Moderation Team has archived post
Share this page LinkedIn