Digital signage using SYS_CONTEXT

Version 11.2.0.3

I'm trying to create a view that refers to two identical paintings. The results will be presented only ever among the tables based on a variable SYS_CONTEXT.

The issue I see is however that the implementation plan is different when I use literals as opposed to a variable SYS_CONTEXT. The plan with literals is what I expect to see when I use SYS_CONTEXT as well. The difference between the 2 plans, is that the filter filter (NULL IS NOT NULL) appears for the SELECT that does not run. The following illustrates the problem:

create table tbl1 (id number, date_created date);

create table tbl2 (id number, date_created date);

insert into tbl1 values (1, to_date('20140114','yyyymmdd'));

insert into tbl2 values (2, to_date('20140115','yyyymmdd'));

insert into tbl2 values (2, to_date('20140115','yyyymmdd'));

COMMIT;

create or replace context tbl_switch using set_tbl_context;

create or replace procedure Set_Tbl_Context (p_Tbl_No in varchar2) as
Start
DBMS_SESSION.set_Context ('TBL_SWITCH', 'SWITCH_VALUE', p_Tbl_No);
end Set_Tbl_Context;
/

SQL > exec set_tbl_context ('2');

PL/SQL procedure successfully completed.

SQL > select sys_context ('TBL_SWITCH', 'SWITCH_VALUE') FROM DUAL;

SYS_CONTEXT ('TBL_SWITCH', 'SWITCH_VALUE')
----------------------------------------
2

SQL > set autotrace on
SQL > select * from tbl1 where 1 = 2
2 Union all the
3 select * from tbl2 where 2 = 2
4.

ID DATE_CREA
---------- ---------
2 15 JANUARY 14
2 15 JANUARY 14


Execution plan
--------------
Hash value of plan: 6123662

----------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT |      |     3.    66.     3 (100) | 00:00:01 |
|   1.  UNION-ALL |      |       |       |            |          |
|*  2 |   FILTER |      |       |       |            |          |
|   3.    TABLE ACCESS FULL | TBL1 |     1.    22.     3 (0) | 00:00:01 |
|   4.   TABLE ACCESS FULL | TBL2 |     2.    44.     3 (0) | 00:00:01 |
----------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):
---------------------------------------------------

2 - filter (NULL IS NOT NULL)

Note
-----
-dynamic sample used for this survey (level = 2)


Statistics
----------
16 recursive calls
0 db block Gets
Gets 36 compatible
0 physical reads
0 redo size
436 bytes sent via SQL * Net to client
364 bytes received via SQL * Net from client
2 SQL * Net back and forth to and from the client
0 sorts (memory)
0 sorts (disk)
2 rows processed

SQL > select * from tbl1
where the 2 ' 1'= sys_context('TBL_SWITCH','SWITCH_VALUE')
3 Union all the
4 Select * from tbl2
where the 5 ' 2'= sys_context('TBL_SWITCH','SWITCH_VALUE')
6.

ID DATE_CREA
---------- ---------
2 15 JANUARY 14
2 15 JANUARY 14


Execution plan
--------------
Hash value of plan: 687287648

----------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT |      |     5:    66.     6 (50) | 00:00:01 |
|   1.  UNION-ALL |      |       |       |            |          |
|*  2 |   FILTER |      |       |       |            |          |
|   5:    TABLE ACCESS FULL | TBL1 |     1.    22.     3 (0) | 00:00:01 |
|*  4 |   FILTER |      |       |       |            |          |
|   3:    TABLE ACCESS FULL | TBL2 |     2.    44.     3 (0) | 00:00:01 |
----------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):
---------------------------------------------------

2 - filter (SYS_CONTEXT ('TBL_SWITCH', 'SWITCH_VALUE') = '1')
4 - filter (SYS_CONTEXT ('TBL_SWITCH', 'SWITCH_VALUE') = '2')

Note
-----
-dynamic sample used for this survey (level = 2)


Statistics
----------
7 recursive calls
0 db block Gets
Gets 24 consistent
0 physical reads
0 redo size
436 bytes sent via SQL * Net to client
364 bytes received via SQL * Net from client
2 SQL * Net back and forth to and from the client
0 sorts (memory)
0 sorts (disk)
2 rows processed

