Using java user-defined aggregate function

Hello

I'm trying to implement a with Java user-defined aggregate function.

Here's the Code Javaclass:

Import Java.util;
Oracle.sql import. *;
import java.sql. *;
import Java.Math.BigDecimal;
Oracle import. CartridgeServices.*;

stored the context type

public class StoredCtx_SecMax
{
private BigDecimal b_max;
private BigDecimal b_secmax;

public StoredCtx_SecMax()
{
b_max = new BigDecimal (0);
b_secmax = new BigDecimal (0);
}

public void SchreibeMax (entry BigDecimal)
{
b_max = entry;
}

public void SchreibeSecMax (entry BigDecimal)
{
b_secmax = entry;
}

public BigDecimal LeseMax()
{
Return b_max;
}

public BigDecimal LeseSecMax()
{
Return b_secmax;
}
}

implementation type

/ public class SecondMax_j implements SQLData
{
BigDecimal private key;

Ultimate SUCCESS of static BigDecimal = new BigDecimal (0);
Final static BigDecimal ERROR = new BigDecimal (1);


Implement the SQLData interface.

String sql_type;
public String getSQLTypeName() throws SQLException
{
Return sql_type;
}

' Public Sub readSQL (SQLInput stream, string typeName) throws SQLException
{
sql_type = typeName;
key = stream.readBigDecimal ();
}

Public Sub writeSQL (SQLOutput stream) throws SQLException
{
stream.writeBigDecimal (key);
}


methods of the type that implements ODCITable interface

public static BigDecimal ODCIAggregateInitialize (oracle.sql.STRUCT [] sctx)
throws SQLException
{
Connection Conn = DriverManager.getConnection("jdbc:default:connection:");

create a stored environment and store the result set in it
StoredCtx_SecMax ctx = new StoredCtx_SecMax();

context of registry stored with cartridge services
Touch int;
try {}
key = ContextManager.setContext (ctx);
} catch {} (EC CountException)
error return;
}

Create an instance of StockPivotImpl and store the key of
Object [] impAttr = new Object [1];
impAttr [0] = new BigDecimal (key);
StructDescriptor sd = new StructDescriptor ("SECONDMAX_J", conn);
SCTX [0] = new STRUCT(sd,conn,impAttr);

return a SUCCESS;
}

public BigDecimal ODCIAggregateIterate (BigDecimal input)
throws SQLException
{
retrieve the context stored with the key
CTX StoredCtx_SecMax;
try {}
CTX = (StoredCtx_SecMax) ContextManager.GetContext (Key.intValue ());
} catch (InvalidKeyException ik) {}
error return;
}

BigDecimal b_max;
BigDecimal b_secmax;

b_max = ctx. LeseMax();
b_secmax = ctx. LeseSecMax();

If (eingabe.compareTo (b_max) == 1)
{
CTX. SchreibeSecMax (b_max);
CTX. SchreibeMax (input);
}
on the other
{
If (eingabe.compareTo (b_secmax) == 1)
{
CTX. SchreibeSecMax (input);
}
}

return a SUCCESS;
}

public BigDecimal ODCIAggregateTerminate (double [] returnValue, int flags) throws SQLException {}

retrieve the context stored with the key
CTX StoredCtx_SecMax;
try {}
CTX = (StoredCtx_SecMax) ContextManager.clearContext (Key.intValue ());
} catch (InvalidKeyException ik) {}
error return;
}

returnValue [0] = ctx. LeseSecMax () .doubleValue ();

CTX = null;

return a SUCCESS;
}


public BigDecimal ODCIAggregateMerge (oracle.sql.STRUCT ctx2) throws SQLException {}


return a SUCCESS;
}
}


To implement this in the database, I use the following script:

CREATE OR REPLACE TYPE IMPROG. SECONDMAX_J as object

