Accessing a Cache From an Oracle CQL User-Defined Function

According to the docs ...
I am to use the following element to set the cache property in my bean...
<wlevs:property name="cache" ref="cache-id"/>
However, when I set it, the assembly does not validate.
If I use <property>, I get a NullPointerException on each request when my processor runs.
Using the same CQL code..
Without the <property> tag, the call to the user-defined function works (but I don't have the cache attribute set obviously).
Here is the excerpt from my assembly...
<bean id="cacheFunction" class="ou.cep.function.CacheFunction">
<property name="cache" ref="myCache"/>
</bean>
<!-- The default processor for OCEP 11.0.0.0 is CQL -->
<wlevs:processor id="myProcessor">
<wlevs:listener ref="CacheChannel"/>
<wlevs:function ref="cacheFunction" function-name="isValidID" exec-method="isValidID">
</wlevs:function>
</wlevs:processor>
To repeat, with the same CQL with the user-defined function call, if I remove the property element from the bean definition, I can call the function successfully (it just doesn't do what I need it to do). In this case, I am still using the ref=cacheFunction for the wlevs:function within the processor.
What am I doing wrong?
Edited by: fl0at on Oct 5, 2010 12:22 PM
Edited by: fl0at on Oct 5, 2010 12:28 PM

The case is solved, not sure I could explain why, but...
This implementation of the user-defined function was a migration from an implementation using the same cache in the join. So, when I removed the cache reference in the source stream (where I am now executing a function that accesses the cache), the problem went away and everything is working.
I can explain further if there are questions.
If anyone has thoughts on this, please advise.
As always, thanks for the help.

Similar Messages

  • Access to whole payload in user defined function

    Hi,
    is there a way to access the whole XML payload in a user defined function or is it necessary to employ a Java mapping?
    Kind regards,
    Heiko

    Hi,
    did you have a look at this weblog:
    Own Logging of XI Messages
    /people/udo.martens/blog/2006/02/16/own-logging-of-xi-messages
    by Udo Martens?
    it's a complete solution to your issue
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • 10g - cache, report contains oracle user defined function

    hi, experts,
    from http://obiee101.blogspot.com/2008/07/obiee-cache-management.html
    Reasons Why a Query is Not Added to the Cache:
    •Non-cacheable SQL element. If a SQL request contains Current_Timestamp, Current_Time, Rand, Populate, or a parameter marker then it is not added to the cache.
    •Non-cacheable table. Physical tables in the Oracle BI Server repository can be marked 'noncacheable'. If a query references any non-cacheable table then the query results will not be added to the cache.
    •Cache hit. In general, if the query gets a cache hit on a previously cached query, then the results of the current query are not added to the cache. The exception is query hits that are aggregate roll-up hits.
    •Result set is too big.
    Query is cancelled. This can happen by explicit cancellation from Oracle BI Presentation Services or the Administration Tool, or implicitly through timeout.
    •Oracle BI Server is clustered. Queries that fall into the ‘cache seeding’ family are propagated throughout the cluster. Other queries continue to be stored locally. Therefore, even though a query may be put into the cache on Oracle BI Server node 1, it may not be on Oracle BI Server node 2.
    I would like to know
    if the request (report on dashboard) calls an oracle user defined function,  can the cache be created and saved for this report?
    thank you very much!

    Hi stephen,
    if the request (report on dashboard) calls an oracle user defined function, can the cache be created and saved for this report?Yes,it is cached.....function defined in database is called in OBIEE is cached and saved.
    More information and example can be found here http://oraclebizint.wordpress.com/2007/09/10/oracle-bi-ee-10133-support-for-native-database-functions-and-aggregates/
    Hope it helps you.Check all other questions you posted are answered?
    By,
    KK

  • InvocationTargetException in User Defined Function in Oracle CEP

    I was trying to use a UDF in my CQL query. But I got the following error:
    An InvocationTargetException was encountered while attempting to register the user defined function
    "mymod".  The message was: null
    My code snippet is bellow:
    Bean:
    package com.bea.wlevs.example.function;
    import com.bea.wlevs.oracle.ci.event.CiMessages;
    public class UpdateMessage  {
        public CiMessages addChannel(CiMessages cm, String channel){
            System.out.println("I am in function");
            cm.setChannel(channel);
            return cm;
    config.xml:
    <processor>
    <name>CiRuleEngine</name>
    <rules>
    <query id="filterRule"> <![CDATA[ select addChannel(*,"SMSData") from DCInputChannel[now] as dc ]]> </query>
    </rules>
        </processor>
    content.xml:
    <wlevs:processor id="CiRuleEngine">
    <wlevs:listener ref="IntermediateChannel" />
    <wlevs:function function-name="mymod" exec-method="addCHannel">
    <bean class="com.bea.wlevs.example.function.UpdateMessage"/>
    </wlevs:function>
        </wlevs:processor>
    Can any one help me to resolve this error?

    The asterisk * in invocation addChannel(*,"SMSData") does not mean the event object. This is the cause of the exception.
    For your case, it's much easier to implement a userbean to do the insertion of the channel.
    Thanks
    Junger

  • XI 7.0 Advnaced User Defined Function  how to check Cache Entire Queue ?

    Hi Friends ,
                       We are using XI 7.0 (PI)   . There is no Selection For Advanecd UserDefinedFunction .  I think in this version Both will perfom in the User DefinedFunction Itself .
               There is option for Context and Queue While we are creating Function . If we select Queue is it eqivalent to Check box of Cache Entire Queue ? Is My assuption is correct  ?
              I want to cache the Entire Queue  ? Can you please tell me about this.
              My environment is like
    Session Information
    Application:
    Design: Integration Builder
    User:
    Test
    Logon Language:
    English
    Server:
    xidev_XID
    Server Node:
    server0
    Runtime Environment
    Java version:
    1.4.2_13
    Java vendor:
    Sun Microsystems Inc.
    Version
    Service pack:
    10
    Release:
    645_VAL_REL
    Best Regards .,
    V.Rangarajan

    you advanced user defined functions are now known as 
    Enhanced Functions (Cache = Context or Cache = Queue)
    From Help -
    +Features
    Depending on which values are available in the cache for a user-defined function, different functions are available:
    ·        Simple Functions (Cache = Value)
    This function type can process individual input values of a field for each function call. Therefore, simple functions expect strings as input values and return a string.
    ·        Enhanced Functions (Cache = Context or Cache = Queue)
    This function type can process multiple input values of a field for each function call. Before you call the function, you can either import all the field values of a context or the whole queue for the field in an array.+
    Have this link as your reference - http://help.sap.com/saphelp_nw04s/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm

  • Accessing container element in the User Defined Function

    Hi All,
    I am accessing a container element in the user defined function.
    But it is not working. Actually i want to split a message(1800 records) into a batch of 200.
    But it goes in a infinite loop.
    Please can you tell me where i am wrong.
    Smita
    The code is :
    public void SplitMsg(String[] a,ResultList result,Container container){
    Object container1;
    String counter;
    int i,j=0;
    container1 = container.getParameter("value");
    if( container1 == null){
    counter  =  "0";
    else {     
         counter = container.toString();
         j = Integer.valueOf(counter).intValue();
    for ( i = j ; i <= j + 199 ; i++){
         if ( i  >= a.length){
              container.setParameter("value","9999999");
              break;
         result.addValue(a<i>);
         j += 200;
         counter = Integer.toString(j);
         container.setParameter("value", counter);

    Here is another way to accomplish what you wanted.
    For the target mapping, use this sequence for mapping
    Source element -> removeContext -> Your User-defined Function -> Target Element
    When defining User-Defined Function, select "Cache Queue" option.
    Since you are using removeContext before calling the UserDefined function, your input to the user defined function will be a String array without ResultList.CC.
    Now manipulate the array the way you want it, and build the ResultList result.
    After every 200 records, use method
    void addContextChange().
    This will insert the ResultList.CC at the appropriate places.
    Use Display Queue in the Mapping Editor to see the debug values.

  • Calling ORACLE Store Procedure with parameters in user define function

    Hi everybody,
    We have a scenario connecting Oracle DB thru JDBC adapter.
    We have to call store procedure with input parameter and output parameter to retrieve data from DB. The implementation was made using JDBC adapter by building the correct XML message with EXECUTE action, and it works fine.
    Now we need to use DB lookup within mapping. I wrote users define function with SELECT statement (using the JDBC adapter) and it works fine but I need to call store procedure in ORACLE instead of SELECT statement.
    I found lot of examples concerning DB lookup but none of them explained how to write UDF calling store procedure in ORACLE with input and output parameters.
    I am looking for an example.
    Thanks in advance,
    Gigi

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • Converting the iif function in MS Access97 to an user defined function in Oracle

    Hi ,
    I have a problem here we are working with Visual Basic 6.0(ADOs 2.5) with Oracle 8i release 2. we have some queries stored in the tables which contains the iif function of MS Access 97 do we have a similar built in function in Oracle which replaces this iif function of Ms Access 97.
    we cannot use decode (built in function) of oracle b'cos it cannot be used in a where clause and we cannot write a user defined function also because it cannot be generalized for use b'cos sometimes we use
    field names and sometimes values as expression in the iif functions
    If anybody could suggest me some idea
    please mail me at [email protected]
    with best regards
    Jai

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jai:
    Hi ,
    I have a problem here we are working with Visual Basic 6.0(ADOs 2.5) with
    Oracle 8i release 2. we have some queries stored in the tables which contains the iif function of MS Access 97 do we have a similar built in function in Oracle which replaces this iif function of Ms Access 97.we cannot use DECODE (built in function) of oracle b'cos it cannot be used in a where clause and we cannot write a user defined function also because it cannot be generalized for use b'cos sometimes we use field names and
    sometimes string values as expression in the iif functions. is there any other built in function ? can anybody suggest me some idea
    please mail me at [email protected]
    regards
    Jai<HR></BLOCKQUOTE>
    Hi,
    You still can use the seccond approach - with a udf IIF() that you place in a package and OVERLOAD it. See the documentation for limitations of Overloading
    Overloading permits you to declare several functions with the same name but havind different behaviours depending on the number and type of the parameters.
    George

  • Calling user defined function in Oracle BI Answers?

    Hi
    I am new in Oracle BI . I want to use the user defined function in Oracle BI Answers as a column,function written in Oracle database to calculate the Sales Revenue.
    I am using Oracle BI Standard Edition One and Oracle 10g database.
    Please suggest me.
    Thanks
    Nusrat

    Search for EVALUATE function you can call function and pass parameters
    Example:
    EVALUATE Function
    This function is intended for scalar and analytic
    calculations.
    Syntax: EVALUATE('DB_Function(%1)', {
    Comma separated Expression})
    Example: SELECT
    e.lastname,sales.revenue,EVALUATE('dense_rank()
    over(order by %1
    )',sales.revenue) FROM sales s, employee e;

  • Are Sql functions different from user defined functions ?

    Hello,
    SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements. Do not >confuse SQL functions with user-defined functions written in PL/SQL.according to first paragraph of this document Sql functions are different from user defined functions . How is that ?
    Is they really differ from each other ?

    bootstrap wrote:
    If you don't know what compilation is, please use Wikipedia or other online resources.I know what is compilation . But i was confused whether those sql functions are compiled in my machine when i install Oracle Database in my machine or they are pre-compiled .
    As you said these Sql functions are pre-compiled , it is clear now that they are pre-compiled platform dependent code .
    Can you provide actual source code of any SQL function , say SUM function .
    I want to see it, how they have defined . Eagerly waiting for any reply. please help .
    Edited by: bootstrap on Aug 19, 2011 11:50 AMYou can ask oracle if they give you their code. I doubt they will. However if you want to write you own user-defined aggregation function, there are examples in the documentation how to do that.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_packages.htm#i1008575
    Edited by: Sven W. on Aug 19, 2011 9:24 AM

  • Calling PL/SQL user defined functions from ODI Constraints

    Hi All,
    We are trying to call user defined PL/SQL functions from ODI. We are able to call them from ODI's User functions. But when we are trying to call them from ODI Constraints under Models, it is throwing an error 'ORA-00920 invalid relational operator'. Kindly let me know if anyone has faced the same issue and got the resolution for the same. Thanks in Advance.
    Regards,
    Abhishek Sharma

    Hi Ace,
    Thanks for the response, the same error was coming in operator also.
    I am able to call PL?SQL user defined functions from ODI Constraints. We have to first call ODI User functions from the ODI constraints as we cant call PL/SQL function (compiled in database) directly.
    From the ODI User functions, we can then call the PL/SQL functions.
    Please reach out to me if you need further details reg this.

  • Access Imported Archive in User Defined Function

    Hi!
    I want to access a XML file in an user defined function in a message mapping. The XML file is included in an imported archive. I need the information out of this XML file for configuring an extended receiver determination.
    Does anyone know how to solve this?
    Best regards,
    Daniel

    Hi Krishna,
    a property file will be a solution but is has to be stored in the filesystem. In my scenario I prefer a file (not neccessary xml) which is editeable in the IR.
    I tried something in this way (just for testing):
    try {
         DocumentBuilderFactory factory = null;
         DocumentBuilder builder = null;
         Document document = null;
         Element element = null;
         factory = DocumentBuilderFactory.newInstance();
         builder = factory.newDocumentBuilder();
         document =  builder.parse(Container.class.getResourceAsStream("routing.xml"));
         element = (Element)document.getElementsByTagName("BUSINESS_SYSTEM").item(0);
         return element.getNodeValue();
    } catch (Exception e) {
         return "Crash: "+e.getMessage();
    But it crashes, because the resource "routing.xml" cannot be found. I tried to add the namespace or the name of the imported archive or both as prefix, but it don't work. How can I find out under which address/url I can open the xml document?
    Best regards,
    Daniel

  • Calling the function NUMBER_GET_NEXT from an XI User Defined Function

    Hi there,
    A number range object has been created on our XI server, called, ZBC_BKSTMT.
    I need to call the function NUMBER_GET_NEXT (standard SAP function for number range objects) with the parameters:
    NR_RANGE_NR = 01
    OBJECT = ZBC_BKSTMT
    Calling the NUMBER_GET_NEXT function will return a unique integer.  However, i need to call it from a User Defined Function because I need to make use of the returned integer in my message mapping.
    Thanks,

    Hello,
    If you have SP13, SAP provides a RFC API which can be called during the mapping. Refer to this document:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/xi%20mapping%20lookups%20rfc%20api.pdf
    Also check this weblog :
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    For pre-SP13 systems, refer to this How-To
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20perform%20sap%20data%20lookups%20within%20xi%20mappings
    ***************Reward points,if found useful

  • Writing user defined function the same way as the oracle functions

    Hi Guys,
    In one of the interviews , I have attended the guy asked me to write a user defined function which will take the column name and list all the values .
    For example
    Table Name:Employees
    Column Name: Employee_Name
    Employee_name
    Scott
    Ivgun
    Jack
    Shane
    The query should be in this fromat
    SELECT col_agg(Employee_name) emp_name from Employees;
    The output shoulld be
    Emp_names
    scott,ivgun,jack,shane
    Please let me know if this is possible
    Any suggestions will be highly appreciated.
    Thanks,
    Ranjan

    You could certainly write a user defined aggregate function if you like...
    e.g. this function will aggregate strings into a CLOB...
    create or replace type clobagg_type as object
      text clob,
      static function ODCIAggregateInitialize(sctx in out clobagg_type) return number,
      member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number,
      member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number,
      member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number
    create or replace type body clobagg_type is
      static function ODCIAggregateInitialize(sctx in out clobagg_type) return number is
      begin
        sctx := clobagg_type(null) ;
        return ODCIConst.Success ;
      end;
      member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number is
      begin
        self.text := self.text || value ;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number is
      begin
        returnValue := self.text;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number is
      begin
        self.text := self.text || ctx2.text;
        return ODCIConst.Success;
      end;
    end;
    create or replace function clobagg(input clob) return clob
      deterministic
      parallel_enable
      aggregate using clobagg_type;
    SQL> select trim(',' from clobagg(ename||',')) as enames from emp;
    ENAMES
    SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,MILLER
    SQL> ed
    Wrote file afiedt.buf
      1  with t as
      2    (select 'PFL' c1, 0 c2,110 c3 from dual union all
      3     select 'LHL', 0 ,111 from dual union all
      4     select 'PHL', 1, 111 from dual union all
      5     select 'CHL', 2, 111 from dual union all
      6     select 'DHL', 0, 112 from dual union all
      7     select 'VHL', 1, 112 from dual union all
      8     select 'CPHL', 0, 114 from dual union all
      9     select 'WDCL', 1, 114 from dual union all
    10     select 'AHL' ,2 ,114 from dual union all
    11     select 'NFDL', 3, 114 from dual)
    12  --
    13  -- end of test data
    14  --
    15  select trim(clobagg(c1||' ')) as c1, c3
    16  from (select * from t order by c3, c2)
    17  group by c3
    18* order by c3
    SQL> /
    C1                                     C3
    PFL                                   110
    LHL CHL PHL                           111
    DHL VHL                               112
    CPHL AHL NFDL WDCL                    114Ok, it's more than just a function as it uses an object type linking into the internals of the ODCI... but it does what you ask. :)

  • Converting db2 user defined functions to oracle .

    Hi gurus
    this is a user defined function for getting current timestamp for a null value how to do this in oracle .i am getting a problem at the input values.can anyone suggest me the changes to convert it into oracle udfs.
    drop function Get_DateId()
    CREATE FUNCTION Get_DateId()
    RETURNS BIGINT
    BEGIN ATOMIC
    DECLARE      R BIGINT;
    DECLARE      v_Day CHAR(2);
    DECLARE      v_Month CHAR(2);
    DECLARE      v_Year CHAR(4);
         SET V_Day     = SUBSTR( DIGITS (DAY(CURRENT DATE)),9);
         SET V_Month     = SUBSTR( DIGITS (MONTH(CURRENT DATE)),9);
         SET V_Year     = RTRIM(CHAR(YEAR(CURRENT DATE)));
         SET R= BIGINT(v_Year||V_Month||V_Day|| '00000000' );
    RETURN R ;
    END
    @

    You'll need to get the syntax for PL/SQL function calls right. You will need something like
    create or replace function whatever( arg datatype, arg datatype...) return varchar2 is
      --define any local variables here
    begin
       return to_number(to_char(systimestamp,'the edit mask you want to use'));
    end;
    /You might do the conversion inline and dispense with the function compeletly if you're just generating a value.

Maybe you are looking for

  • Transferring Apple TV movies from old computer to new computer

    I recently bought a new computer and am trying to transfer my purchased Apple TV movies from my old computer to my new computer. What is the easiest way to do this?

  • ITunes thinks my new iTouch is my old iPod

    I received a new iTouch and when I first connected it to iTunes I accidentally didn't rename it. So now iTunes thinks my new iTouch is my old iPod. So when I started syncing it, it looks as though my new 64gb iTouch only has 32gb. How do I make iTune

  • How to read the API

    I am trying to understand how to read the Java API. I have bought Oracle's Books "Java The Complete Reference" and "Java A Beginners Guide" but am still unsure how to read the API. Let me clarify what I'm asking to avoid confusion. The class java.uti

  • Work Center Routing

    Hi Gurus, Please can you explain in detail how Work center routing functions with T- Codes? And how it works? Regards, PMAddi

  • Trouble installing labview runtime engine

    Can not install labview runtime engine.  Says there is already a higher version installed.