0

I have a custom function that I'm working on... the problem I'm having is simple: Permssions.

example function:

drop function circle_area
go

CREATE FUNCTION  circle_area (radius FLOAT)
RETURNS FLOAT LANGUAGE SQL
BEGIN
     DECLARE pi FLOAT DEFAULT 3.14;
     DECLARE area FLOAT;

     SET area =  pi * radius * radius;
     RETURN area;
END
GO

if I then log out of my "admin" account... and log into test account I get a "Not authorized" error when I try to run something "Select circle_area(foo) from library.bar".

I can log into iSeries Navigator, navigate to schema > functions > permissions and change the permission for public from Exclude to All. bam it works.

How do I grant permission to all, either in the CREATE FUNCTION or after?

WernerCD
  • 344
  • 2
  • 6
  • 18

1 Answers1

2

Use the GRANT statement:

GRANT EXECUTE ON FUNCTION CIRCLE_AREA TO PUBLIC;
Ian Bjorhovde
  • 481
  • 2
  • 2