(
INTEGER key,

public static function ODCIAggregateInitialize (sctx IN OUT SECONDMAX_J)

Return number
IN THE JAVA LANGUAGE
NAME "Java.Math.BigDecimal return from SecondMax_j.ODCIAggregateInitialize (oracle.sql.STRUCT []).
,



Member ODCIAggregateIterate (self IN OUT SECONDMAX_J function,

Number return value)
IN THE JAVA LANGUAGE
NAME "Java.Math.BigDecimal SecondMax_j.ODCIAggregateIterate return (Java.Math.BigDecimal).
,



Member ODCIAggregateTerminate (self IN SECONDMAX_J function,

Return returnValue NUMBER, flags in number number)
IN THE JAVA LANGUAGE
NAME "Java.Math.BigDecimal return of SecondMax_j.ODCIAggregateTerminate (double [], int).
,



Member ODCIAggregateMerge (self IN OUT SECONDMAX_J function,

CTX2 IN SECONDMAX_J) return number
IN THE JAVA LANGUAGE
NAME "Java.Math.BigDecimal SecondMax_j.ODCIAggregateMerge return (oracle.sql.STRUCT)".
);
/

CREATE OR REPLACE FUNCTION F_SECONDMAX_J (NUMBER value) RETURN NUMBER

PARALLEL_ENABLE

AGGREGATION to the HELP of SecondMax_j;
/



When I now use the F_SECONDMAX_J function.

"(Columnname) select F_SECONDMAX_J from Tablename t;

It works perfectly and shows me the right result.

Then I tried to implement the fusion part as follows:

public BigDecimal ODCIAggregateMerge (oracle.sql.STRUCT ctx2) throws SQLException {}

BigDecimal Key2 = null;

BigDecimal ctx_max = null;
BigDecimal ctx_secmax = null;

BigDecimal ctx2_max = null;
BigDecimal ctx2_secmax = null;

retrieve the context stored with the key
StoredCtx_SecMax ctx = null;
try {}
CTX = (StoredCtx_SecMax) ContextManager.GetContext (Key.intValue ());
} catch (Exception e) {}

}

Object [] impAttr = ctx2.getAttributes ();

Key2 = (BigDecimal) impAttr [0];

retrieve the second context stored using the key2
StoredCtx_SecMax ctx_sec = null;
try {}
ctx_sec = (StoredCtx_SecMax) ContextManager.GetContext (key2.intValue ());
} catch (Exception e) {}

}

ctx_max = ctx. LeseMax();
ctx_secmax = ctx. LeseSecMax();

ctx2_max = ctx_sec. LeseMax();
ctx2_secmax = ctx_sec. LeseSecMax();

If (ctx2_max.compareTo (ctx_max) == 1)
{
If (ctx2_secmax.compareTo (ctx_secmax) == 1)
{
CTX. SchreibeSecMax (ctx2_secmax);
}
on the other
{
CTX. SchreibeSecMax (ctx_max);
}
CTX. SchreibeMax (ctx2_max);
}
on the other
{
If (ctx2_max.compareTo (ctx_secmax) == 1)
{
CTX. SchreibeSecMax (ctx2_max);
}
}

return a SUCCESS;
}

When I now try the function

"Select / * + parallel (t 4) * / F_SECONDMAX_J (Columnname) of Tablename t;

I always get a pointer NULL-error because the variable key2 is always 0 and therefore the functions LeseMax() and LeseSecMax()
in the second context 'ctx_sec' produce this error NULL pointer.

To me it seems that each parallel process is the construction of an additional class for himself, which is not available are my main process.

My question is now how it is possible to access the context of stored of the parallel process, so that I can combine the results.

Thank you very much

Josef

Hi Josef,

just guess that I've never implemented with java user-defined aggregate functions or support parallel execution:

Maybe you have to implement ODCIAggregateWrapContext?

