Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use the GRANT statement:

GRANT EXECUTE ON FUNCTION CIRCLE_AREA TO PUBLIC;
share|improve this answer
    
I knew it was something close to that :) Thanks –  WernerCD Jun 24 '11 at 14:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.