Call Service, run a query with a LimitFilter and a comparator, extend

I have a lot of difficulties running an InvocationService. I'm relatively new to coherence, please excuse my ignorance

Basically, I'm trying to get a web client access to a cluster of consistency (which uses * extend) and run a query with a LimitFilter and a comparator.
It looks that I implement the PortableObject interface on the comparator. I don't know how to be honest, and I'm getting an exception
: java.io.NotSerializableException:com.tangosol.util.internal.ConcurrentCounter

Do I need to apply the laptop on the comparator? I have to add the Group of comparison in a pof config XML? I have configuration errors?

Java code:
        InvocationService service = (InvocationService)  CacheFactory.getConfigurableCacheFactory().ensureService("ExtendTcpInvocationService");
        Map map = service.query(new LatestContentAgent(), null);
        Set result = (Set) map.get(service.getCluster().getLocalMember());
public class LatestContentAgent extends AbstractInvocable {

     private static final long serialVersionUID = 5121824227545845101L;

     @Override
     public void run() {
          final Filter filter = new EqualsFilter("getStatusId", Status.LIVE);
                final LimitFilter limitFilter = new LimitFilter(filter,200);
                NamedCache cacheInstance = CacheFactory.getCache("dist-extend-cache");
                setResult(cacheInstance.entrySet(limitFilter,  new ActivityContentVOComparator()));
     }
}
public class ActivityContentVO extends AbstractEvolvable implements Serializable, Cacheable {

     private static final long serialVersionUID = 1282169603551341131L;
     
     private static final int VERSION = 2; 

     private static final int WHEN_IDX = 2;
     private Date when;

     public ActivityContentVO() {     // hibernate needs this constructor
     }
     
     public Date getWhen() {
          return when;
     }

     public void setWhen(Date when) {
          this.when = when;
     }

     public void readExternal(PofReader reader) throws IOException {
          setWhen((Date) reader.readObject(WHEN_IDX));
     }

     public void writeExternal(PofWriter writer) throws IOException {
          writer.writeObject(WHEN_IDX, getWhen());
     }

     @Override
     public int getImplVersion() {
          return VERSION;
     }
}
public class ActivityContentVOComparator implements Comparator<ActivityContentVO>, Serializable,PortableObject {

    private static final long serialVersionUID = -8536328258251728594L;

    @Override
     public int compare(ActivityContentVO a1, ActivityContentVO a2) {
          if ( a1 == null) {
            return a2 == null ? 0 : 1;
        }
        if (a2 == null) {
            return -1;
        }
        
        final Date d1 = a1.getWhen();
        final Date d2 = a2.getWhen();
        if (d1 == null) {
            return d2 == null ? 0 : 1;
        } else if (d2 == null) {
            return -1;
        }
        
        return d2.compareTo(d1);
     }