+ Application of ODCIAggregateWrapContext is optional. It should be implemented only when the external memory is used to hold the aggregative, context and the user-defined aggregate is evaluated in parallel (which is, stated as PARALLEL_ENABLE). If the user-defined aggregate is not evaluated in parallel, ODCIAggregateWrapContext is not necessary. +
[http://docs.oracle.com/cd/B12037_01/appdev.101/b10800/dciaggfns.htm#i1004974]

Report it to progress and success.

Good luck
Rainer Stenzel

Tags: Database

Similar Questions

  • THT of the user-defined aggregate function includes 'in the GROUP BREAST"

    There are a lot of library functions in Oracle that can be used with the clause "WITHIN GROUP".

    Is it possible to create the UDA who works in the same way (in whatever language)?

    Function I created can be called with clause but not with "WITHIN GROUP".

    Any ideas?

    Thank you

    Performs the next best job?

    create or replace type blob_wrapper as an object (content blob);

    /

    create or replace type blob_table in the blob_wrapper table;

    /

    create or replace function blob_agg (p_data in blob_table)

    Returns the BLOB

    deterministic

    is

    v_offset integer: = 1;

    Whole V_LENGTH;

    v_result blob.

    Start

    DBMS_LOB.CREATETEMPORARY (v_result, false);

    because me in 1... p_data loop. Count

    V_LENGTH: = dbms_lob.getlength (p_data (i) content);

    (DBMS_LOB). Copy

    dest_lob-online v_result

    src_lob-online content p_data (i)

    quantity-online v_length

    dest_offset-online v_offset

    );

    v_offset: = v_offset + v_length;

    end loop;

    Return v_result;

    end;

    /

    Select (blob_agg)

    cast)

    collect)

    blob_wrapper (t.lob_fragment)

    order by t.id

    )

    as blob_table

    )

    ) as a result

    of blob_test t

    where rownum<= 100="">

  • Use of user defined function in mathscript containing a structure

    Hi, I am a novice user of LabView MathScript module,

    I have the following problem when integrating my code MATLAB, LabView, for HMM: in my program, I tried to call a MATLAB called "mixgaussinit.m" user-defined function, it shows this error...

    "

    I just noticed that these files appear to be copyrighted. My first question is do you have author permissions to post them in a public forum? If this isn't the case, then you can remove them. That being said, I have reviewed the code and it seems easy enough to work around your problems (provided that you have the copyright permissions). How to bypass the problems is to replace the fields of the struct with variables. There is of course allows you to change some definitions of functions for input and output the necessary variables which I think was the best 5 variables. You will also need to redo the code that uses a table of error checking cell. In total, I estimated about 30 minutes of work. I would have given you work around these files had not been protected by copyright. So, unfortunately, you will need to implement the work around you.

  • Using user defined global functions

    Hello
    I put implement Error Handling in a package. The logic goes like this:
    If the call to the first interface fails, KO called the proc error using what error message is retrieved, written to a file and an e-mail notification is sent.
    The code below is written in the procedure.

    OdiOutFile-FILE=E:\OraHome_2\oracledi\demo\Assignmnt\ErrorLog.log
    ErrMesg: "< % = odiRef.getPrevStepLog ("MESSAGE") % > '"

    Now, I need to implement using a global function that can be used through interfaces to implement the error handling.
    I want to club the code used above with the sending of a notification by e-mail.

    Can someone pls guide me if I have my approach is correct and how this approach can be implemented using the global function?

    Thank you.

    Published by: RitikaS on December 18, 2009 02:19

    Hi Ritika,

    May I suggest a method?

    Build a package, describe your flow of interface, the (failed) k of each interface, call OdiSendMail.

    In the OdiSendMail set all settings such as mail server, from and to, subject to body of message code below, paste

    Previous step <%=odiRef.getPrevStepLog("STEP_NAME")%> with the session number <%=odiRef.getPrevStepLog("SESS_NO")%> failed with the error message

    * <%=odiRef.getPrevStepLog("MESSAGE")%>. *

    Please look in the operator for more details.

    So, what will the ODI is, it will send a notification to the recipient with the error message, the session number, and the name of the interface.

    Sample:

    Step previous INT_LOAD_AGE with the number of session 1822124 failed with the error message

    17002: null: java.sql.SQLException: IO exception: the network adapter could not establish the connection
    java.sql.SQLException: IO exception: the network adapter could not establish the connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:274)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
    to oracle.jdbc.driver.PhysicalConnection. (PhysicalConnection.java:361)
    to oracle.jdbc.driver.T4CConnection. (T4CConnection.java:151)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:595)
    at com.sunopsis.sql.SnpsConnection.u (SnpsConnection.java)
    at com.sunopsis.sql.SnpsConnection.c (SnpsConnection.java)
    at com.sunopsis.sql.i.run (i.java)
    .

    Please look in the operator for more details.

    Makes sense?

    http://img259.imageshack.us/img259/1704/screenshot003.jpg

    PS: Please close your threads accordingly award points (useful/correct) help experts for you with impatience.

    Thank you
    Guru

  • Output image in Labview using Matlab user define function

    Hi all

    I have a case in which I take an image as input, matlab function allows to treat and output then the image processed next. But how to show the image of this output in Labview. I use the Matlab script in labview. Please let me know.

    Thank you

    Ankit G

    Here are the links:

    Call the MATLAB® software LabVIEW-> http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/creating_a_matlab_script/

    NEITHER Vision Acquisition Software-> http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav: of the, ssnav:sup/q/nor - screws...

    IMAQ ArrayToImage VI-> http://zone.ni.com/reference/en-XX/help/370281M-01/imaqvision/imaq_arraytoimage/

  • How to use the user defined function in the Update statement

    Hi all

    I wrote under the update statement to update the column based on the return value of function. but it does not work. Could someone help me on this. This function returns a single value for each project.

    Thanks in advance.

    UPDATE dg2. OD_PROJ_LOOKUP_TEMP o
    SET Months_In_Stage_Cnt = Months_In_Stage_Cnt_ret (o.project_id) select the double;


    Thank you
    Deb

    PLS-00231: function 'MONTHS_IN_STAGE_CNT_RET' cannot be used in SQL

    -What is the function that is declared private in a package? If Yes, then it must be public, otherwise the SQL engine cannot be used.

    Published by: Dom Brooks on November 18, 2011 09:43

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

    Hi guys,.

    In one of the interviews, I saw the guy asked me to write a function defined by the user who will be the column name and the list of all values.

    For example

    Name: employees table
    Column name: Employee_Name

    Employee_name
    Scott
    Ivgun
    Jack
    Shane

    The query must be in this marker

    SELECT col_agg (Employee_name) emp_name of employees;

    The output must be

    Emp_names
    Scott, ivgun, jack, shane

    Please let me know if this is possible


    Any suggestions will be much appreciated.

    Thank you
    Ranjan

    You certainly could write what a user defined aggregate function if you wish...

    for example this function will consolidate channels in 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                    114
    

    OK, it's more that a function it uses a type of object that connects in operation internal to the ODCI... but it does what you ask. :)

  • variables of user-defined data transfer

    Hello

    I use the etherCAT 9144 chassis and is only supported by this hardware FIFO range target. After a search, I realized that the only way to transfer data from FPGA to the host by using user-defined variables. But these variables do not support the notion of FIFO. So which is the best practice to transfer data after measures (provable 10 Hz measurement of 15 values) to host VI?

    Thank you

    As mentioned, the 9144 only supports the analytical engine.

    In regards to what you do, it really depends on the entire application. For example, what is the master? Are there other systems at issue here? Etc. It's a good read, in general, although it might not help this second right: http://www.ni.com/white-paper/14151/en/

    A high level, you need to decide what you need. If you have need for deterministic communication, low-latency over long distances from a RT controller, the 9144 is probably the right choice. If you need low latency + streaming over short distances to a RT controller, you should look into the RIO MXI chassis. If you need mainly not deterministic low speed (10 hz) data mixed with low flow continuous over long distances to a windows or host RT, then ethernet expansion rio (9146,7,8,9) is probably the right choice. If you need high speed continuous with low control latency over long distances to a windows or RT host, you need a full cRIO controller. Based on what you've posted so far, its uncertain is the right person.

    Lets say you're stuck with the 9144 for now. As you can easily hit 1 kHz scanning cycles, it should be perfectly possible to data 'stream' to 10 Hz. If you run the scan at 1 kHz engine, then you are 100 x oversampling. Where it gets complicated is this requirement of sync. By default, acquisition input/output is synchronized to the clock of the scan (and you can see when the clock of scan is set by a knot of e/s FPGA). However, you can take complete control of a module in the FPGA and read inputs and outputs at any time if you please. In other words, you can set up so when DIO0 goes high you immediately enjoy all the values of AI 15. You can then transfer these values HAVE switched to the host using the user-defined variables.

  • Task to the mapping of object status: is it possible to have user-defined status?

    Hi guru.

    'Task of object state Mapping' tab for the definition of the process allows you to set the "status of the object' to 'status '.

    'Status of the object' contains values defined on "Definition of the State" for defined object "resource". It is possible to extend this list by adding user-defined status. But the allocation of these statutes (for example, 'view data name updated') for status (say, 'C', finished) it causes a corresponding Bundle error is found.

    How is it possible to use the user defined the statutes?

    Hello

    These statutes are pre-defined and shipped by the IOM.

    You cannot change C-> etc. put into service.

    ~ J

  • Splitting documents based on user defined ranges?

    In Acrobat Pro XI that I managed to split the documents using beaches user-defined such that divides when the text is changed to a certain spot on the document. I don't see this feature in ms. I am still able to do this?

    Hi kristim47239850,

    Choose the Split option under tool Page organize in Acrobat DC, you will then get the Output option, where you can set the folder target from pages of the file to save the PDF.

    Link for help split a PDF | Adobe Acrobat DC tutorials

    Kind regards
    Nicos

  • Xquery functions using predefined in user defined functions

    Hi all

    I have a requirement to call a function defined by the user in the osb xquery file. That function, I use osb predefined string functions, but they do not work it displays the error message in the file of xquery. Can you please suggest how to use user-defined functions.

    Thank you
    Srinivas.
    xquery version "1.0" encoding "Cp1252";
    
    declare namespace xf = "http://tempuri.org/TransactieService/Xquery/test/";
    
    declare function xf:test($string1 as xs:string)
        as xs:string {
            xf:buildReferenceRange($string1)
    };
    
    declare function xf:buildReferenceRange($inRange as xs:string)
         as xs:string {
         let $filtered :=
              if (contains($inRange,"^"))
              then
                   "it's in"
              else
                   "it's not in"
    
         return $filtered
    }; 
    
    declare variable $string1 as xs:string external;
    
    xf:test($string1)
    

    It works for me

  • User Defined functions in the Mapper

    I have user-defined functions that work in BPEL but I can't make them work in the Mapper. They appear when expected for jDeveloper but throw "function not found" errors

    Can someone look at my config files and see if the error comes out? Thank you bunches!

    BPEL file:

    " < soa-xpath-functions xmlns =" http://xmlns.Oracle.com/SOA/config/XPath "" "

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    version = "11.1.1.

    resourceBundle = "oracle.tip.tools.ide.common.resource.IDEMessageBundle"

    >

    < name of the function = "f17:editCaseNumber" >

    com.F17.CustomFunction.editCaseNumber < className > < / className >

    < return type = "tree" / >

    < params >

    < param name = "stringToFormat" type = "string" / >

    < param name = "order" type = "string" / >

    < / params >

    number of valid cases and formats < desc > < / desc >

    < detail >

    <! [CDATA [this is a custom function.] If you use it, you must include the

    Following namespace declaration in your BPEL file.

    < br / > < br / >

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    < br / > < br / >

    USE: f17:editCaseNumber(string,string) < br / >

    Channel 1 is the data < br / >

    Channel 2 is the command. Valid commands are: < br / >

    1 = number of control check and come back as nnnnnnnnnn < br / >

    2 = number of control check and come back as nnn-nnnnnnn < br / >

    3 = Append check digit and return under nnnnnnnnnn < br / >

    4 = Append check digit and return under nnn-nnnnnnn

    < br / > < br / >

    Returns XML document fragment: < br / >

    Import of f17userDefinedFusnctions.xsd space variable prototype. < br / >

    See documentation for more details.]] >

    < / details >

    < / feature >

    < name of the function = "f17:compressFile" >

    com.F17.CustomFunction.compressFile < className > < / className >

    < return type = "tree" / >

    < params >

    < param name = "stringToFormat" type = "string" / >

    < / params >

    < desc > compress long strings by DB storage < / desc >

    < detail >

    <! [CDATA [this is a custom function.] If you use it, you must include the

    Following namespace declaration in your BPEL file.

    < br / > < br / >

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    < br / > < br / >

    USE: f17:compresFile (string)

    < br / > < br / >

    Returns XML document fragment: < br / >

    See documentation for more details.]] >

    < / details >

    < / feature >

    < name of the function = "f17:sortList" >

    com.F17.CustomFunction.sortList < className > < / className >

    < return type = "tree" / >

    < params >

    < param name = "listIn" type = "string" / >

    < / params >

    lists of kinds of < desc > < / desc >

    < detail >

    <! [CDATA [this is a custom function.] If you use it, you must include the

    Following namespace declaration in your BPEL file.

    < br / > < br / >

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    < br / > < br / >

    USE: f17:sortList (String) < br / >

    Build the string as: & lt; list & gt; & lt; point & gt; [data] & lt; / point & gt;... & lt; / list & gt; < br / >

    Returns XML document fragment: < br / >

    Import of f17userDefinedFusnctions.xsd space variable prototype. < br / >

    See documentation for more details.]] >

    < / details >

    < / feature >

    < name of the function = "f17:replaceString" >

    com.F17.CustomFunction.replaceString < className > < / className >

    < return type = "string" / >

    < params >

    < param name = "StringToFix" type = "string" / >

    < param name = "RegX" type = "string" / >

    < param name = "replaceString" type = "string" / >

    < param name = "mode" type = "string" / >

    < / params >

    Sets < desc > replaceFirst and replaceAll functions java < / desc >

    < detail >

    <! [CDATA [this is a custom function.] If you use it, you must include the

    Following namespace declaration in your BPEL file.

    < br / > < br / >

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    < br / > < br / >

    USE: f17:replaceString(String,String,String,String) < br / >

    Chain change, regular expression, mode [optional] replace the string - 1 = all, 2 = first by default all the < br / >

    See documentation for more details.]] >

    < / details >

    < / feature >

    < / soa-xpath-functions >

    file Mapper:

    < soa-xpath-functions

    " xmlns =" http://xmlns.Oracle.com/SOA/config/XPath "" "

    ' xmlns:repl = ' http://www.Oracle.com/xsl/transform/Java/COM.F17.CustomFunction.replaceString "" "

    ' xmlns:comp = ' http://www.Oracle.com/xsl/transform/Java/COM.F17.CustomFunction.compressFile "" "

    version = "11.1.1.

    resourceBundle = "oracle.tip.tools.ide.common.resource.IDEMessageBundle"

    >

    < name of the function = ' model: compressFile ">

    com.F17.CustomFunction.compressFile < className > < / className >

    < return type = "tree" / >

    < params >

    < param name = "stringToFormat" type = "string" / >

    < / params >

    < desc > compress long strings by DB storage < / desc >

    < detail >

    <! [CDATA [this is a custom function.] If you use it, you must include the

    Following namespace declaration in your BPEL file.

    < br / > < br / >

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    < br / > < br / >

    USE: f17:compresFile (string)

    < br / > < br / >

    Returns XML document fragment: < br / >

    See documentation for more details.]] >

    < / details >

    < / feature >

    < name of the function = "repl:replaceString" >

    com.F17.CustomFunction.replaceString < className > < / className >

    < return type = "string" / >

    < params >

    < param name = "StringToFix" type = "string" / >

    < param name = "RegX" type = "string" / >

    < param name = "replaceString" type = "string" / >

    < param name = "mode" type = "string" / >

    < / params >

    Sets < desc > replaceFirst and replaceAll functions java < / desc >

    < detail >

    <! [CDATA [this is a custom function.] If you use it, you must include the

    Following namespace declaration in your BPEL file.

    < br / > < br / >

    ' xmlns:f17 = ' http://ENTP.HUD.gov/customxpath/functions "" "

    < br / > < br / >

    USE: f17:replaceString(String,String,String,String) < br / >

    Chain change, regular expression, mode [optional] replace the string - 1 = all, 2 = first by default all the < br / >

    See documentation for more details.]] >

    < / details >

    < / feature >

    < / soa-xpath-functions >

    None of the answers was * exactly * correct, but they gave me enough information to solve the problem.

    To implement what I have to code the functions a bit differently.

    • BPEL functions are all the IXpathFunction extension classes.
    • Mapper functions are not.
    • BPEL functions are each separate classes.
    • A single class with a method for each desired function mapper functions.
    • BPEL classes outcrop in the config file ext-bpel-xpath-functions-config. XML
    • The Mapper class is exposed in the config file ext-Mapper-xpath-functions - config.xml

    A BPEL class looks like:

    public class editCaseNumber implements IXPathFunction {
        public Object call(IXPathContext context, List args) throws XPathFunctionException {
           return docOut;
        }
    }
    

    A class to map looks like:

    public class mapperFunctions {
        public static String replaceString(String sIn,String sMat,String sRep,String mode){
            return finalString;
        }
        public static XMLDocumentFragment compressFile(String indoc){
            return docOut;
        }
    }
    

    (I deleted the code of these to avoid confusion.)


    My ext-Mapper-xpath-functions file - config.xml looks like:

    soa-xpath-functions
            xmlns="http://xmlns.oracle.com/soa/config/xpath"
            xmlns:map="http://www.oracle.com/XSL/Transform/java/com.f17.customfunction.mapperFunctions"
            version="11.1.1"
            resourceBundle="oracle.tip.tools.ide.common.resource.IDEMessageBundle"
            >
      
      com.f17.customfunction.mapperFunctions.compressFile
      
      
      
      
      Compresses large strings for DB storage
      
                    
    USE: map:compresFile(string)

    Returns XML document fragment containing HEX binary string:
    <compressedFile$gt;[outPut]</compressedFile> See documentation for details.]]>
    com.f17.customfunction.mapperFunctions.replaceString Exposes replaceFirst and replaceAll java functions
    USE: map:replaceString(String,String,String,String)
    String to edit,
    regular expression,
    replacement string mode
    1 = all
    2 = first occurance
    See documentation for details.]]>


  • Help! User-defined function problem.

    Need help on using custom function defined in Essbase. Thanks in advance!

    I have not found a function of depreciation in Essbase, so thought I might create one in Java and save it as a user defined function. However, I can't get this to work.

    Here's what I did:
    1. I created a java class called depreciation.

    public class {depreciation

    public double Adeath (double r, int period, double LoanBalance) {}
    Double LBound = LoanBalance/period;
    Double UBound = LoanBalance;
    Double MBound =(LBound+UBound)/2;
    Double err = 0;
    int i = 0;

    Calculate amortization payment
    {}
    Double MBalance is PVCalc (r, Period, MBound);.
    ERR = MBalance-LoanBalance;
    If (err > 0) {}
    UBound = MBound ;}
    If (err < = 0) {}
    LBound = MBound ;}
    MBound =(UBound+LBound)/2;
    i ++ ;
    }
    While (err > 0.001 | err <-0,001 & & I < = 100);

    return (MBound);
    }


    define the present value
    public static double PVCalc (double rate, NPER, double PMT int) {}
    Double pvpmt = pmt;
    Double cpvpmt = 0;

    for (int j = NPM; j > 0; j-) {}
    for (int i = 1; i < = j; i ++) {}
    pvpmt = pvpmt /(1+rate/12);
    }
    cpvpmt = cpvpmt + pvpmt;
    pvpmt = pmt;
    }
    Return cpvpmt;
    }
    }

    2. copy the .jar to 'C:\Hyperion\AnalysticServices\java\udf '.
    3. has created a new MaxL file and run the script that runs:

    create or replace function '@Amortize' as
    'Amortization.Amort '.
    Spec "@Amortize (spleen, period, balance)"

    It shows: statement executed successfully.

    4 then I tried to test in the following statement:

    If (@isuda ("Time", "Test Date"))
    "Depreciation Payment"=@Amortize (0.06, 360, 10000000);
    endif;

    And I got an error message as below:
    Error compiling formula [amortization payment] (line 2): [)] without [()]

    Could someone help me with this issue? 1 million thanks!

    The udf.policy file is located in the hyperion\products\essbase\essbaseserver\java directory and put the security on the java interface with Essbase points if there is a dev environment you can open the file with Notepad and go to the bottom of it. You will find a line
    permission java.security.AllPermission;

    remove the / / (which comments out) and this will allow all java functions are allowed. After the change, you must restart the service Essbase

  • How to create a user-defined function?

    is there a substitute for the exe instsrv and srvany in Vista?

    I don't know what means your post, so here's how to create a user-defined function:
    1) click Start
    (2) select "Control Panel".
    (3) select "system and maintenance".
    4) click on "Administrative Tools".
    5) click on "Task Scheduler."
    (6) click on "create task" (right in the list pane under) "Actions") "
    "(7) opened in the general tab it will choose if it only works when the account that is used to implement is connected, or ' if that user is logged in or not" (leave the box ' do not store the... "empty password)
    (8) always in the general tab, check the box 'run with highest privileges '. (This will ensure that no program can block)
    (9) type a name for the task (in the general tab)
    (10) to set the job to run an awhile, use the "triggers" tab, if you want to set a task runs after xx min. temps_inactivite, choose the 'conditions' tab, then choose the desired time.
    (12) click on the 'actions' tab click on 'new '. in the program/script line, search for and select the program you want to run, and then click Open.
    13) click OK in the window "create a task".
    14) click OK again and you are done.
    I hope this helps.

  • How to use the negation in the user defined rules?

    Hello

    Can you please show me an example using negation in the rule set by the user? I created a rule like below (the rule says that if a patient has a fever problem and not having penicillin hypersensitivity, then recommend medication1):

    INSERT INTO mdsys.semr_myMedicineRB VALUES ('rule1',

    ' (? p RDF: type: Patient) (? p: present? c1) (? c1 RDF: type: fever) (? c2 RDF: type: Penicillin_Hypersensitivity)',

    "(NOT_EXISTS (p: present c2))',

    ' (? p: recommendation: medication1)',

    SEM_ALIASES (SEM_ALIAS (",'http://www.example/medicine#')));

    The rule correctly applied in the modules. However, I cannot move to the phase of creation entailment and got errors:

    ORA-29532: Java call terminated by eception Java exception: java.sql.SQLException: parameter IN or OUT to missing index: 1

    ORA-06512: at the 'MDSYS. SDO_SEM_INF_INTERNAL', line 16453

    ORA-06512: at the 'MDSYS. SDO_SEM_INFERENCE', line 302

    ORA-06512: at the 'MDSYS. SDO_SEM_INFERENCE', line 352

    ORA-06512: at the 'MDSYS. RDF_APIS', line 118

    ORA-06512: at line 2

    29532 00000 - "Java call terminated by eception Java exception: %s."

    * Cause: A mistake or a Java exception has been reported and could not be

    solved by Java code.

    * Action: Modify Java code, if this behavior is not expected.

    According to the post primitives(noValue,remove) integrated for user defined rules, it seems that negation is not supported in rules defined by the user. Can you please advice how to implement the negation in the rules defined by the user?  Thank you very much in advance.

    Hong

    Salvation Hong,

    Negation is not supported in rules defined by the user. If you need a work-around, please follow the suggestion in the post you referenced.

    If you use Oracle Database Release 12 c, user-defined inference can certainly manage negation.

    It will be useful,

    Zhe Wu

Maybe you are looking for