Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 597909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:19:54+00:00 2026-05-13T16:19:54+00:00

Task Retrofit an existing application to use a multi-tenant approach. It shall be possible

  • 0

Task

Retrofit an existing application to use a multi-tenant approach. It shall be possible to create tenants and each user’s session should reference exactly one active tenant. Each tenant should only be able to see and update his partition of the database schema.

Approach

  • Create an Oracle application context that contains the tenant id
  • Add a tenant id column to any table that should be scoped
  • Create a predicate function that returns “tenant_id = sys_context(‘tenant_context’, ‘tenant_id’)” for SELECT, INSERT, UPDATE and delete
  • Add an appropiate policy via dbms_rls to register the predicate function

This works like a charm without touching the existing application for SELECT, UPDATE and DELETE

Question

When inserting the tenant_id column doesn’t get set and a security exception comes up. Is there any way that is as sleek as the predicate function to always set security related fields? I’d rather not add triggers to 300+ tables.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:19:55+00:00Added an answer on May 13, 2026 at 4:19 pm

    Sometimes asking a question provides the answer. I wasn’t aware that you may use non-constant expressions in column’s default values, so

    alter table XXX
    add column tenant_id default sys_context('tenant_context', 'tenant_id');
    

    actually solves my problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I use the task, the property is only set to TRUE if the
Task: Application written in Delphi accepts a structure ( record in terms of Delphi)
Task: have a jailbroken iPhone need to write an application which would receive notifications
TASK : I have an existing xml document (UTF-8) which uses xml namespaces and
My task is to create a Zend Form from the next Html: <form method=post>
Task: implement paging of database records suitable for different RDBMS. Method should work for
The task is to take a list of tables which is changeable. Write a
The task is simple, and the answers might be many. But here goes: On
Simple task like make AJAX request , pass one parameter and return result, can
Is there a rake task for backing up the data in your database? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.