---
title: "Discussion on \"Building Multi-Tenant APEX Apps\" | Hashnode"
description: "Discussion on \"Building Multi-Tenant APEX Apps\". Learn how to leverage the apex_session.set_tenant_id PL/SQL API and the APEX$SESSION Application Context to build Multi-Tenant APEX Applications"
url: "https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building Multi-Tenant APEX Apps](https://blog.cloudnueva.com/multi-tenant-apex-apps?utm_source=hashnode&utm_medium=feed)

Learn how to leverage the apex\_session.set\_tenant\_id PL/SQL API and the APEX$SESSION Application Context to build Multi-Tenant APEX Applications

Jun 8, 2023 · 6 min read · blog.cloudnueva.com  
Read the article

-   [#orclapex](https://hashnode.com/tag/orclapex)
-   [#oracle](https://hashnode.com/tag/oracle)

## Written by

[Jon Dixon](https://hashnode.com/@orclapex)

@orclapex · San Diego, CA

  
[View profile](https://hashnode.com/@orclapex)

APEX, ORDS & the Oracle Database

I’m Jon Dixon, an Oracle APEX developer and consultant at Cloud Nueva. I write about APEX, ORDS, the Oracle Database, and how AI is changing the way we build software. This blog is where I share practical examples, lessons learned, and ideas from my work.

## Responses 3

Markdown supported · ⌘↵ to post

[SJN](https://hashnode.com/@shyam-n)

[Sep 28, 2024](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/66f7e92334cbfd822417683b)

Hi! gone through the Multitenant info. if Oracle APEX give the options to create tenant and at login we can set the tenant id and in application or query from background it will tenant id default in all our query so it will be treat as low code. Share your views.

[Jon Dixon](https://hashnode.com/@orclapex)

[Sep 28, 2024](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/66f7e92334cbfd822417683b#reply-66f7ff745c94d68f4548856c)

APEX has no setting to make it magically aware of your tenant. APEX must know which columns on your tables/views must be filtered. You can add = SYS\_CONTEXT('APEX$SESSION,' 'APP\_TENANT\_ID') in your create view statements, etc., so they only show data for that tenant. See the Secured Views section of this post.

[SJN](https://hashnode.com/@shyam-n)

[Sep 28, 2024](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/66f7e92334cbfd822417683b#reply-66f82267dd94e8bef424be7f)

[Jon Dixon](https://hashnode.com/@orclapex) Thanks for reply. I agreed your solutio but I am thinking in some other way , at the time of login we can set the tenant id then in any table or view we do not need to put the common where clause Oracle APEX automatically append or add tenant id and filter data based on the tenant ID so this will reduce the risk of missing the where clause in any table,chart, forms, reports etc.

[Cezar Rosaneli](https://hashnode.com/@rosaneli)

[Oct 30, 2023](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/6540049f503f3d9ea16915c9)

HI, In my case, the customer have access to many companies, and he can change the company on a select menu on top navigation bar. How can I change the tenant\_id without forcing the user to logout and login again? Tks!

[Jon Dixon](https://hashnode.com/@orclapex)

[Oct 31, 2023](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/6540049f503f3d9ea16915c9#reply-65406e5875a4d299aca39340)

Hi Cezar. Unfortunately, you can only call APEX\_SESSION.SET\_TENANT\_ID once per session. It would be great if this were not a limitation but it is right now.

[Cezar Rosaneli](https://hashnode.com/@rosaneli)

[Nov 2, 2023](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/6540049f503f3d9ea16915c9#reply-6542fb919ba50faa874074e3)

Tks Jon!

[Mohamed Sameer](https://hashnode.com/@samfaj1255)

[Jul 1, 2023](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/64a041ef2eab00c6bef0609f)

Beneficial post.

[Jon Dixon](https://hashnode.com/@orclapex)

[Jul 1, 2023](https://hashnode.com/posts/multi-tenant-apex-apps/6481d2d8acac168041180051/comment/64a041ef2eab00c6bef0609f#reply-64a070ab8db091c401033e53)

Thank you, Mohamed.