    @Override
    public void readExternal(PofReader arg0) throws IOException {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void writeExternal(PofWriter arg0) throws IOException {
        // TODO Auto-generated method stub
        
    }
}
POF configuration file
<pof-config>
  <user-type-list>
    <!-- coherence POF user types -->
    <include>coherence-pof-config.xml</include>
    <user-type> 
      <type-id>1004</type-id> 
      <class-name>net.tm.ActivityContentVO</class-name> 
    </user-type>
    ....
    <user-type>
      <type-id>1009</type-id> 
      <class-name>net.tm.ActivityContentVOComparator</class-name> 
    </user-type>
  </user-type-list>
  <allow-interfaces>true</allow-interfaces>
  <allow-subclasses>true</allow-subclasses>
</pof-config>
Configuration consistency client-side:
<remote-invocation-scheme>
      <scheme-name>extend-invocation</scheme-name>
      <service-name>ExtendTcpInvocationService</service-name>
      <initiator-config>
        <tcp-initiator>
               <remote-addresses>
                        <socket-address>
                            <address system-property="tangosol.coherence.extend.remote.node1"></address>
                            <port system-property="tangosol.coherence.extend.invocation.remote.port1">9094</port>
                        </socket-address>
                        <socket-address>
                            <address system-property="tangosol.coherence.extend.remote.node2"></address>
                            <port system-property="tangosol.coherence.extend.invocation.remote.port1">9094</port>
                        </socket-address>
                    </remote-addresses>
                    <connect-timeout>10s</connect-timeout>
                  </tcp-initiator>
                  <outgoing-message-handler>
                    <request-timeout>5s</request-timeout>
                  </outgoing-message-handler>
                </initiator-config>
            <serializer>
                <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                <init-params>
                    <init-param>
                        <param-type>String</param-type>
                        <param-value system-property="tangosol.pof.config">app-pof-config.xml</param-value>
                    </init-param>
                </init-params>
            </serializer>           
</remote-invocation-scheme>
Consistent server configuration
        <proxy-scheme>
            <scheme-name>extend-proxy</scheme-name>
            <service-name>ExtendTcpProxyService</service-name>
            <thread-count>5</thread-count>
            <acceptor-config>
                <tcp-acceptor>
                    <local-address>
                        <address>localhost</address>
                        <port system-property="tangosol.coherence.extend.port">9094</port>
                    </local-address>
                </tcp-acceptor>
            </acceptor-config>
            <proxy-config>
                <cache-service-proxy>
                    <lock-enabled>true</lock-enabled>
                </cache-service-proxy>
            </proxy-config>
            <autostart 
                 system-property="tangosol.coherence.extend.enabled">
                 false
            </autostart>
        </proxy-scheme>
It's filling stack trace
 TcpConnection(Id=0x000001297F449E980A640BB49B3E90457BFBA97FDB268F4DCF95962206C4C35D, Open=true, LocalAddress=10.100.11.180:90
94, RemoteAddress=10.100.130.22:4989)
2010-06-28 16:54:50.398/277.593 Oracle Coherence GE 3.5.3/465 <D6> (thread=Proxy:ExtendTcpProxyService:TcpAcceptor, member=3): Opened: Channel(Id=1588644627, Open=true, Connection=0x000001297F449E980A640BB49B3E90457BFBA97FDB268F4DCF95962206C4C35D)
2010-06-28 16:54:50.528/277.723 Oracle Coherence GE 3.5.3/465 <Error> (thread=Proxy:ExtendTcpProxyService:TcpAcceptorWorker:3, member=3): An exception occurred while encoding a Response for Service=Proxy:ExtendTcpProxyService:TcpAcceptor: java.io.NotSerializableException: com.tangosol.util.internal.ConcurrentCounter
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)

....
   at com.tangosol.io.pof.PofBufferWriter$UserTypeWriter.writeObject(PofBufferWriter.java:2092)
        at com.tangosol.coherence.component.net.extend.message.Response.writeExternal(Response.CDB:15)
        at com.tangosol.coherence.component.net.extend.Codec.encode(Codec.CDB:23)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.encodeMessage(Peer.CDB:23)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor.encodeMessage(TcpAcceptor
.CDB:8)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:16)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.post(Peer.CDB:23)
        at com.tangosol.coherence.component.net.extend.Channel.post(Channel.CDB:25)
        at com.tangosol.coherence.component.net.extend.Channel.send(Channel.CDB:6)
        at com.tangosol.coherence.component.net.extend.Channel.receive(Channel.CDB:55)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer$DaemonPool$WrapperTask.run(Peer.CDB:9)
        at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
        at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:63)
        at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        at java.lang.Thread.run(Thread.java:619)
Published by: user6122052 on June 28, 2010 09:46

Hi user6122052,

The problem is that you try to return the result of a query:

setResult(cacheInstance.entrySet(limitFilter,  new ActivityContentVOComparator()));

and this set is an instance of com.tangosol.util.ConverterCollections$ ConverterEntrySet, which is not serializable. So, you can either convert it, for example:

