Creating an Application Express URL from Scratch

In this case I had to dynamically choose the page to branch to and set 2 parameters dynamically... You will need to update the variables for your particular application, but this includes all the placeholders for the different sections of the URL. Use the "Branch To Function Returning URL" type of branch and modify the following code to suit your application:
DECLARE
  my_url VARCHAR2(256) := 'f?';
BEGIN
  -- Application
  my_url := my_url || 'p='||v('APP_ID') ||':';
  -- Page
  my_url := my_url || :P_TARGET_PAGE || ':';
  -- Session
  my_url := my_url || v('APP_SESSION') ||':';
  -- Request
  my_url := my_url || v('REQUEST') || ':';
  -- Debug
  my_url := my_url || v('DEBUG') || ':';
  -- ClearCache
  my_url := my_url || ':';
  -- itemNames
  my_url := my_url || 'P'||:P_TARGET_PAGE||'_SELECT_START,';
  my_url := my_url || 'P'||:P_TARGET_PAGE||'_SELECT_END:';
  -- ItemValues
  my_url := my_url || :P_SELECT_START||','||:P_SELECT_END;

  return my_url;
END;