PL/Sql RESULT_CACHE Function under VPD environment

Hi,
Imagine that I have a VPD environment that depending on the user the data returned from the table in a schema is different than returned to other user. for instance:
The VPD filters the data by company_id in this table
table persons
company_id number(4),
person_id number(4)
person varchar2(100)
now imagine that I connect as scott and scott belongs company_id 1000. If scott runs select * from schema.persons he will see this
1000 123 ANNA
1000 124 MARY
1000 125 SCOTT
If I connect as JOHN and JOHN belongs to company_id 1111. If scott runs select * from schema.persons he will see this
1111 123 ALBERT
1111 124 KEVIN
1111 125 JOHN
This is the VPD environment I have...
So, does RESULT_CACHE functions works well under this type of environment? RESULT_CACHE is shared between sessions... but in this case the sessions of scott and john see always different results. Is there any option of implementing RESULT_CACHE by username?
Regards
Ricardo

It appears that the result cache functionality can work with Virtual Private Database. Check out the following links:
Adventures with VPD I: Result Cache
Concepts: Result Cache

Similar Messages

  • SQL query, function or SP for converting varbinary to image(.jpg format).

    Dear Sir/Mam
    I want SQL query, function or SP which converts binary data to image (.jpg format).
    I m able to convert image (.jpg format) to varbinary. But not able to convert vice versa.
    thanks in advance.

    Binary data is binary data - "image" is only an intrepretation of binary data.  Therefore your question makes little sense in the context of sql server since it does not have any facilities to utilize images.  Since you provide no context, I'm
    guessing that you are trying to retrieve an image stored in the database in a varbinary column and have your application use it as an image.  If so, you should post your question to a forum that is specific to your development environment.  

  • Does a table/view still return records if the underlying VPD policy fails ?

    Hi All,
    I have one following question -
    Does a table or view still return records if the underlying VPD policy fails?
    I am adding one more thing here. Let us say security is being implemented using the application context and VPD.
    What would happen when application context is not set ? Would the application apply any default privilege as VPD?
    Thanks,
    Ashi

    AshiKD wrote:
    Hi All,
    I have one following question -
    Does a table or view still return records if the underlying VPD policy fails?No, you get a standard error message if the VPD function is wrong and if you won't pass the conditions of the VPD, you get nothing. That's what in general happens and should happen as well.
    >
    I am adding one more thing here. Let us say security is being implemented using the application context and VPD.
    What would happen when application context is not set ? Would the application apply any default privilege as VPD?This would be a wrong approach then. If you are truly setting a VPD, you have to make sure that the context is set and the condition variable are passed through it. This is normally done through a logon trigger so again, generically , its not possible that it would not be set. I didn't get at all what ever you said in the last line? What is "default priv for VPD" ?
    HTH
    Aman....

  • [Q] Login failure under CDE environment

    All..
    I set up the new SUN UNIX server (SUN v440, SunOS 5.8).
    It is set NIS,NFS etc environment and Now I can access the server via telnet, ftp.
    However, when I try to access under CDE environment through X-termial (such as Exceed), I cannot log in the UNIX server.
    Usually DT login trouble that I met is caused by network trouble.
    But in this case, I can connect that UNIX server via telnet, ftp. And network configuration is set correctly.
    I have no clue how to solve this trouble.
    Would anyone let me know what I should check out or investigate ?
    Thanks in advance.

    Hi,
    Its good that u pasted the complete log file. In your environment you have to run this upgrade tool only once from any of the middle tier.
    And with respect to your error that u got in precheck is quite simple. All u have to do is just run this script from by connecting to portal schema using sqlplus.
    Run dropupg.sql
    Location-------- /raid/product/OraHome_1/upgrade/temp/portal/prechktmp/dropupg.sql
    Later you re-run the upgrade tool and let me know the status.
    Good luck
    Tanmai

  • Logical Operations in SQL decode function ?

    Hi,
    Is it possible to do Logical Operations in SQL decode function
    like
    '>'
    '<'
    '>='
    '<='
    '<>'
    not in
    in
    not null
    is null
    eg...
    select col1 ,order_by,decode ( col1 , > 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , <> 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , not in (10,11,12) , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 ,is null , 0 , 1)
    from tab;
    Regards,
    infan
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:09 AM

    example:
    select col1 ,order_by,case when col1 > 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 &lt;&gt; 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 not in (10,11,12) then 0 else 1 end
    from tab;As for testing for null, decode handles that by default anyway so you can have decode or case easily..
    select col1 ,order_by,decode (col1, null , 0 , 1)
    from tab;
    select col1 ,order_by,case when col1 is null then 0 else 1 end
    from tab;

  • How to Passing clob to PL/SQL pipeline function

    I have a PL/SQL stored function which takes clob as input parameter and sends the results in a pipe line.
    create or replace function GetIds(p_list clob, p_del varchar2 := ',') return ideset_t pipelined is
    I am using ojdbc14.jar (Oracle 10g driver) with oracle 9i (9.2.0.1.0).
    I want to use the following SQL Query select * from table(GetIds(clob))
    Now the question is how can I pass the clob from JDBC?
    Here is my client code
    PreparedStatement stmt = con.prepareStatement("SELECT COLUMN_VALUE FROM TABLE(GETIDS(?, ','))");
    stmt.setCharacterStream(1, new StringReader(str), str.length());
    stmt.executeQuery();
    I get the following error when I try to run the program. The same thing works fine if the chracter lenght is less than some chaaracters.
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2960)
         at Test.main(Test.java:42)
    Exception in thread "main"
    The setChracterStream works for any insert/update clob. Example when I tried the query (INSERT INTO CLOB_TEST VALUES(?)) setCharacterStream just works fine.
    Please any one can help me how to solve this.
    Thanks in advance.

    Hóla LuÃs,
    when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
    In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
    When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
    The error message text can be specified in the validation definition, if I am not wrong.
    When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
    Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
    Hope it helps,
    Flavio

  • I am new to LR and have it set up on a Mac desktop and laptop.  On the laptop, the Basic function under Develop simply disappeared.  I am lost.  Help.

    Question:  I am new to LR and have it set up on a Mac desktop and laptop.  On the laptop, the Basic function under Develop simply disappeared.  I am lost.  Help.

    It's a common issue. The Basic panel is merely hidden.
    Hiding/unhiding panels is actually a feature of Lightroom but it is unintuitive - few people know it exists - so most newcomers are thrown when a panel somehow gets hidden.
    Right-click anywhere in the right hand side panel area and a context menu will appear.
    Click the Basic option to make the Basic panel re-appear.

  • How to keep track of EJBs in case of failover under clustered environment?

    Does anybody know what happens with a stateless session EJB in
    weblogic 5.1 under clustered environment, in case of a failover (if
    one of computers dies), the one, which keeps that ejb in a pool?
    Does that EJB automatically go to the state "does not exist"?
    Is method ejbRemove() then called on that EJB?
    Or is it still in the "method-ready pool" state? Without ejbCreate()
    method being called on this EJB?
    Or does it disappear completely without those methods being called on
    this EJB?
    I need to organize some kind of tracking for those EJBs, and it is
    critically important for me to understand what exactly methods are
    called on those EJBs.
    I saw this, but it does not answer my question:
    Clustered EJB
    All EJBs are clusterable. If an EJB is deployed on multiple servers in
    the cluster, each of these servers will be able to host instances of
    the bean. This does not necessarily mean, however, that the bean
    instances are clustered.
    EJB Homes
    All bean homes are clusterable. When a bean is deployed on a server,
    its home is bound into the cluster-wide naming service. Because homes
    are clusterable, each server can bind an instance of the home under
    the same name. When a client looks up this home, it gets a
    replica-aware stub that has a reference to the home on each server
    that deployed the bean. When create() or find() is called, the
    replica-aware stub routes the call to one of the replicas. The home
    replica that receives the finds or creates an instance of the bean on
    its server.
    Stateless EJBs
    When a home creates a stateless bean, it returns a replica-aware stub
    that can route to any server on which the bean is deployed. Because a
    stateless bean holds no state on behalf of the client, the stub is
    free to route any call to any server that hosts the bean. Also,
    because the bean is clustered, the stub can automatically fail over in
    the event of a failure. The stub does not automatically treat the bean
    as idempotent, so it will not recover automatically from all failures.
    If the bean has been written with idempotent methods, this can be
    noted in the deployment descriptor and automatic fail-over will be
    enabled in all cases.
    Thanks

    Check out Java's support for udo/redo: [http://java.sun.com/javase/6/docs/api/javax/swing/undo/package-summary.html]
    Also, google the "Memento Pattern".
    You don't have to make copies of objects, just maintain commands the can undo and redo your program's state.

  • Query of queries disallows SQL right() function

    We're attempting to do a query of queries using the SQL
    right() function like this:
    select *
    from getresults
    where right([key],charindex('\',reverse([key]),1)-1) not in
    (#quotedvaluelist(getexcluded.file_name)#)
    We've even replaced that where clause with a much more simple
    where right([key])='m'
    just to make sure that it wasn't the nesting functions that
    were causing the problem.
    In either case, we get the error:
    Query of Queries syntax error.
    Encountered "right" at line 0, column 0. Incorrect
    conditional expression,
    Expected one of [like|null|between|in|comparison] condition,
    What SQL functions are disallowed from query of queries?
    Thanks,
    Kris

    Nasty stuff huh. Just happened to discover myself today that
    Left doesn't work. I'd suspect that Aggregate functions are the
    ONLY ones that will work. It would have been nice if they'd at
    least allowed CF vs DB functions in their own "database" language.
    BTW, also discovered that Count() returns Null rather than 0
    when there aren't any per your WHERE clause.

  • Disable Wizard (limited functionality) under Analysis Editor Preference Tab In OBIEE

    Hai Experts
    I want to disable this option(Disable Wizard (limited functionality) under Analysis Editor Preference Tab) for all users globally.
    This option should not appear in Preference tab of OBIEE
    Regards
    Saurabh Anand

    Hi,
    It is a standard application privilege you can find and set under "Administration" -> "Manage Privileges":

  • Chart - problem with realize one of the function under CR XI

    Post Author: mrowa
    CA Forum: Charts and Graphs
    Hello,
    I have
    problem with realize one of the function under CR XI. I would be persuade if
    any of us would like to help me.
    1)   
    1) From
    database (basically from one table), I take data to make report. Each of record
    have appropriate fields:
    dteData
    intYear
    intMonth
    intDate
    2)   
    2) I
    want to realized comparison data from two or more periods of time on one chart
    and in one table. For easily explanation I will describe problem on two
    periods.For instance, user want to display and compare
    on chart date (type monthly -sum data of each month) from 2007.02 u2013 2007.05
    with date from 2006.03 u2013 2006.06. So we compare month 2007.02 with 2006.03;
    2007.03 with 2006.04; 2007.04 with 2006.05; 2007.05 with 2006.06
    On char I would like to display bars with comparison
    of months.
    Problem is that I donu2019t know how to write
    something similar. I can use one period without any problems, but two and mores
    I canu2019t realized.
    Detail description:
    I passed
    two parameters two report:
    {?from}, {?to} u2013for first period
    {?offset}, it means {?from}+{?offset},
    {?to}+{?offset}  - for second period
    On axis Y I have Sum(intDate);On
    X (year + month). But on each value x( example 20007.02) I need to have
    two values (bars). Value for standard period and offset.
    For example for x=2007.02, I need
    two bars one equal 2007.02 and second with offset u2013 2006.03
    Movement to next value (bar) is
    persuade by fields {data.rok}&{data.month} first or second period. This is
    combination of two elements year&month defined under Formula. Problem
    persist in that both period has different year.month and here problem starts once
    again. I donu2019t know how to solve it. I have found out one solution but it
    limits user only for two periods (I want to compare more).
    My idea for compare only two
    periods:
    I make one query in CR for one
    period and second query for second period.
    Firs query:
    "SELECT 
           year ,
          month
    Second query
    "SELECT 
           year + FLOOR({month + offset} % 13),
          {month + offset} % 13
    Then in CR I connect two periods and
    make u201Ctableu201D (results of queries) with JOIN on fields year and month.
    This solution is not functional,
    because I need to make reports for days and hours as well. In this solution I
    canu2019t use (%31), because not all months has 31 days.
    I use CR in WEB app made in Visual
    Studio 2005. Maybe from aspx we can manipulate with date to get exact solution,
    and solve problem with SELECT.
    Hope my description clearly
    describe problem and someone will be able to help me. I would be thankful.

    I have had similar problem before.
    Because I had too many data, the legend would not display all the data. Also the chart would not display all the data. But I was able to find a work around.
    In your case, Right click on the Legend text and click on Format Legend Entry.
    Change the font of the legend to 4 (which is the minimum). This may work.
    If you are also having problem with data labels, you could change the font size of the data labels.
    Hope this helps.
    Thank you.

  • Incorrect syntax errors in sql server function. Please help.

    This is my sql server function:
    create function dbo.CleanTheStringAdv (@theString nvar
    char(500), @CleanMode as int) 
    returns nvarchar(500)  
    begin  
    --define variables
    declare @strAlphaNumeric nvarchar(500)  
    declare @i int
    declare @strChar nvarchar(500)
    declare @CleanedString nvarchar(500)
    --initiate values
    set @CleanedString =''  
    set @theString = @theString + ''
    SET @i = 1
    --Determine if we are looking for numeric values only or numbers and letters
    return case @CleanMode
       WHEN 1
       THEN @strAlphaNumeric = '0123456789'
       WHEN 2
       THEN @strAlphaNumeric = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
       WHEN 3
       THEN @strAlphaNumeric = '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
       else 0
     end 
    --Search through chars in the string passed to the function
        while (@i <= Len(@theString))
    begin
    @strChar = substring(@theString, @i, 1)
    If (charindex(@strAlphaNumeric, @strChar) <>0)
    --if the current char being reviewed is valid then add it to the new string
    begin
    @CleanedString = @CleanedString + @strChar
    end
    end
    return @CleanedString
    and below are the syntax errors I see when I press F5:
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 24
    Incorrect syntax near '='.
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 39
    Incorrect syntax near '@strChar'.
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 43
    Incorrect syntax near '@CleanedString'.
    Any help is highly appreciated.....

    Here is the full code for the function:
    create function dbo.CleanTheStringAdv (@theString nvarchar(500), @CleanMode as int)
    returns nvarchar(500)
    as
    begin
    --define variables
    declare @strAlphaNumeric nvarchar(500)
    declare @i int
    declare @strChar nvarchar(500)
    declare @CleanedString nvarchar(500)
    --initiate values
    set @CleanedString =''
    set @theString = @theString + ''
    SET @i = 1
    --Determine if we are looking for numeric values only or numbers and letters
    SET @strAlphaNumeric = case @CleanMode
    WHEN 1
    THEN '0123456789'
    WHEN 2
    THEN '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    WHEN 3
    THEN '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    else 0
    end
    --Search through chars in the string passed to the function
    while (@i <= Len(@theString))
    begin
    set @strChar = substring(@theString, @i, 1);
    If (charindex(@strAlphaNumeric, @strChar) <>0) --if the current char being reviewed is valid then add it to the new string
    begin
    SET @CleanedString = @CleanedString + @strChar;
    end
    END
    return @CleanedString;
    END

  • Problem with SQL Convert Function Junk Character

    Hi All,
    We have a database field that has a value of “2.020 OPERATOE’S CAB – GLASSES” on the front end of Oracle E-Business Suite. When we are spooling that column(in PLSQL) with the SQL covert function , one of the characters(’) in the string is not getting converted properly. It is displayed as a junk character in the spooled file.
    We used CONVERT(p_column,'WE8ISO8859P1','UTF8') for converting the string and utl_file api for spooling the output file. Please note that converted string is passed to utl_file.fopen directly.
    Following are the nls_parameters values.
    NLS_CHARACTERSET ~~ UTF8
    NLS_NCHAR_CHARACTERSET ~~ AL16UTF16
    Any inputs are welcome.
    Thanks
    gt1942

    Hello All,
    Sorry, If I am opening the blog in the wrong place as this is the first time.
    my out looks as follows.
    "02920  "
    but when i see in the application there is nuthing in the end.
    so I used regexp_replace(p_vendor_dtl,'[^[!-~]]*',''), But this is removing spaces also. I don't want to remove space. I want to remove this character only.
    Please help
    Thanks.

  • Sql like function in View Object for progammatically

    Hi friends,
    I used Jdeveloper 11.1.1.4.0 ,I need how to get the datas from database using sql like function(select * from tablename where name like 'p%') using viewCriteria by
    programmatically.
    Thanks & Regards,
    Priya.
    Edited by: priya on Apr 8, 2011 3:48 AM
    Edited by: priya on Apr 8, 2011 3:49 AM

    Check the docs: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#sm0341
    Timo

  • Use of Pl/Sql and Function

    Hi,
    Can we use a PL/Sql package or a Function in a sql query. If yes How.??
    Regards
    Sameer

    Sameer8 wrote:
    Can we use a PL/Sql package or a Function in a sql query. If yes How.??A function (whether declared in a package or a stand alone stored function) may be used in SQL providing it does not contain any OUT parameters...
    SQL> create function testf(x OUT number) return number is
      2  begin
      3    x := 1;
      4    return 2;
      5  end;
      6  /
    Function created.
    SQL> var my_x number
    SQL> select testf(:my_x) from dual;
    select testf(:my_x) from dual
    ERROR at line 1:
    ORA-06572: Function TESTF has out argumentsAnd it doesn't do any DML...
    SQL> create table x (x number);
    Table created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function testf return number is
      2  begin
      3    insert into x values (1);
      4    return 1;
      5* end;
    SQL> /
    Function created.
    SQL> select testf() from dual;
    select testf() from dual
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "SCOTT.TESTF", line 3

Maybe you are looking for

  • Deleting file from .jar file

    I m having trouble with the Forum search, so sorry if this question has been answered before in this forum. If I create a .jar (or an .ear) file, then open the file using Winzip and then delete a file from the zip, does it corrupt the .jar file? I ra

  • HT4623 My iPad 4 will not update. I keep getting an error message. I have reset my device. Used iTunes. I still get the same message

    My I pad4 will not update. Keep getting error message. I have reset it and hooked up to iTunes . I still get the same message.

  • Sub Contracting Operation Problem

    Hi frnds, I'm facing problem related with GL Account. Dears I'm going to create Automatic Purchase Requsition for material which is manufactured Externally by Vendor but the RAW Material is given by us means I want to create Sub contracting PO and on

  • JAVA Drawing Graphics Save as JPEG?

    My problem is this, I am trying to save my g2 graphic image to a jpg. This is how I have things setup, I will show code and my thoughts. What I need is help to figure out how I could save seperate .java files graphics g to the jpg format from a JFile

  • Why won't my computer play my dvd?

    so i was watching a movie and in the middle the movie stopped and said there is not disc in the the drive. i didnt touch the disc drive and i know its not the disc because they are brand new. i just bought them. now i let me computer cool down and it