2

so I'm kind of new to apex and If I had a log in page and a certain user logs in that belongs to a certain group... say customers? Well if they log in , it would redirect them to a customer application.. and this is what I'm currently trying to achieve but it doesn't work ):

This is my code, can you tell me why it doesn't work and a solution to it?

DECLARE
VAL BOOLEAN;
BEGIN 
IF
VAL := APEX_UTIL.CURRENT_USER_IN_GROUP(p_group_name=> 'Customer') 
RETURN TRUE
THEN

htp.init;
owa_util.redirect_url('f?p=&Custlogin.:1:&APP_SESSION.');
apex_application.stop_apex_engine;

END IF

END;    
4

1 回答 1

2

您的 IF 语句不太正确;RETURN 用于停止处理(并返回一个值,如果它是一个函数)。我认为你需要这样的东西:

Apex 4.1 或更高版本

BEGIN 
  IF APEX_UTIL.CURRENT_USER_IN_GROUP(p_group_name=> 'Customer') 
  THEN    
    htp.init;
    owa_util.redirect_url('f?p=&Custlogin.:1:&APP_SESSION.');
    apex_application.stop_apex_engine;    
  END IF;    
END;

Apex 4.0 或更早版本

BEGIN 
  IF APEX_UTIL.CURRENT_USER_IN_GROUP(p_group_name=> 'Customer') 
  THEN    
    htp.init;
    owa_util.redirect_url('f?p=&Custlogin.:1:&APP_SESSION.');
    apex_application.g_unrecoverable_error:= true;    
  END IF;    
END;
于 2013-05-24T05:18:20.603 回答