Set setResults = cacheInstance.entrySet(limitFilter,  new ActivityContentVOComparator());
Set setConverted = new HashSet(setResults.size());
for (Iterator iter = setResults.iterator(); iter.hasNext(); )
    {
    Map.Entry entry = (Map.Entry) iter.next();
    setConverted.add(entry.getValue());
    }
setResult(setConverted);

or better yet - query the cache directly from your customer Extend.

Kind regards
Dimitri

Tags: Fusion Middleware

Similar Questions

  • Compare the result of a query with a number and return a message

    Hello
    I have the following query in oracle 9i:

    SELECT COUNT (*)
    OF hourly_files
    WHERE date_received = TO_DATE ((SELECT TO_CHAR (SYSDATE - INTERVAL '1' DAY, 'DDMMYYYY')
    (THE DOUBLE), 'DDMMYYYY');

    This will produce a number of lines required

    I need to compare the number of output with another number hardcoded (threshold) and print an appropriate example message

    If the result of the query above is 18000 and the number of threshold is fixed at 20000, then output a meesage:

    Number of files received less than 2000

    Any help will be very appreciated!

    Thank you.
    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT CASE WHEN COUNT(*) >5 THEN 'Number is > than 5'
      2              WHEN COUNT(*) <1 THEN 'Its less than 1'
      3  ELSE 'Its in between'
      4  END
      5  FROM emp
      6* WHERE deptno=20
    SQL> /
    
    CASEWHENCOUNT(*)>5
    ------------------
    Its in between
    
    SQL> SELECT COUNT(*) FROM emp
      2  WHERE deptno=10;
    
      COUNT(*)
    ----------
             3
    
  • Run the query with multiple parameters

    Dear

    Motion code below for the data is of per_all_people_f, who works for only one setting, when I pass 2 parameters, then is to take the last of them fail times two, could you pls advice how it both join in where clause.

    ================================================================================

    --------------------------------control file ----------------------------------

    ================================================================================

    ' Public Sub processFormRequest (pageContext OAPageContext, OAWebBean webBean)

    {

    super.processFormRequest (pageContext, webBean);

    Am = (OAApplicationModule) pageContext.getApplicationModule (webBean) OAApplicationModule;

    OAApplicationModule am = pageContext.getRootApplicationModule ();

    String model = pageContext.getParameter ("ALL");

    String pempno = pageContext.getParameter ("paramEmpNo");

    String phiredt = pageContext.getParameter ("paramHireDate");

    System.out.println ("control controller exucution");

    If (pageContext.getParameter ("GetData")! = null)

    {

    System.out.println ("controller exucution");

    Boolean ExecuteQuery = BooleanUtils.getBoolean (false);

    [Serializable] parameters = {pempno, phiredt, model, executeQuery};

    Class [] paramTypes = {String.class, String.class, String.class, Boolean.class};

    am.invokeMethod ("initSummary", parameters, paramTypes);

    OAAdvancedTableBean = table

    (OAAdvancedTableBean) webBean.findChildRecursive ("ResultsTable");

    When a user of handling started looking, we always need to run

    the query, so we move on 'false' to queryData().

    table.queryData (pageContext, false);

    }

    }

    ================================================================================

    -Request module file-

    ================================================================================

    public void initSummary (string model,

    String ParmEmpNum,

    String ParmHireDt,

    String created,

    String showMyOrders,

    Boolean ExecuteQuery)

    {

    xxEmployeeVOImpl vo = getxxEmployeeVO1();

    If (vo is nothing)

    {

    Tokens [] MessageToken = {new MessageToken ("parameter", "xxEmployeeVO")};

    throw new OAException ("AK", "FWK_TBX_OBJECT_NOT_FOUND", chips);

    }

    vo.initQuery (model, ParmEmpNum, ParmHireDt, executeQuery);

    System.out.println ("calling vo...");

    }

    ================================================================================

    -xxEmployeeVOImpl-

    ================================================================================

    public void initQuery (String, String ParamEmpNum, String ParmHireDt, Boolean executeQuery model)

    {

    StringBuffer whereClause = new StringBuffer (100);

    Whole CheckWhere;

    Vector of parameters = new Vector (3);

    setWhereClause (null);

    setWhereClauseParams (null);

    Integer bindCount = 0;

    String WhereClause = null;

    If ((ParamEmpNum! = null) & & (!("".)) Equals (ParamEmpNum.Trim ()))

    {

    setWhereClause (null);

    setWhereClauseParams (null);

    setWhereClause ("EMPLOYEE_NUMBER =:" + CheckWhere);

    setWhereClauseParam(0,ParamEmpNum);

    System.out.println ("request" + this.getQuery ());

    System.out.println ("ParamEmpNum" + ParamEmpNum);

    CheckWhere = CheckWhere ++;

    }

    If ((ParmHireDt! = null) & & (!("".)) Equals (ParmHireDt.Trim ()))

    {

    CheckWhere = CheckWhere ++;

    If (CheckWhere > 1)

    {

    setWhereClause (null);

    setWhereClauseParams (null);

    setWhereClause ("AND START_DATE =:" + CheckWhere);

    setWhereClauseParam(0,ParmHireDt);

    System.out.println ("request" + this.getQuery ());

    }

    on the other

    {

    {setWhereClause (null);

    setWhereClauseParams (null);

    setWhereClause ("START_DATE =:"+ CheckWhere ");

    setWhereClauseParam(0,ParmHireDt);

    System.out.println ("request" + this.getQuery ()) ;}

    }

    System.out.println ("ParamEmpNum" + ParmHireDt);

    }

    System.out.println ("request" + this.getQuery ());

    executeQuery();

    Try this:

    public void initQuery(String dummy,String ParamEmpNum,String ParmHireDt, Boolean executeQuery)
    {
      System.out.println("ParamEmpNum: "+ ParamEmpNum);
      System.out.println("ParmHireDt : "+ ParmHireDt);
    
      setWhereClause(null);
      setWhereClauseParams(null);
    
      String WhereClause = null;
    
      int bindCount = 0;
      HashMap paramMap = new HashMap();
    
      if  ( (ParamEmpNum != null) && (!("".equals(ParamEmpNum.trim())))  )
      {
      paramMap.put(bindCount,ParamEmpNum);
      WhereClause = "EMPLOYEE_NUMBER = :"+ (++bindCount) + " AND ";
      }
      if  ( (ParmHireDt != null) && (!("".equals(ParmHireDt.trim())))  )
      {
      paramMap.put(bindCount,ParmHireDt);
      WhereClause = WhereClause + ("START_DATE = :"+ (++bindCount) + " AND ");
      }
      if(bindCount > 0)
      {
      // Remove the AND at the end
      WhereClause = WhereClause.substring(0, WhereClause.length()-5);
    
      setWhereClause(WhereClause);
      for(int i = 0; i < bindCount; i ++) {
      setWhereClauseParam(i,paramMap.get(i));
      }
      }
    
      System.out.println("Query "+ this.getQuery());
      executeQuery();
    }
    

    You may need to change the START_DATE whereclause as below:

    WhereClause = WhereClause + ("START_DATE = TO_DATE (:" + (++ bindCount) + ', "MON-DD-YYYY" ") AND" ' ");

    Note:-need to specify the correct format.

    See you soon

    AJ

  • Has anyone who successfully registered a web services running ColdFusion 11 with Windows 7, IBM WebSphere 8.5, IBM JDK 1.7

    I'll set up a development zone Windows 7 running IBM WebSphere 8.5 (64-bit), IBM JDK 1.7 (64-bit). I installed the ColdFusion 11 ear (11,0,03,292480) file, but when I try to save a web services in ColdFusion Adminstrator using Web Service Version 1 or 2 times I get the following error.

    Error 500: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; Class = 'com' / Sun/tools/javac/hand, offset = 6

    What I read online (errors in Java: "UnsupportedClassVersionError... bad major version at offset = x '-the quite) the" 'java.lang.UnsupportedClassVersionError: "and"bad major release"means that the project has been compiled with a compiler to Java level higher than the runtime can support." I am under IBM JDK 1.7, when I do a version check (java.exe - version) in the directory bin it is said it is based on Oracle 7u13-b08. I read ColdFusion 11 supports Java 1.7 so I'm not sure what the problem is

    Problem solved! I found the following documentation: installation of the Configuration of JEE - enable web services

    Enable web services

    To enable web services, copy the tools.jar home Java WebSphere using the cfusion/lib directory.

    I'm not entirely sure why I needed to do what it has worked well in ColdFusion 9, JDK 1.6 IBM WebSphere IBM 7. There must be a pretty big difference between 1.7 JDK/software SDK IBM and Oracle/Sun JDK/SDK 1.7.

    Information of manifesto in the tools.jar that ships with ColdFusion 11 says:

    Manifest-Version: 1.0

    Created by: 1.7.0_07 (Oracle Corporation)

    As when the information of the manifesto of the tools.jar I copyied was:

    Manifest-Version: 1.0

    Ant-Version: Apache Ant 1.7.1

    Created by: 1.7.0 (IBM Corporation)

    Class-Path: ibmorbtools.jar

    I renamed the file tools.jar.bk - non - ibm it's important not to have a file with a ".jar" extension that has the same class on the inside path or it is loaded by the JAVA virtual machine.

  • Photosmart: Called tech support for help with my printer and got a sales pitch

    I called HP customer service today to get help with my wireless printer because it won't print wireless. What I got was a sales pitch to buy a value of $450 of virus protection! So very disappointed!

    Hello

    Thank you for using the HP forum.

    How can we help with your wireless?

    Have you tried the following:

    Please download and run the HP Print and Scan Doctor (PSDR) tool to diagnose and solve your problem

    http://h20180.www2.HP.com/apps/NAV?h_pagetype=s-926 & h_lang = on & h_client = s-h-E016-1 & h_keyword = DG - PDU

    Hope that helps.

  • The use of VS2015 to create a C++ Windows Service that works reliably with Windows 7 and 8 and 10

    We have created services windows (log events in the event viewer) using VS6.0 and noticed that they were not reliable running on Windows 7 (and beyond). They stopped unexpectedly after startup and so on.

    We have VS2005, 2010 for the development of Qt and never looked in services portage. We have to bought VS2015 and found that C++ Windows Service models have not been provided for VS 2010. We have inherited code which must remain C++ (c# conversion is not an option for us). Someone out there who has created a Service from Windows C++ for recent versions of OS? It installs with InstallUtil.exe as the most recent services c#?

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
    *
  • Need help in the optimization of the query with the Group and joins by clause

    I'm having the problem by running the following query... It takes a lot of time. To simplify, I added the two tables FILE_STATUS = stores the file load details and COMM table Board table job showing records treated successfully and which was communicated to the other system real. Records with status = T is trasnmitted to another system and traansactions with P is waiting.
    CREATE TABLE FILE_STATUS
    (FILE_ID VARCHAR2(14),
    FILE_NAME VARCHAR2(20),
    CARR_CD VARCHAR2(5),
    TOT_REC NUMBER,
    TOT_SUCC NUMBER);
    
    CREATE TABLE COMM
    (SRC_FILE_ID VARCHAR2(14),
    REC_ID NUMBER,
    STATUS CHAR(1));
    
    INSERT INTO FILE_STATUS VALUES ('12345678', 'CM_LIBM.TXT', 'LIBM', 5, 4);
    INSERT INTO FILE_STATUS VALUES ('12345679', 'CM_HIPNT.TXT', 'HIPNT', 4, 0);
    
    INSERT INTO COMM VALUES ('12345678', 1, 'T');
    INSERT INTO COMM VALUES ('12345678', 3, 'T');
    INSERT INTO COMM VALUES ('12345678', 4, 'P');
    INSERT INTO COMM VALUES ('12345678', 5, 'P');
    COMMIT;
    Here's the query I wrote to give me the details of the file that has been loaded into the system. He reads the table of State and the commission files to display the name of the file, total records loaded, total at the table of the commission and the number of records which has finally been passed successfully loaded (Status = T) with other systems.
    SELECT 
        FS.CARR_CD 
        ,FS.FILE_NAME 
        ,FS.FILE_ID
        ,FS.TOT_REC
        ,FS.TOT_SUCC
        ,NVL(C.TOT_TRANS, 0) TOT_TRANS
    FROM FILE_STATUS FS
    LEFT JOIN
    (
        SELECT SRC_FILE_ID, COUNT(*) TOT_TRANS
        FROM COMM
        WHERE STATUS = 'T'
        GROUP BY SRC_FILE_ID
    ) C ON C.SRC_FILE_ID = FS.FILE_ID
    WHERE FILE_ID = '12345678';
    In production, this request has several joins and takes a long time to deal with... the main culprit for me is the join on the COMM table to count the number of number of transactions sent. Please can you give me tips to optimize this query to get results faster? What I need to delete the Group and use the partition or something else. Help, please!

    Don't know if it will be faster based on the information provided, but analytical functions offer an alternative approach;

    select carr_cd, file_name, file_id, tot_rec, tot_succ, tot_trans
      from (select fs.carr_cd,
                   fs.file_name,
                   fs.file_id,
                   fs.tot_rec,
                   fs.tot_succ,
                   count(case
                            when c.status = 'T' then
                             1
                            else
                             null
                          end) over(partition by c.src_file_id) tot_trans,
                   row_number() over(partition by c.src_file_id order by null) rn
              from file_status fs
              left join comm c
                on c.src_file_id = fs.file_id
             where file_id = '12345678')
     where rn = 1;
    
    CARR_CD FILE_NAME            FILE_ID           TOT_REC   TOT_SUCC  TOT_TRANS
    ------- -------------------- -------------- ---------- ---------- ----------
    LIBM    CM_LIBM.TXT          12345678                5          4          2
    
  • How to write the query with parameters below and is null


    Hi, I need to recover the data if the parameter is passed on the ground, else retrieve all records where the field is null

    Example of


    CREATE TABLE DEPT
    (DEPTNO NUMBER (2),)
    DNAME VARCHAR2 (14).
    LOC VARCHAR2 (13));

    INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
    INSERT INTO VALUES DEPT (20, 'SEARCH', 'DALLAS');
    insert into dept values (30, 'SALES', 'CHICAGO');
    INSERT INTO VALUES DEPT (40, 'OPERATIONS', 'BOSTON');

    ALTER table dept add (object_id number);
    insert into dept values (50, 'OPERATIONS', 'BOSTON', 1);
    insert into dept values (60, 'OPERATIONS', 'BOSTON', 1);
    INSERT INTO VALUES DEPT (70, 'OPERATIONS', 'BOSTON', 2);

    Select * from Department where object_id =: p_object_id

    If I pass the object_id 1, it shloud retrieve the values of dept with object_id 1, but if I don't pass the object_id, it must retrieve all records where object_id is null

    IF 1 is passed as the id of the object, he must recover, 50, 60, if 1 is not passed as object_id it should 10,20,30,40 retive

    It works fine for me separately as,.

    Select * from Department where object_id =: p_object_id - 1

    Select * from Department where the object_id is null;

    Is it possible to do in a single query.

    Thank you

    SELECT *
    FROM dept
    WHERE object_id = :p_object_id
    OR (object_id is null and :p_object_id is null)
    

    is an approach.  It's a little talkative, but the meaning is clear.  If you can identify a value that would never appear in the data (for example-1)

    WHERE nvl( object_id, -1 ) = nvl(p_object_id, -1 );
    

    Justin

  • Need help on query with decimal places and trailing 0

    Community of Oracle I need help in the following situations:

    I received the following query:
    SELECT (SUM ("VALUE1") COUNT ("VALUE2"))
    FROM sometable;

    This returns the following results:
    200
    222,5

    I want to display as 222.50 222,5 value so I tried ROUND(value,2) but then came to the conclusion that the tour will not show drags me 0.
    So now I tried to_char(value,'9999DD00') and of course he's back 200.00 both 222.50.

    Now how to make it conditional so when a number has no decimal place it shows the whole number and when it has a decimal, it shows it in the format to_char(value,'9999DD00')?

    I hope I have made my situation and question correctly and I hope a solution.

    P. S.
    I need to appear like that since it is an average of the prices of the products

    Published by: Jnijman on July 3, 2010 13:06

    You can use CASES and INSTR:

    SQL> with t as ( -- generating sample data:
      2  select 200 col from dual union
      3  select 222.5 from dual
      4  )
      5  --
      6  -- actual query:
      7  --
      8  select col
      9  ,      case
     10           when instr(col, ',') > 0
     11           then to_char(col, '999d00')
     12           else to_char(col, '999' )
     13         end formatted_col
     14  from   t;
    
           COL FORMATT
    ---------- -------
           200  200
         222,5  222,50
    
  • My lap top was attacked today by virus disc HARD SMART... can you help me irradicate? I am running windows Xp with Microsoft Defender and other microsoft anti virusware. Help

    IBM T42 Windows XP Pro... Current.  When you turn on the computer, the screen begins to open normally, then goes black, with an opening with SMART HARD disk window and all things go wrong.  My antivirus has recently attracted four virus of my email... but it forced... help

    Richard leste

    This guide has been created for you!

  • Hierarchical query with several parents and children without parents

    Hi all,

    I have a problem of follow-up:

    1, parent_1,.

    2, child_1, 1

    3, child_2, 1

    4, grandchild_1, 2

    5, parent_2,.

    6, child_3, 5

    7, child_0,.

    In this case, I can have multiple parents, and I also have children who do not have parents. Can someone help me solve this problem

    Concerning

    Hello

    So, if a node has itself or 0 as its parent_id, it's the same as with the NULL value?

    In this case, include all these possibilities in the START WITH clause:

    SELECT DLI

    , LPAD (' ' ')

    , (LEVEL - 1) * 3

    , ' '

    ) || descr AS descr

    parent_id

    T

    START WITH NVL (parent_id, 0) (0, DLI)

    CONNECT BY parent_id = PRIOR DLI

    AND idd <> parent_id

    ;

  • A query with line numbers and colum?

    Hello
    I have my java code divided into if conditions and each if the article I need to select a certain field in a table. Is it somehow possible to select a table field that for example is in the third row and the fifth column? So basically, how to choose a certain element of the matrix?

    Thanks :)

    Published by: user10956166 on April 5, 2009 06:09

    Hello

    Assuming that you have a table called Distance:

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL> DESCRIBE DISTANCE;
    Name    Type         Nullable Default Comments
    ------- ------------ -------- ------- --------
    LINN    VARCHAR2(30) Y
    TALLINN NUMBER       Y
    TARTU   NUMBER       Y
    P2RNU   NUMBER       Y                         
    
    SQL> select * from distance;
    
    LINN                              TALLINN      TARTU      P2RNU
    ------------------------------ ---------- ---------- ----------
    TALLINN                                 0        186        128
    TARTU                                 186          0        174
    P2RNU                                 128        174          0
    
    SQL>
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2     v_sql         VARCHAR2(4000);
      3     v_column_name VARCHAR2(30):= 'TARTU';
      4     v_to          VARCHAR2(30):= 'P2RNU';
      5     v_distance    NUMBER;
      6  BEGIN
      7     v_sql := 'SELECT ' || v_column_name || ' FROM DISTANCE d WHERE d.LINN = ''' || v_to || '''';
      8     EXECUTE IMMEDIATE v_sql
      9        INTO v_distance;
     10
     11     dbms_output.put_line(v_distance);
     12
     13  EXCEPTION
     14     WHEN OTHERS THEN
     15        dbms_output.put_line(SQLERRM);
     16  END;
     17  /
    
    174
    
    PL/SQL procedure successfully completed
    
    SQL> 
    

    Kind regards

  • How to capture the data of type string with agent script and then compared to an alarm

    Hello...

    How to capture the string with agent of script data and then create a rule to compare the string data to generate alarm?

    Thank you!...

    Start here:

    http://en.community.Dell.com/TechCenter/performance-monitoring/Foglight-administrators/w/Admins-wiki/6155.custom-script-agent-1-leverage-an-existing-monitoring-script-to-push-data-into-Foglight

  • Is it possible to run a query of IdocScript with GET_SEARCH_RESULTS of Service?

    Hi all

    I need to run the query with GET_SEARCH_RESULTS service below.

    xSubmissionDate "ArchivePackage" < AND > dDocType < match > < 8 October 13 11:03 ' < AND > xArchiveDocName < EQUALS > dDocName


    Part of this query works fine, but when the part in BOLD is also used I get an error, reason be there there is nothing like < EQUALS > when you use the Query Builder


    Instead it is possible to run the idocscript with any service below?


    <$ (dDocType as "ArchivePackage") & xSubmissionDate < dateCurrent(-365) & (XArchiveDocname == dDocname) $>

    I tried with GET_SEARCH_RESULTS, but received erroneous results and no mistake.

    Is this even possible or should I just change my approach?

    Concerning

    What about the GET_DATARESULTSET service?

    required params:

    dataSource = Documents

    resultName =

    whereClause = (revisions.dDocType = 'ArchivePackage' AND DocMeta.xArchiveDocName = Revisions.dDocName and...) / / pure SQL where clause

  • AF:query with web services data control

    Hi all

    I'm very new to using web services as a data source in the ADF. I'm looking to use a component of af: query (with saved searches and advanced mode) with a web service data control.

    The doc - http://docs.oracle.com/cd/E24382_01/web.1112/e16182/appendix_datacontrols.htm#CHDGBBIJ - it seems that there is some programmatic application necessary to achieve this goal. I guess that means that you are required to implement a custom QueryModel and related classes. My understanding is correct?

    Is there a sample (or documentation) available for this application? I searched the web but can't find anything useful.

    Note: For the purpose of learning, I just exposed service interface of the Module of an Application as a web service remote. The web service has my view exposed as an operation criteria.

    Thanks in advance,
    Bruno Guillaume

    Hello

    the query component does not work out of the box with the DataControl WS that it does not support the named criteria (which will be for a long time in the future). To create a request form, you can drag a WS method as a parameter. If the method has arguments of complext, you will find the complex argument that manufacturers in the Panel DataControl, so you can flatten by drag and drop in the form of parameter

    Frank

Maybe you are looking for

  • Why can't I pay with my mobile card on Lords

    Why can't my with payer blue card whenever I want to buy a product he says impossible to buy 9) I DO INCLUDES NOT THESE MY CARD AND I WANT THAT YOU ME LAIISER MAKE MY PURCHASES THANKS

  • Satellite A500-1GL - some FN keys only work does not correctly

    HelloI have the Toshiba Satellite A500-1GL, and I have a problem with the FN key (actually not the key itself, is the other keys, the keys that have orders)for example:FN + ESC = mute, and it works great!But... FN + F8, should turn the wireless, but

  • How to install properly a second disk in my Qosmio X 500-h-13?

    Hello I would like to know if there is any accessory to install a second hard drive in a Qosmio x 500-h-13?I think that it is necessary to fix the hard disk after the sata connector plugin and before closing the Bay, but I do not know? Thanks, tonio8

  • Unexpected errors of CIC

    Hello We recently purchased several new PC DELL Optiplex. These PC using Windows 7, 64-bit, in combination with a National instruments PCI-GPIB card. We currently use the version 2.8 of the library of NOR-488. 2. All of these PC are used to communica

  • Windows live messenger cannot start or open

    When I click to open windows live messenger says error message the application failed to start because it is next, the configuration is incorrect. I don't know what to do. Please help me