<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Eddie Awad’s Blog - Latest Comments in SYS_CONTEXT in Oracle</title><link>http://awads.disqus.com/</link><description>News, views, tips and tricks on Oracle and other fun stuff</description><atom:link href="https://awads.disqus.com/sys_context_in_oracle/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 23 May 2007 03:14:20 -0000</lastBuildDate><item><title>Re: SYS_CONTEXT in Oracle</title><link>http://awads.net/wp/2005/08/05/sys_context-in-oracle/#comment-3657797</link><description>&lt;p&gt;Hi All&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I have a database on which users can execute queries. To ensure they cant view each others information I want to execute this query first:&lt;br&gt;dbms_session.set_context('usernameParam', 'username', username);&lt;br&gt;I then want to create views that look like this:&lt;br&gt;CREATE OR REPLACE VIEW "MyView" AS SELECT * FROM "DB"."MyTable"&lt;br&gt; WHERE "Username" = SYS_CONTEXT('usernameParam', 'username')&lt;br&gt;/&lt;br&gt;I then want my clients to use the views instead of tables.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I am doing this using Java. I get a database connection. Using that connection I execute the set_context query. I am wandering, how thread safe is this? If 2 clients at the same time execute a query is it possible that the set_context will be execute in the wrong order and clients see each others information or does the set_context apply only to the current connection even thought the same username is used to connect to the database?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Pete Johnson</dc:creator><pubDate>Wed, 23 May 2007 03:14:20 -0000</pubDate></item><item><title>Re: SYS_CONTEXT in Oracle</title><link>http://awads.net/wp/2005/08/05/sys_context-in-oracle/#comment-3657796</link><description>&lt;p&gt;Execellent ... It is veryful for me.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SIVASANKARAN</dc:creator><pubDate>Wed, 14 Feb 2007 01:42:46 -0000</pubDate></item><item><title>Re: SYS_CONTEXT in Oracle</title><link>http://awads.net/wp/2005/08/05/sys_context-in-oracle/#comment-3657795</link><description>&lt;p&gt;Yes!&lt;/p&gt;&lt;p&gt;We're on the same page.  I discovered this handy thing around the same time:&lt;/p&gt;&lt;p&gt;&lt;a href="http://thinkoracle.blogspot.com/2005/07/which-instance-am-i-in.html" rel="nofollow noopener" target="_blank" title="http://thinkoracle.blogspot.com/2005/07/which-instance-am-i-in.html"&gt;http://thinkoracle.blogspot...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Very handy!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Robert Vollman</dc:creator><pubDate>Tue, 09 Aug 2005 19:51:55 -0000</pubDate></item><item><title>Re: SYS_CONTEXT in Oracle</title><link>http://awads.net/wp/2005/08/05/sys_context-in-oracle/#comment-3657794</link><description>&lt;p&gt;There is a similar function called `USERENV`. But based on the [documentation](&lt;a href="http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions162a.htm#1019148):" rel="nofollow noopener" target="_blank" title="http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions162a.htm#1019148):"&gt;http://download-west.oracle...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;USERENV is a legacy function that is retained for backward compatibility. Oracle Corporation recommends that you use the SYS_CONTEXT function with the built-in USERENV namespace for current functionality&lt;/blockquote&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eddie Awad</dc:creator><pubDate>Mon, 08 Aug 2005 18:20:33 -0000</pubDate></item></channel></rss>