Any Mod function in JAVA?

I did not find 'MOD' function in the Math class. Is there any 'MOD' function in Java?
Thanks!

What is your MOD function?
Does the %-operator do what you need or do you want a strict mathematical modulus that returns only positive values?

Similar Messages

  • Mod function in java

    Hello everybody, I need help on mod fuction in java, but I don't know how can I use it, if you know how use it, please give a little example...thanks..

    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arithmetic.html

  • Why static is used before any function in java

    Sir/Madem
    I'm new in java. I have just started learning java.
    please tell me
    "why static is used before any function in java??????"
    I have searched on net and in soime bokks .But i was unable toget it. what is exact reson of using static in java.

    tandm-malviya wrote:
    Sir/Madem
    I'm new in java. I have just started learning java.
    please tell me
    "why static is used before any function in java??????"
    I have searched on net and in soime bokks .But i was unable toget it. what is exact reson of using static in java.It's actually seldom used in "real" applications. static associates the method with the class instead of an instance.
    Kaj

  • FM call from Variant Function in JAVA SCE

    Hello,
    I have an issue with Variant Configuration in CRM WEB UI / WebShops.
    We have created a variant function in ECC to read/pull a customer master value (KNVV table).  This is working fine in ECC & got the desired result.
    Now we need replicate the same in CRM. For this we need to create KB, Version & write a variant function in Java class in SCE. In that variant function we need to call a function module and get the customer master / Business partner value as similar to ECC process described above.
    But we see that the SAP standard is not supporting FM calls from VF in Java. i.e. we are unable to call the JCO call to a CRM function module from SCE.  The package for User defined classes "com.sap.sce.user" and the method inside it public boolean execute(fn_args args, Object obj) { ..... } has no option to make a FM call.
    Has anyone faced the similar requirement and has any resolution for this? 
    Thanks,
    Surya.

    Hi Eric,
    You sound quite familiar with the variant functions. I am also working on IPC-SCE
    variant functions for few years now.
    We have a situation where I am building some debug logs in one java variant function and want to display it to the web UI at some condition.
    Is there any object(like context etc.) that IPC server-side and Webapps share?
    I can write that log to a text file and read it from web ui ... but I wanna avoid that.
    Is there any other way you know of???
    Regards,
    Ruchika

  • Calling a SP or Function from Java receiving a geometry(MDSYS.SDO_GEOMETRY)

    Hi there,
    What I want to do is: calling a stored procedure OR function from Java with a String-variable as input and receiving a geometry (SDO_GEOMETRY).
    I’m facing currently the problem of calling a stored function on oracle 11g from Java using JPA (EclipseLink), Spring 2.5.6 returning an MDSYS.SDO_GEOMETRY object.
    I’ve tried to call a stored procedure with MDSYS.SDO_GEOMETRY as an output parameter instead, but with no success.
    The function’s signature looks like this:
    CREATE or REPLACE
    FUNCTION GET_GEO_BRD_FUNCTION(p_geo_brd_id IN VARCHAR2) RETURN MDSYS.SDO_GEOMETRY AS
    sdo_geom    MDSYS.SDO_GEOMETRY := null;
    BEGIN
    /* do some fancy stuff on the database side */
      SELECT sp_geom
        INTO sdo_geom
        FROM geo_brd WHERE id = p_geo_brd_id;
      RETURN sdo_geom;
    END;
    The calling code looks like this:
    MyClass extends JpaDaoSupport{
       /** logger */
       protected static final ILogger LOG = LogFactory.getLogger(MyClass.class);
        * {@inheritDoc}
        * @see com.example.MyClass#calculateGeometry(java.lang.String)
       @Override
       public JGeometry calculateGeometry(final String id) {
           JGeometry geometry = null;
           final JpaCallback action = new JpaCallback() {
                @Override
                public Object doInJpa(final EntityManager em) throws PersistenceException {
                   final Session session = JpaHelper.getEntityManager(em).getActiveSession();
                   final StoredFunctionCall functionCall = new StoredFunctionCall();
                   functionCall.setProcedureName("GET_GEO_BRD_FUNCTION");
                   functionCall.addNamedArgument("p_geo_brd_id");
                   functionCall.setResult("sdo_geom", Oracle.sql.STRUCT.class);
                   final ValueReadQuery query = new ValueReadQuery();
                   query.setCall(functionCall);
                   query.addArgument("p_geo_brd_id");
                   final ArrayList args = new ArrayList();
                   args.add("2e531e62-2105-4522-978a-ab8baf19e273");// hardcoded for test
                   final Object result = session.executeQuery(query, args);
                   return result;
        final STRUCT result = (STRUCT) this.getJpaTemplate().execute(action);
        try {
           geometry = JGeometry.load(result);
        } catch (final SQLException e) {
           MyClass.LOG.error("Error loading JGeometry from STRUCT.", e);
           return null;
        return geometry;
    And when I execute the query I get the following error:
    Internal Exception: java.sql.SQLException: ORA-06550: Row 1, Column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: Row 1, Column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call: BEGIN ? := GET_GEO_BRD_FUNCTION(p_geo_brd_id=>?); END;
         bind => [=> sdo_geom, 2e531e62-2105-4522-978a-ab8baf19e273]
    Query: ValueReadQuery()
    So I thought may be let's try it with a stored procedure instead...
    The procedure looks like this:
    CREATE or REPLACE
    PROCEDURE GET_GEO_BRD_PROCEDURE(p_geo_brd_id IN VARCHAR2, sdo_geom OUT MDSYS.SDO_GEOMETRY) AS
    BEGIN
    /* do some fancy stuff on the database side */
      SELECT sp_geom
        INTO sdo_geom
        from geo_brd where id = p_geo_brd_id;
    END;
    The calling Java code in case of the stored procedure looks like this (only the content of the JPACallback has changed):
    @Override
    public Object doInJpa(final EntityManager em) throws PersistenceException {
        final Session session = JpaHelper.getEntityManager(em).getActiveSession();
        final StoredProcedureCall spCall = new StoredProcedureCall();
        spCall.setProcedureName("GET_GEO_BRD_PROCEDURE");
        spCall.addNamedArgument("p_geo_brd_id", "p_geo_brd_id", String.class);
        spCall.addNamedOutputArgument("sdo_geom", "sdo_geom", OracleTypes.STRUCT);
        final ValueReadQuery query = new ValueReadQuery();
        query.setCall(spCall);
        query.addArgument("p_geo_brd_id"); // input
        final List args = new ArrayList();
        args.add("2e531e62-2105-4522-978a-ab8baf19e273");// hardcoded for test
        final Object result = session.executeQuery(query, args);
        return result;
    And when I execute the query I get the following error:
    java.sql.SQLException: ORA-06550: Row 1, Column 13:
    PLS-00306: wrong number or types of arguments in call to 'GET_GEO_BRD_PROCEDURE'
    ORA-06550: Row 1, Column 7:
    PL/SQL: Statement ignored
    So both exceptions look quite similar.
    I guess in both cases the exception description leads to the assumption, that the wrong type for the return value / output parameter is used…
    So - how can a receive a MDSYS_SDO_GEOMETRY object from a stored procedure or stored function in Java ?
    What is wrong in the Java code?
    Thank you in advance for any suggestions!
    Yours,
    Chris
    Edited by: user3938161 on 20.12.2011 07:46
    Edited by: user3938161 on Dec 20, 2011 8:06 AM: added variable declaration of JGeometry geometry in source code

    Thanks, that did the trick! ;-)
    Here is now the code for stored procedure and function for anybody else encountering the same troubles... (be aware of the parameter order and/or naming!)
    Code for stored functions:
    final JpaCallback action = new JpaCallback() {
      @Override
      public Object doInJpa(final EntityManager em) throws PersistenceException {
         final Session session = JpaHelper.getEntityManager(em).getActiveSession();
           * Using CallableStatement for stored functions
          STRUCT st = null;
          CallableStatement cs = null;
          final DatabaseLogin login = session.getLogin();
          final Connection _conn = (Connection) login.connectToDatasource(session.getDatasourceLogin().buildAccessor(), session);
          try {
             try {
                cs = _conn.prepareCall("{? = call GET_GEO_BRD_FUNCTION(?)}");
                cs.registerOutParameter(1, OracleTypes.STRUCT, "MDSYS.SDO_GEOMETRY");
                cs.setString(2, "2e531e62-2105-4522-978a-ab8baf19e273");//TODO: hardcoded for test
                cs.execute();
             } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured calling the stored procedure", e);
             if (cs != null) {
                //reading geometry from the database
                try {
                   st = (STRUCT) cs.getObject(1);
                } catch (final SQLException e) {
                   MyClass.LOG.error("An exception occured converting the query result to oracle.sql.STRUCT", e);
          } finally {
             try {
                if (_conn != null && !_conn.isClosed()) {
                    _conn.close();
             } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured on closing the database connection.", e);
          return st;
    final STRUCT result = (STRUCT) this.getJpaTemplate().execute(action);
    The code for stored procedure solution:
    final JpaCallback action = new JpaCallback() {
      @Override
      public Object doInJpa(final EntityManager em) throws PersistenceException {
          final Session session = JpaHelper.getEntityManager(em).getActiveSession();
           * Using CallableStatement for stored procedure
          STRUCT st = null;
          CallableStatement cs = null;
          final DatabaseLogin login = session.getLogin();
          final Connection _conn = (Connection) login.connectToDatasource(session.getDatasourceLogin().buildAccessor(), session);
          try {
             try {
                cs = _conn.prepareCall("{call GET_GEO_BRD_PROCEDURE(?,?)}");
                cs.setString("p_geo_brd_id", "2e531e62-2105-4522-978a-ab8baf19e273");
                cs.registerOutParameter("sdo_geom", OracleTypes.STRUCT, "MDSYS.SDO_GEOMETRY");
                cs.execute();
              } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured calling the stored procedure", e);
              if (cs != null) {
                //reading geometry from the database
                try {
                   st = (STRUCT) cs.getObject("sdo_geom");
                } catch (final SQLException e) {
                   MyClass.LOG.error("An exception occured converting the query result to oracle.sql.STRUCT", e);
           } finally {
              try {
                if (_conn != null && !_conn.isClosed()) {
                   _conn.close();
              } catch (final SQLException e) {
                MyClass.LOG.error("An exception occured on closing the database connection.", e);
            return st;
    final STRUCT result = (STRUCT) this.getJpaTemplate().execute(action);

  • Using the Safe Mode function on your PlayStation 3?

    i followed the steps it works fine then when i sign in within a afew seconds it cuts off and gets a red flashing light again i dont know what to do :/

     
    RabidWalker wrote:
    Using the Safe Mode function on your PlayStation 3?
    Safe Mode:
    The option to use Safe Mode on the PlayStation 3 was introduced if a problem occurs where it will no longer start up normally.
    To use this feature the console will need to have the System Software update 2.60 (or later).
    When to Use Safe Mode?
    When starting up the PlayStation 3, and the XMB menu no longer appears (you may see a wavy line on the background instead).
    When the PlayStation 3 is started up, nothing appears on screen.
    When the PlayStation 3 is started up and you encounter the following message ‘The Hard disk’s file system is corrupted and will be restored’. When selecting ‘OK’ the system restores and restarts, however the same message appears.
    When the PlayStation 3 is started up and you encounter the following message ‘The Hard disk’s database will be rebuilt’. When selecting ‘OK’ the system begins the operation and then fails (stopping the restoration of the HDD).
    There is an issue after the PlayStation 3 update process is started, or a rebuilding of the database occurs.
    Safe Mode procedure:
    1)    Ensure the PlayStation 3 is in standby mode (where the red light is apparent), and then turn the console off at the mains switch.
    2)    Turn the mains power on, then while in standby touch and hold the power button.
    3)    Keep your finger pressed on the power button (after 5 seconds you will hear a beep).
    4)    After 10 seconds of holding your finger on the power button, you will hear a second beep and the console will shut down (you can remove your finger).
    5)    Touch and hold the power button again.
    6)    Again hold your finger down on the button until you hear another beep after 5 seconds.
    7)    A number of seconds after this you will hear a double beep- you can remove your finger.
    8)    You will be prompted to plug your controller in and press the PS button on your controller. After doing so you will access the Safe Mode menu with a number of options.
    Safe Mode Option Screen:
    Restart System
    Selecting this option will start up the system normally- It will also allow you to exit the Safe Mode Menu.
    Restore Default Settings
    Selecting this option will restore Default settings on your console (when starting the unit you will be prompted to set time, time zone etc). This option will also delete your PlayStation Network account information from the system.
    Your User information will be deleted and restored- the indicator will be an asterix by your username e.g. *RabidWalker.
    When logging into your user you will encounter no issues with disc based games. However when attempting to play PSN downloaded games you may encounter the message:
    ‘To access the system, you must activate the system.
    Go to [PlayStation Network] > [Account Management] to activate this system. (80029514). ’
    Follow the instruction to activate your PlayStation 3 to play downloaded games (if the system is activated, deactivate and reactivate the system)
    Restore File System
    This option will begin a process to repair data on your Hard Disk Drive. Therefore it will check for any corrupted data and try and recover this. It the data cannot be recovered it may be erased to ensure that it does not interfere with the operation of the PlayStation 3.
    Rebuild Database
    If issues continue to persist and you select this option please note that data will be removed during this process.
    The following information will removed:
    -          Messages
    -          Playlists
    -          User changes to Information Screens
    -          User changes to Picture under Photos
    -          Video Thumbnails
    -          Video Playback History
    -          Video Resume Information
    This process may take same time to complete
    Restore PS3 System
    The option to restore PS3 system is the same as the ‘quick format’ option on the XMB menu. It will reformat the HDD, removing all data and restoring the Hard drive to its original state.
    System Update
    Selecting this option will install the PlayStation 3 Update but only if the update is on an external media storage device plugged into the console.
    This option can be used if any issues are encountered with the installation of the System software update.
    If you have any queries regarding this or any other issues please PM me or catch me on Twitter
    @RabidWalker
    Rabid
     

  • Using the MOD Function

    Can someone explain to me the syntax of the MOD function. In my Oracle9i book it states "The MOD function find the remainder of value1 divided by value2.
    In a simple sql statement I ran from my test db. For the life of me I cannot see where any division takes place.
    select employee_id, last_name, first_name, salary, mod(salary, 500)
    from employees;
    EMPLOYEE_ID LAST_NAME FIRST_NAME SALARY MOD(SALARY,500)
    100 King Steven 24000 0
    101 Kochhar Neena 17000 0
    102 De Haan Lex 17000 0
    103 Hunold Alexander 9000 0
    104 Ernst Bruce 6000 0
    105 Austin David 4800 300
    106 Pataballa Valli 4800 300
    107 Lorentz Diana 4200 200
    108 Greenberg Nancy 12000 0
    109 Faviet Daniel 9000 0
    110 Chen John 8200 200
    111 Sciarra Ismael 7700 200
    112 Urman Jose Manuel 7800 300
    113 Popp Luis 6900 400

    user12130369 wrote:
    In a simple sql statement I ran from my test db. For the life of me I cannot see where any division takes place.
    select employee_id, last_name, first_name, salary, mod(salary, 500)
    from employees;
    EMPLOYEE_ID     LAST_NAME    FIRST_NAME      SALARY     MOD(SALARY,500) 
    105                   Austin             David                 4800         300 
    113                   Popp             Luis                   6900         400
    For employee 105: 4800 / 500 = 9 remainder 300
    For employee 113: 6900 / 500 = 13 remainder 400
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Calculated member - Mode function

    Hello,
    I need some help. I am quite new to MDX; I've created a cube and the measure needs to behave same as the MODE function in Excel (the following
    link
    describes what the function does). Apparently the only way of achieving this is by MDX (calling the MODE function directly from Excel is not an option for me). Practically the member should return a single value, that represents the price that appears
    most times. There are 4 dimensions in my cube: dates, stores, products and client products. I need the following calculations:
    1. MODE(price) for specific Date, Product and Client Product. There will be multiple lines returned for this set, as there are multiple stores.
    2. MODE(price) for specific Store, Product and Client Product. There will be multiple lines returned for this set, as there are multiple dates.
    I found the below code online, that I've adapted to work against my cube, currently the query returns correct results for the first part, Mode(price) for multiple stores. I can change it to do the same for date. 
    What I need is to create 2 calculated measures using the last select and I am unsure how this can be achieved. Any help will be much appreciated or any other approach in achieving this.
    WITH 
    --Count how often each value appears
    MEMBER [Measures].[ValueCount] AS 
    SUM(  Union([Dim Stores].Store].CurrentMember.Level.Members,       {[Dim Stores].[Store].CurrentMember} AS CurrentStore),
    IIF( ([Dim Stores].[Store].CurrentMember, [Measures].[Price]) = 
    (CurrentStore.Item(0).Item(0), [Measures].[Price]) , 1, null))
    --Only get the items that appear the most
    SET [MaxModes] AS     
    ORDER(FILTER(NONEMPTY([Dim Stores].[Store].Members, {[Measures].[Price]}),    
    [Measures].[ValueCount] = MAX(NONEMPTY([Dim Stores].[Store].[Store].Members, [Measures].[Price]),    
    [Measures].[ValueCount])), [Measures].[Price], ASC)
    SELECT   {[Measures].[Price]} on 0,        
    [MaxModes]       
    --Filter out the duplicates        
    HAVING [MaxModes].CurrentOrdinal = 0 OR [Measures].[Price] <>             ([Measures].[Price], [MaxModes].Item([MaxModes].CurrentOrdinal - 2)) ON 1
    FROM [old_Prices_v2]
    WHERE {[Dim Date].[Date].&[2013-06-23T00:00:00]}*{[Dim Client Products].[Client Product].&[13]}*{[Dim Products].[Product].&[551]}

    I'm describing below what exactly is required:
    The cube has 4 dimensions (Date, Store, Product, Client Product) and one measure (Price). I need a measure to behave same as the MODE function in
    Excel (value that occurs most often). Practically the member should return a single value, that represents the price that appears most times. 
    While browsing the cube I need, for any combination of dimensions/hierarchies, to get the MODE of the price at its lowest grain (that is Date, Store,
    Product, Client Product). No need to aggregate the measure in any way. 
    For example if someone looks at a specific combination of Product & Client Product, the calculated measure would show the price that appears most
    times against that Product+Client Product, in any of the stores and in any of the dates.
    Example:
    Date
    Store Product
    Client Product
    Price
    05-Feb-2013
    Store1 Prod1
    ClProd1 50
    05-Feb-2013
    Store1 Prod1
    ClProd1 60
    06-Feb-2013
    Store2 Prod1
    ClProd1 60
    06-Feb-2013
    Store2 Prod1
    ClProd1 70
    05-Feb-2013
    Store1 Prod1
    ClProd2 80
    05-Feb-2013
    Store1 Prod1
    ClProd2 50
    06-Feb-2013
    Store2 Prod1
    ClProd2 50
    06-Feb-2013
    Store2 Prod1
    ClProd2 70
    Case1: If one looks at Prod1 & ClProd1 then the MODE(Price) is 60 as there are 4 rows to be aggregated and the value that repeats most is 60
    Case2: If one looks at Prod1 & ClProd1 & Store1 then the MODE(Price) is either 50 or 60 as there are 2 rows to be aggregated and both 50 and
    60 repeat 1 time. I this case any of them can be returned (act like TOP 1 in TSQL)
    Case3: If one looks at Prod1 & Store1 then the MODE(Price) is 50 as there are 4 rows to be aggregated and the value that repeats most is 50
    Case3: If one looks at Prod1 & 06-Feb-2013 then the MODE(Price) is 70 as there are 4 rows to be aggregated and the value that repeats most is 70.
    Any guidance will be much appreciated!
    Thank you in advance.
    Mihai

  • Calling a PL/SQL function from java

    I would like to call a pl/sql function from java. My pl/sql function is taking arrays of records as parameters. How do i proceed? Which specific oracle packages do I have to import?
    Please send an example.
    TIA,
    Darko Guberina

    Documentation here: http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref185
    says JPublisher can publish records too.
    But when I change the example given at http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref190 as following:
    PACKAGE "COMPANY" AS
    type emp_rec is record (empno number, ename varchar2(10));
    type emp_list is varray(5) of emp_rec;
    type factory is record (
    name varchar(10),
    emps emp_list
    function get_factory(p_name varchar) return factory;
    END;
    then I see <unknown type or type not found> at sql or java files generated. Any ideas?

  • Calling c++ function in java

    Hi,
    I would like to know how I can modify c++ program so that I can use its(c++) functions in java.
    the program is c++ ready-made and i would like to use its functions in a java package.
    i read the turiols concerning this on java.sun.com but does that mean that i have append "jni.h", "JNIEXPORT", etc to the c++ file?
    Hints shall be appreciated.
    Thanks.

    OK, thanks.I have tried the jni procedure but without success.
    Is it possible for Java talk to native code (c++) via TCP/IP.
    Please advice of any links/knowledge.
    Thanks.
    1. Strictly speaking, java does not operate on C++; it
    operates on C functions. This is more than a quibble:
    o JNI expects to call C functions, not methods of C++
    objects.
    o In fact, if you really just have functions, but they
    are compiled as C++, then you will probably have to
    declare C linkage.
    2. Functions called from java must conform to JNI
    calling conventions.
    o In general, the starting point is to define how you
    would like the object and native method to look in
    java, then run jni.h to generate the appropriate C
    header definitions, then write the C code.
    o Functions called from java must exist in shared
    libraries - on Windows, in dlls.
    o Existing C function libraries are typically accessed
    by writing a "wrapper" dll that implements the
    required java interface and then calls the existing
    library functions.
    o In fact, a wrapper could actually instantiate C++
    objects and call their methods.
    3. You might care to look up something called JACE,
    which some people claim can generate the kinds of
    wrappers discussed here.

  • Any reporting component in Java?

    Hi
    Are there any softwares or components that can generate reports(like Crystal reports) and that can be accessed from a Java runtime environment?
    Thanks
    Muler

    There's any OS build in Java? And the JVM is the
    "kernell" of the OS?There even exist hardware JVM's!
    If you want to build a Java OS I think you're better off if you steal/borrow a kernel, for example Linux, and then build the higher OS functions in Java. Java isn't that well suited for low-level systems programming.

  • System tray functionality in java

    Hi friends,
    I wanted to know which is the best package to use for implementing the system tray functionality in java.
    I read about systray, jtray,trayicon etc. I saw that TrayIcon is included in jdk 1.6. Is there any other included package in swing which will do this?
    i am just a beginner in swing programming.
    Thanks in advance.

    i would say not. as far as i can remember you can't directly set icons on a AWT MenuItem.
    and you shouldn't mix awt and swing components and most of the time can't do it anyway.
    however, if you have your own MenuItem i recon you could overwrite paint and paint the icons,
    i.e. images yourself using graphics2D methods.
    if you want to dig deeper into it, there are some good tutorials on paint:
    [http://java.sun.com/products/jfc/tsc/articles/painting/]
    might be worth, if you really want to have images and icons on your menuitems.
    i have never done this myself for awt components, but it should work.
    just found something interesting though:
    [http://atunes.svn.sourceforge.net/viewvc/atunes/aTunes_HEAD/src/net/sourceforge/atunes/gui/views/controls/JTrayIcon.java?view=markup]
    apparently, using this class, which derives from the normal TrayIcon, you can set a JPopupMenu and therefore use normal swing components.
    i did not try it though, but it looks very promising.
    Edited by: produggt on 20.08.2008 22:08

  • Lookiing for example of a user define aggregate function in Java

    I want to write an aggregate function in Java. Every example I found is in PL/SQL.
    I have written my fair share of JSPs, but this is different in that it is methods off an object.
    The documentation says it can be done in Java, but it's not clear to me how to define the ODCIAggregateInitialize, ODCIAggregateIterate, ODCIAggregateTerminate, and ODCIAggregateMerge methods.
    If any one can point me to, or send me, an example, I would be very grateful.
    TIA

    Hii Greg:
    You can find the code to implement a Domain Index for Oracle which uses ODCI Api in Java at.
    http://dbprism.cvs.sourceforge.net/viewvc/dbprism/ojvm/src/java/org/apache/lucene/indexer/LuceneDomainIndex.java?revision=1.29&view=markup
    This is the code of the implementation of the Lucene Domain Index:
    http://docs.google.com/Doc?id=ddgw7sjp_54fgj9kg
    The strategy to implement an use aggregate function is similar to implement a Domain Index.
    The PLSQL wrapper for the above code is:
    http://dbprism.cvs.sourceforge.net/viewvc/dbprism/ojvm/db/LuceneDomainIndex.sql?revision=1.20&view=markup
    Take a look at the code and if you have another question just drop me an email or post again into this list.
    Best regards, Marcelo.

  • Xref:populateXRefRow - ANY Mode

    Hi,
    In the AIA Service constructir we see the code:
    xref:populateXRefRow($xrefTableName,$xrefReferenceColumnName,$xrefReferenceValue,$xrefColumnName,$newGuid,'ANY')
    We have checked online for the documentation for this function and we can see that the mode can be set to 'ADD', 'UPDATE', or 'LINK' but 'ANY' is not listed.
    (See http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10224/med_xrefs.htm)
    Does anyone know what 'ANY' does and why it is missing from the documentation
    Thanks
    Robert

    ANY mode has a performance overhead compared to the other modes and hence it has been removed from the UI, so as to not to expose this feature in 11g.
    With 11g onwards, ANY mode is not recommended.
    However, the code is still available for backward compatibility and at runtime it will still work.

  • Even/Odd MOD Function

    Create an anonymous PL/SQL block that accepts an integer number N through SQL*Plus substituion variable and then determines for each of the numbers in the range 1 through N inclusive whether it is odd or even. Use the MOD function to determine whether a number is odd or even. For example, MOD (10, 2) = 0 and MOD (11,2)=1. Print the results on the screen.
    Your program should handle NULL values. N should be set to 0 if a NULL value is entered.
    Here is the code I generated for this problem:
    ACCEPT num1 PROMPT 'Please enter a number between 1 and 10: '
    DECLARE
    mynum NUMBER := &num1 (stores the user input into a PL/SQL variable);
    mynum1 NUMBER (stores the value returned from the MOD function);
    function MOD(mynum2 NUMBER)
    Return NUMBER (remainder datatype) is
    evenoddnum NUMBER (returns a remainder number from the calculation);
    BEGIN
    evenoddnum := mynum2/2 (divides the number entered by the user by 2);
    Return evenoddnum (the remainder from the division operation);
    END;
    BEGIN
    if (mynum) is NULL then
    mynum :=0;
    end if ; (sets all NULL values entered by the user to 0)
    mynum1 := MOD(mynum) (stores the remainder from the MOD calucation after the function is call. The user's input is passed as a parameter to the function) ;
    if (mynum1 = 0) then
    dbms_output.put_line ('You entered an even number');
    elsif (mynum1 = 1) then
    dbms_output.put_line ('You entered an odd number');
    end if; (test whether the remainder returned in mynum1 is 0 or 1)
    END;
    Error message received:
    SQL> start prog2c.sql
    Please enter a number between 1 and 10: 5
    mynum1 := MOD(mynum);
    ERROR at line 20:
    ORA-06550: line 20, column 18:
    PLS-00306: wrong number or types of arguments in call to 'MOD'
    ORA-06550: line 20, column 8:
    PL/SQL: Statement ignored
    Does anyone have any idea what this error message means???? I am totally confused.
    Thanks!

    First off, creating a local MOD function is a bad idea when there is already a system-level MOD function. At best, you'll totally confuse people.
    How about
    ACCEPT num1 NUMBER FORMAT 99 DEFAULT 0 PROMPT 'Enter a number (1-10): '
    DECLARE
      num  NUMBER := &num1;
    BEGIN
      IF( &num1 IS NULL )
      THEN
        dbms_output.put_line( 'Null' );
      ELSIF( MOD(&num1, 2) = 0 )
      THEN
        dbms_output.put_line( 'Even' );
      ELSE
        dbms_output.put_line( 'Odd' );
      END IF;
    END;Note that I don't check for values > 10 or < 1, you'll have to add that.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

Maybe you are looking for

  • Why can't I get rid of the "other" usage on my iPhone 4?

    I have 2.45gb of "other" usage on my iPhone 4. I have tried restoring it from backup, and the "other" still won't go away. I have restored all my settings and restarted my phone to it's factory settings and still no change. I have even deleted all my

  • Oracle Reports 10g, PDF fonts

    Hi All, I have an issue with PDF turkish characters. When I run the same report with destype HTMLCSS all the characters are ok. I want to mention that the report data is taken from a remote 9i DB using a database link. The chracter set of the remote

  • Jolt client vs. jolt connection pooling

    We are porting our app to weblogic. We are current users of jolt but since we weren't using weblogic we are currently using jolt client out of the app server. We are examining the merits of converting to use the jolt connection pool. I have been told

  • I car led my iPad screen and do not have Apple care, will apple replace this ?

    I cracked my iPad screen. Will apple replace ? I do not have apple care as it was a gift ?

  • Issues with Video and Sound

    Hello all. I am having an issue with my MacBook Pro. This issue travelled from 10.4 to 10.5 to 10.6 with me. The install from 10.4 to 10.5 was a clean install. I messed around with the video card a long time ago back in 10.4 through a boot camp windo