1
votes

We have an Apex application (version 20.1) and our users must be able to change the database schema at runtime via button click (preferably without logging in again). Currently we are solving this by installing our application multiple times, once per schema.

We recently discovered the function apex_export.get_application. We intend to use this function to bring our frontend under version control (finally!). We would like to deploy our application directly from the exported files. Having a single application, we would not have to mess with the internal component ids from the exported files.

Is it possible to install the application once and change the default schema via Pl/SQL code? Thank you!

1
Glad you are going to version control! I doubt you can change the default schema via PL/SQL code, as the "default schema" is set at a workspace level, within an APEX application, and that schema is used pretty deep in the code. Please edit your question to include what APEX version. Thanks.Mark Stewart

1 Answers

1
votes

I don't think this can be done, but perhaps the following is a reasonable compromise

  1. add all the schemas you need to support to the workspace schema list
  2. Any SQL (and I do mean any) in your app would be prefixed with an application item, eg

Before: select * from my_table After: select * from &my_schema..my_table

  1. At login time (or when a user selects it) you modify the MY_SCHEMA application item

(I've not tried this...so test/tread carefully)