Hi Sir, I have a question about a function that I call in a before-header process to redirect to the appropriate page.
create or replace function redirect_page(p_user_name in varchar2) return varchar2 as v_redirect_url varchar2(100); branch_page table_1.PAGE%type; v_state table_1.STATE%type; v_finalpaper_id table_1.fpid%type; begin begin select fp.state, fp.page,fp.id into v_state, branch_page,v_id from table_1 fp left outer join users u on u.uuid=fp.uuid where lower(u.username)=lower(p_user_name); if v_state ='REQUESTED'then v_redirect_url:='f?p=100:95:&APP_SESSION.::NO::P95_ID:'||v_id; elsif v_state ='APPROVED'then v_redirect_url:='f?p=100:92:&APP_SESSION.::NO::P92_ID:'||v_id; end if;
exception when no_data_found then v_redirect_url:='f?p=100:1:&APP_SESSION.::NO::'; end; return v_redirect_url; end;
Now, when I call the function in the page, I get the 500 Internal Server Error
DECLARE v_redirect_url VARCHAR2(100); BEGIN v_redirect_url:=redirect_page_finalpapers(:session_user_name); htp.init(); owa_util.redirect_url(v_redirect_url); apex_application.g_unrecoverable_error := true; END;
I don't quite understand why this happening and would appreciate some help on here?
apex4ebs
Are you wanting to redirect to a different page within the same apex application ?
Ana
Yes this is what I want, regarding the state from the table I want to redirect to another page in the same application.
Vinish Kapoor
Use branch instead. Check the following post on how to create conditional branches to redirect to a specific page.
https://www.foxinfotech.in/2021/07/oracle-apex-after-login-redirect-page.html
Ana
I am not quite sure whether this is what fits the best here since my url depends on the state which I retrieve from the table. But in the post, the target page is already set manually...