Can anyone suggest why this is? In addition, the query with the variable SYS_CONTEXT does not two SELECT?

Thank you

That's exactly the plan that you want to see (although I must say I don't like the strategy that you are adopting).

If the sys_context value is 1 then line 2 will call line 3 to run, but line 4 will be short circuit and do not call the line 5

If the sys_content value is 2, then line 1 will be short-circuit and not dial 3, but call line 4 line 5

Update: your method is similar to an example I talked some time ago:conditional SQL & #8211; 3. Notebook of the Oracle and something similar is generated internally by the particularly specific optimizer transformation: conditional SQL | Notebook of the Oracle

It would not have been too difficult to set up a small test to see if this was true.

Concerning

Jonathan Lewis

Tags: Database

Similar Questions

  • Integragtion LDAP for DMM using Digital Signage

    We are investigating Active Directory via LDAP.  I've seen the documentation for the video portal, but not much on Digital Signage. Firstly does anyone have experience with this and its limits or gotcha?

    The real question that has been asked of me of our security organization is with respect to the requirements for change of password.  It is when the user ID password AD Exchange, modifies the DMM for this same user ID password?  If this is not the case, is it possible to do this?

    SLemaux

    Hello.

    You may find useful information on these topics in the "Configuring authentication settings" section of the user guide for the DMM 5.1 on Cisco.com. In this largest section, I think you will find the references of synchronization to be of particular interest.

    Please visit: http://www.cisco.com/en/US/docs/video/digital_media_systems/5_x/5_1/dmm/user/guide/admin.html#wp1088277

    Kind regards

    Gary

  • Someone at - he catches class Academy of Digital Signage?

    Hello.  I am encouraged to take this class, but I am concerned because I've never used photoshop, flash, etc.  That's how much a drawback for me?

    Did you find this class worth it? Information about this class would be great.

    Thank you

    Rose Ann

    Rose Ann,


    When I started working on the stuff of Digital Signage, I took the courses of the Academy.

    The course is set up well and has many laboratories.  I didn't know photoshop or the

    other applications, but laboratories will guide you step by step everything.


    Highly recommend if you novice to the stuff of Digital Signage.


    See you soon!


    T.

  • How can I resize a digital image using software of photo gallery to keep my digital images to be cut during printing on standard paper by a commercial processor? MP

    How can I resize a digital image using software of photo gallery to keep my digital images to be cut during printing on standard paper by a commercial processor? MP

    How can I resize a digital image using software of photo gallery to keep my digital images to be cut during printing on standard paper by a commercial processor? MP

    ====================================
    Sometimes the only resizing is not the answer because the
    the original size is different from the print size.

    You may need to crop photos to the size you want
    print to ensure that no clipping will occur. Cropping
    to a different aspect ratio will lose some parts of the picture but
    at least you have control over it.

    Windows Live Photo Gallery is a cropping tool.

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Can I sign a document with my digital signature using professionals DC smart card?

    Can I sign a document with my digital signature using professionals DC smart card?

    You mean certificate on your smart card, right of signature? If the certificate on your smart card is designed to sign then the answer is "Yes, you can. CA that issued a certificate place some fields that can restrict its use, say, as well as encryption, only signature or authentication of the server only, etc. The certificate on your smart card doesn't have to be no restrictions to use incompatible with signature for you to be able to sign with her. You can simply try to connect your smart card and watch if Acrobat accepts the certificate for the signature.

  • Measure the time of the rising edges of a digital stream using a USB-6341

    I have a DAQ USB-6341 map.

    I use Measurement Studio (writing code in c#) on a Windows 7 computer.

    I'm relatively new to the DAQ cards, programming, so I could ask something that is obvious (sorry if this is the case).

    I went out a stream of digital pulses to an analog output channel.  I wired this channel to one input of the meter channel.  I am able to measure the number of edges upward to the inlet of the meter channel (since the digial flow is continuous, the number of rising edges increases with time).

    I would like a time stamp of each rising transition and I like to keep these timestamps in a table without ever growing (or maybe bin these timestamps in a histogram).

    Set up the meter channel to provide the timestamp data? (rather than just count)

    Thank you for your help.

    WRB,

    The meter must be able to measure the relative time between the different edges of your signal.  To do this, you will take care to set the meter to measure time.  It will measure how long a full period of your signal takes.  You can configure edge that you want to start with.  You'll want to set up your timed 'implied' measure.  This sets up the meter to automatically take action whenever a period is over.  While it's not exactly a timestamp, you can find the distance between two edges by adding the time periods between the banks in question.

    I see another technique that you can use.  This would put the counter to edges of County one of the basics of time of your device (it has 100 KHz, 20 MHz and 100 MHz bases long).  Then configure the task to use your signal as a sample (configuration to use rising edge) clock.  Whenever the song occurs, you will get the number of ticks ticks selected timebase that took place at that time.  One thing to note here, however, is that the counters are 32-bit wide, so your code will have to manage the overthrow of this charge if you are using a fast time and base running for long periods of time.

    Hope that helps,

    Dan

  • Digital + 5V used as ext ref on APFI stability 0

    Anyone who has used the digital 5V on a multifunction (PCI-6259) to the a/o ext ref?  My main concern is the stability of voltage and AO / / Dig mass violation.

    Thank you all.

    Chris

    Hi Chris,

    In the Manual , it states that:

    You can use one of the OD <0..3>signals to the AO of reference for a

    different AO signal. However, you must connect externally this channel for

    APFI 0 or 1 APFI.

    If you want to have a control programmatically to your reference, it would be a better option.  Will it be an option for your application?

    Kind regards

  • BlackBerry Passport Digital River using SmartPost? !!!

    Digital River (shopblackberry.com) sent my Passport today, which should be a happy occasion. However, they delivered using FedEx Smartpost! A slow boat from China would happen earlier. Tracker from FedEx says delivery will be 10/14, which is 8 days now! Not a happy camper! Come on BlackBerry, let no DR screw up a good thing!

    @ppetroska & @aiharkness

    Thanks for your comments. I forwarded your comments along our team ShopBlackBerry which will be reaching out to all of you. Thank you for your patience and understanding!

  • Windows Media Center will not scan digital channels using a dual tuner (analog/digital)

    I have an AverMedia Volar Max tuner which is analog and digital double Windows 7 Professional
    Media Library 'sees' the tuner as an analog tuner and properly identifies all the analog channels, that I see on TV.
    However, none of the digital channels are detected. I have not found a way to "force" a search using QAM256 or any other research of digital formats.   Using the tuner, cable and connections the same BUT with a linux sotware (mythtv) all digital channels have been identified.
    Is the problem because its analog and digital modes? How can I force Media Center to see the digital capacity of the tuner?

    Might have been a better place to look for information on the AverMedia Max Volar tuner AverMedia USA site.

    If you had looked here to find the latest drivers or to read support information, you would have found:

    The support of the AVerTV Hybrid Volar MAX QAM signals on Microsoft Windows Media Center?

    Currently, Microsoft Windows Media Center does not signal QAM. You will need to use our AVer Media Center in order to receive the QAM signal. Please download the application on our website programs:

    http://www.aver.com/mpd/support/download/combopcie.html

  • How to measure width of digital pulse using SMU-6548

    Measure the digital signal of high level pulse width (a few seconds)

    1US accuracy requirements

    Thank you

    Hello

    You can configure the trigger of the reference and the break, and you will get a table as below. Calculate the number of 1,
    The pulse width is N/clock.

  • Graph of digital signal using binary numbers.

    I need to generate digital signals 4.
    I have created a binary number which represents the 4 signals. (I don't know if I integrate it properly).

    Issues related to the:

    1. How can I represents the binary number (4 signals) in a digital chart?

    2 - is the right way to generate digital signals?

    I need something like this:

    Your code is meaningless.

    • Why you build an array with one element is there is always only one item?
    • Why are you doing floating point operations dealing with whren of integers?
    • Your VI does not have a digital signal graph.

    Try something like the joint to rotate the pieces...

  • How to generate a square wave of continuous digital output using USB 6343?

    I need to generate a square of 600 kHz from my 6343 wave.  The specifications indicate I could use PINS P2.0, but I get an error saying that it is not supported.

    Thanks in advance for your help.

    Jodi

    Dan,

    Thank you very much.  Counter method worked very well.

    Jodi

  • Identify the schema using sys_context (' USERENV', 'CURRENT_SCHEMA' ")

    DB version: 10.2.0.4

    I am trying to create a trigger that will follow all DDL in a particular schema.
    But the relaxation below does not seem to work. Don't know if
    ('USERENV', 'CURRENT_SCHEMA') 
    is the right way to identify the schema where the DDL has occurred.
    create or replace trigger sys.mytest_trg after ddl on database
    declare
    v_sch_name varchar2(350);
    begin
    
    SELECT sys_context('USERENV', 'CURRENT_SCHEMA') into v_sch_name FROM dual;
    
    if v_sch_name = 'PRODSCHEMA'
    then
    --insert into SCOTT.test21 values (v_sch_name);
    --commit;
    dbms_output.put_line ('You just performed a DDL in PRODSCHEMA');
    end if;
    
    end mytest_trg;
    /

    Why not simply refers to ora_dict_obj_owner?

    Refer to the documentation:
    http://download.Oracle.com/docs/CD/B10501_01/AppDev.920/a96590/adg14evt.htm

  • MISP track changes made to a digitized table used during the conversion?

    I need to convert several databases in AL32UTF8, which is 2 TB or so of size.  I want to reduce the outage window.  Most of the data is ASCII, but the character set is WE8ISO8859P15, so it is possible to get the non-ascii character in there.  My plan was to analyze the database while it is live, then run MISP during the blackout without a full re-analysis.  But I fear that a non-ascii character could go in there from scanning the failure.  The MISP track changes since the last scan, so just check the lines that have been added or changed since the scan?  In my tests limited until now, so it seems that complete analysis would take longer than the window of failure, a progressive solution would be wonderful.  However, I don't see how to make this happen.


    Thank you

    Mike has

    No, the CDS is not currently able to track incremental changes. However, you could try to categorize paintings like those who can get new non-ASCII characters and those who cannot. The fact that a given table has at least one non-ASCII character is a pretty good approximation of this classification. In this way, you could just rescan the tables which are likely to get new non-ASCII characters. Depending on the size of the problem tables this may shorten the time to restart the analysis considerably.

    Note that all need conversion CLOB columns, even if they contain ASCII only.

    To minimize the window of downtime, we recommend a solution with GoldenGate. GoldenGate is, however, not a free product.

    Thank you

    Sergiusz

  • Specify the end point for the digital using an output circular buffer

    When you use DAQmx and a NOR-DAQ for issuance of a digital signal using a circular buffer (buffer Renault). The program works and works, but when the 'DAQmx Stop Task.vi' function is called to end the task, he stops at the output buffering as soon as it is called and does not wait until the buffer pointer reaches the final value in the buffer. I would like that the program to wait until the buffer pointer is on the last value in the buffer, does anyone know how to specify this setting?

    If you need to stop on exactly the last sample output you will need a way to trigger the stop in the material.  The options available to you will depend on what hardware DAQ, you use, but here are some possibilities on the top of my head:

    1. set up a digital output redeclenchables task finished (not all hardware supports).  Set up a counter of output to issue a periodic trigger with the necessary synchronization signal such that the end result is a "continuous" digital output without interruption.  When you stop your loop, stop the task of counter - digital output ends his generation but the trigger signal will be removed and so it will not continue after that.

    2. If you have an unused extra digital output line, add it to your task.  This line should exit 0 all except the last sample.  Physically, this additional digital line in a wire line PFI and use it to trigger a meter output.  Have the output counter generate a single pulse of some long-term (long enough to ensure that the software can respond prematurely).  Use the output from the task of counter as a trigger of break for the task of digital output.  Do not start the task of the meter until you leave your loop.  Do not stop the task of digital output until you have detected in the software that the meter has been triggered.

    If you need to stop on approximately the last sample output, you could query the TotalSamplesPerChannelGenerated property after leaving your loop and only stop the task once it reaches a multiple of the size of your circular buffer.  This is no guarantee that it stops on the last sample (if you use a device on a bus with a latency higher as USB or Ethernet the non-determinisme would be worse).

    Best regards

Maybe you are looking for