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 3437872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:07:05+00:00 2026-05-18T08:07:05+00:00

I have a Silverlight app that makes multiple (often concurrent) asynchronous calls to an

  • 0

I have a Silverlight app that makes multiple (often concurrent) asynchronous calls to an Oracle database. The largest database table stores around 5 million records. Below is a summary of how the Silverlight app works, followed by my question.

  1. The user sets query criteria to select a particular group of records, usually 500 to 5000 records in a group.

  2. An asynchronous WCF call is made to the database to retrieve the values in four fields (latitude, longitude, heading, and time offset) over the selected group of records (meaning the call returns anywhere from 2k to 20k floating point numbers. These values are used to plot points on a map in the browser.

  3. From here, the user can choose to graph the values in one or more of an additional twenty or so fields associated with the initial group of records. The user clicks on a field name, and another async WCF call is made to retrieve the field values.

My question is this: does it make sense in this case to store the records selected in step one in a temp table (or materialized view) in order to speed up and simplify the data access in step three?

If so, can anyone give me a hint regarding a good way to maintain the browser-to-temp-table link for a user’s session?

Right now, I am just re-querying the 5 million points each time the user selects a new field to graph–which works until the user selects three or more fields at once. This causes the async calls to timeout before they can return.

  • 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-18T08:07:06+00:00Added an answer on May 18, 2026 at 8:07 am

    We can do this using a CONTEXT. This is a namespace in session memory which we can use to store values. Oracle comes with a default namespace, ‘USERENV’, but we can define our own. The context has to be created by a user with the CREATE ANY CONTEXT privilege; this is usually a DBA. The statement references a PACKAGE which sets and gets values in the namespace, but this package does not have to exist in order for the statement to succeed:

    SQL> create context user_ctx using apc.ctx_pkg
      2  /
    
    Context created.
    
    SQL>
    

    Now let’s create the package:

    SQL> create or replace package ctx_pkg
      2  as
      3      procedure set_user_id(p_userid in varchar2);
      4      function get_user_id return varchar2;
      5      procedure clear_user_id;
      6  end ctx_pkg;
      7  /
    
    Package created.
    
    SQL>
    

    There are three methods, to set, get and unset a value in the namespace. Note that we can use one namespace to hold different valiables. I am just using this package to set one variable (USER_ID) in the USER_CTX namespace.

    SQL> create or replace package body ctx_pkg
      2  as
      3      procedure set_user_id(p_userid in varchar2)
      4      is
      5      begin
      6         DBMS_SESSION.SET_CONTEXT(
      7          namespace  => 'USER_CTX',
      8          attribute  => 'USER_ID',
      9          value      => p_userid);
     10      end set_user_id;
     11
     12      function get_user_id return varchar2
     13      is
     14      begin
     15          return sys_context('USER_CTX', 'USER_ID');
     16      end get_user_id;
     17
     18      procedure clear_user_id
     19      is
     20      begin
     21         DBMS_SESSION.CLEAR_CONTEXT(
     22          namespace  => 'USER_CTX',
     23          attribute  => 'USER_ID');
     24      end clear_user_id;
     25
     26  end ctx_pkg;
     27  /
    
    Package body created.
    
    SQL>
    

    So, how does this solve anything? Here is a table for the temporary storage of data. I’m going to add a column which will hold a token to identify the user. When we populate the table the value for this column will be provided by CTX_PKG.GET_USER_ID():

    SQL> create table temp_23 as select * from big_table
      2  where 1=0
      3  /
    
    Table created.
    
    SQL> alter table temp_23 add (user_id varchar2(30))
      2  /
    
    Table altered.
    
    SQL> create unique index t23_pk on temp_23(user_id, id)
      2  /
    
    Index created.
    
    SQL>
    

    … and over that table I create a view:…

    create or replace view v_23 as
    select 
             id
            , col1
            , col2
            , col3
            , col4
    from temp_23
    where user_id = ctx_pkg.get_user_id
    /
    

    Now, when I want to store some data in the table I need to set the context with a value with uniquely identifies my user.

    SQL> exec ctx_pkg.set_user_id('APC')
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    This statement populates the temporary table with twenty random rows:

    SQL> insert into temp_23
      2  select * from
      3      ( select b.*, ctx_pkg.get_user_id
      4        from big_table b
      5        order by dbms_random.random )
      6  where rownum <= 20
      7  /
    
    20 rows created.
    
    SQL>
    

    I can retrieve those rows by querying the view. But when I change my USER_ID and run the same query I cannot see them any more:

    SQL> select * from v_23
      2  /
    
            ID       COL1 COL2                           COL3            COL4
    ---------- ---------- ------------------------------ --------- ----------
        277834       1880 GV_$MAP_EXT_ELEMENT            15-OCT-07       4081
        304540      36227 /375c3e3_TCPChannelReaper      15-OCT-07         36
       1111897      17944 /8334094a_CGCast               15-OCT-07         17
       1364675      42323 java/security/PublicKey        15-OCT-07         42
       1555115       3379 ALL_TYPE_VERSIONS              15-OCT-07          3
       2073178       3355 ALL_TYPE_METHODS               15-OCT-07          3
       2286361      68816 NV                             15-OCT-07         68
       2513770      59414 /5c3965c8_DicomUidDoc          15-OCT-07         59
       2560277      66973 MGMT_MNTR_CA                   15-OCT-07         66
       2700309      45890 /6cc68a64_TrustManagerSSLSocke 15-OCT-07         45
       2749978       1852 V_$SQLSTATS                    15-OCT-07       6395
       2829080      24832 /6bcb6225_TypesTypePair        15-OCT-07         24
       3205157      55063 SYS_NTsxSe84BlRX2HiXujasKy/w== 15-OCT-07         55
       3236186      23830 /de0b4d45_BaseExecutableMember 15-OCT-07         23
       3276764      31296 /a729f2c6_SunJCE_n             15-OCT-07         31
       3447961      60129 HHGROUP                        15-OCT-07         60
       3517106      38204 java/awt/im/spi/InputMethod    15-OCT-07         38
       3723931      30332 /32a30e8e_EventRequestManagerI 15-OCT-07         30
       3877332      53700 EXF$XPVARCLST                  15-OCT-07         53
       4630976      21193 oracle/net/nl/NetStrings       15-OCT-07         21
    
    20 rows selected.
    
    SQL> exec ctx_pkg.set_user_id('FOX_IN_SOCKS')
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from v_23
      2  /
    
    no rows selected
    
    SQL>
    

    So, the challenges are:

    1. to establish a token which you can use automatically to uniquely identify a user
    2. to find a hook in your connecting code which can set the context each time the user gets a session
    3. just as importantly, to find a hook in your dis-connecting code which can unset the context each time the user leaves a session

    Also, remember to clear out the table once the user has finished with it.

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

Sidebar

Related Questions

For example: First, say I have a Silverlight app with Windowless=true so that I
I have a Silverlight app that displays a number of pages. Each page is
I have a Silverlight app that has a bunch of styles that are referenced
Basically I have a silverlight web App that resides within an IFrame. and that
I'm writing a Silverlight app using the MVVM pattern. I have a main view
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I have a Silverlight 2 application that is consuming a WCF service. As such,
We have a Silverlight 2 project (game) that will require a lot of character
I have a Silverlight application that is built from a set of Silverlight class
I have a Silverlight control that tries to have the same background as the

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.