Multiple condtions in a single if Statement in .rtf templete of Bi Publishe

Hi ,
I want to use a single if statement with multiple condition .
For Example : If :Parameter1=10 and Parameter2=10 and Parameter3=30
then < ' mseesge '>
end if ;
Any body Please suggest me how can i do it in the .rtf .
Thanks,
Mike .
Edited by: user3449250 on Feb 27, 2009 7:53 AM

Hi Mike,
for example
<?if:JOB='MANAGER' and ENAME='JONES'?> XXX <?end if?>
Regards
Rainer

Similar Messages

  • Inserting multiple rows using a single Insert statement without using dual

    Hi all,
    i am trying to insert multiple rows using a single insert statement like the below one.
    The below one works fine..
    But is there any other change that can be done in the below one without using dual...
    insert all
    into ps_hd_samp (num1,num2) values (1,1)
    into ps_hd_samp (num1,num2) values (2,2)
    into ps_hd_samp (num1,num2) values (3,3)
    select 1 from dual;

    NiranjanSe wrote:
    Hi all,
    i am trying to insert multiple rows using a single insert statement like the below one.
    The below one works fine..
    But is there any other change that can be done in the below one without using dual...
    insert all
    into ps_hd_samp (num1,num2) values (1,1)
    into ps_hd_samp (num1,num2) values (2,2)
    into ps_hd_samp (num1,num2) values (3,3)
    select 1 from dual;
    SQL> create table ps_hd_samp (num1 number,num2 number);
    Table created.
    SQL> insert all
      2  into ps_hd_samp (num1,num2) values (1,1)
      3  into ps_hd_samp (num1,num2) values (2,2)
      4  into ps_hd_samp (num1,num2) values (3,3)
      5  select count(*)
      6  from ps_hd_samp;
    3 rows created.
    SQL> select * from ps_hd_samp;
          NUM1       NUM2
             1          1
             2          2
             3          3

  • HOW CAN I  USE MULTIPLE INNERJOINS IN A SINGLE SELECT STATEMENT?

    HI,
    I AM SHABEER AHMED,
    I AM GETTING AN ERROR WHILE I ATTEMPT TO EXECUTE A SELECT STATEMENT WITH MULTIPLE INNER JOINS . BECOZ I WANT TO FETCH ITEM DATA, PARTNER DATA  BASED ON HEADER DATA .
    THEN OF COURSE I HAVE FETCH DATA FROM VBAK VBAP VBKD SO LZ SEND ME THE SOLUTION.
    BYE

    Hi,
    1.Just see this:
    SELECT * INTO CORRESPONDING FIELD OF TABLE itab
    FROM t1 INNER JOIN t2 ON t1f4 EQ t2f4
    INNER JOIN t3 ON t2f5 EQ t3f5 AND
    t2f6 EQ t3f6 AND
    t2f7 EQ t3f7.
    2.But better to use for all entries.It increases the performance.
    FOR ALL ENTRIES
    Tabular Conditions
    The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
    SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
    <cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
    The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
    You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
    Example for ALL ENTRIES
    DATA: TAB_SPFLI TYPE TABLE OF SPFLI,
    TAB_SFLIGHT TYPE SORTED TABLE OF SFLIGHT
    WITH UNIQUE KEY TABLE LINE,
    WA LIKE LINE OF TAB_SFLIGHT.
    SELECT CARRID CONNID
    INTO CORRESPONDING FIELDS OF TABLE TAB_SPFLI
    FROM SPFLI
    WHERE CITYFROM = 'NEW YORK'.
    SELECT CARRID CONNID FLDATE
    INTO CORRESPONDING FIELDS OF TABLE TAB_SFLIGHT
    FROM SFLIGHT
    FOR ALL ENTRIES IN TAB_SPFLI
    WHERE CARRID = TAB_SPFLI-CARRID AND
    CONNID = TAB_SPFLI-CONNID.
    LOOP AT TAB_SFLIGHT INTO WA.
    AT NEW CONNID.
    WRITE: / WA-CARRID, WA-CONNID.
    ENDAT.
    WRITE: / WA-FLDATE.
    ENDLOOP.
    INNER JOINS
    In a relational database, you normally need to read data simultaneously from more than one database table into an application program. You can read from more than one table in a single SELECT statement, such that the data in the tables all has to meet the same conditions, using the following join expression:
    SELECT...
    FROM <tab> INNER JOIN <dbtab> AS <alias> ON <cond> <options>
    where <dbtab> is a single database table and <tab> is either a table or another join expression. The database tables can be specified statically or dynamically as described above. You may also use aliases. You can enclose each join expression in parentheses. The INNER addition is optional.
    A join expression links each line of <tab> with the lines in <dbtab> that meet the condition <cond>. This means that there is always one or more lines from the right-hand table that is linked to each line from the left-hand table by the join. If <dbtab> does not contain any lines that meet the condition <cond>, the line from <tab> is not included in the selection.
    The syntax of the <cond> condition is like that of the WHERE clause, although individual comparisons can only be linked using AND. Furthermore, each comparison must contain a column from the right-hand table <dbtab>. It does not matter on which side of the comparison it occurs. For the column names in the comparison, you can use the same names that occur in the SELECT clause, to differentiate columns from different database tables that have the same names.
    The comparisons in the condition <cond> can appear in the WHERE clause instead of the ON clause, since both clauses are applied equally to the temporary table containing all of the lines resulting from the join. However, each join must contain at least one comparison in the condition <cond>.
    Example for INNER JOINS
    REPORT demo_select_inner_join.
    DATA: BEGIN OF wa,
    carrid TYPE spfli-carrid,
    connid TYPE spfli-connid,
    fldate TYPE sflight-fldate,
    bookid TYPE sbook-bookid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY carrid connid fldate bookid.
    SELECT pcarrid pconnid ffldate bbookid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( spfli AS p
    INNER JOIN sflight AS f ON pcarrid = fcarrid AND
    pconnid = fconnid )
    INNER JOIN sbook AS b ON bcarrid = fcarrid AND
    bconnid = fconnid AND
    bfldate = ffldate )
    WHERE p~cityfrom = 'FRANKFURT' AND
    p~cityto = 'NEW YORK' AND
    fseatsmax > fseatsocc.
    LOOP AT itab INTO wa.
    AT NEW fldate.
    WRITE: / wa-carrid, wa-connid, wa-fldate.
    ENDAT.
    WRITE / wa-bookid.
    ENDLOOP.
    Regards,
    Shiva Kumar(Reward if helpful).

  • How to insert multiple rows in a single insert statement in MaxDB?

    hi,
    I was looking at syntax but i could not get it right.. may be some could help me.
    // Insert single row works fine
    INSET INTO test_table(column_name) values (value1) IGNORE DUPLICATES
    // Insert multiple rows, doesn't
    INSET INTO test_table(column_name) values (value1), (value2), (value3) IGNORE DUPLICATES
    Can somebody help me with this.
    thanks,
    sudhir.

    Multiple inserts do only work with parametrized statements, usually used in interfaces like JDBC, ODBC etc.
    With static SQL statements it is not possible.
    Regards Thomas

  • Updating multiple fields using a single update statement.

    Hi All,
    I am a beginner to Oracle. I have used the following Hint in an update query that is executed in Oracle 10G. We recently updated the Oracle to version 11g and when executing the query getting the following Error: ORA-01779: cannot modify a column which maps to a non key-preserved table. PFB the query. Please suggest me some ways that I can do to avoid this error.
    UPDATE /*+ bypass_ujvc */
    (SELECT t1.STG_DEL_CONDITION, t2.condition
    FROM stg_reports_membenft_latest T1 JOIN (select ods_ssn_grp,sys_id, first_value(STG_DEL_CONDITION) over(PARTITION BY ods_ssn_grp,sys_id
    ORDER BY STG_DEL_CONDITION DESC) AS
    condition from stg_reports_membenft_latest) T2
    ON T1.ods_ssn_grp = T2.ods_ssn_grp AND T1.SYS_ID=T2.SYS_ID ) x
    SET x.STG_DEL_CONDITION = x.condition;
    Thanks and Regards,
    Karthik Sivakumar.

    I used the below query and got the Result.
    Thank You all
    MERGE INTO stg_reports_membenft_latest x1
    USING (SELECT distinct ods_ssn_grp,
    sys_id,
    First_value(STG_DEL_CONDITION) OVER(partition BY ods_ssn_grp,sys_id
    ORDER BY STG_DEL_CONDITION DESC)
    AS condition
    FROM stg_reports_membenft_latest) x2
    ON ( x1.ods_ssn_grp = x2.ods_ssn_grp
    AND x1.SYS_ID = x2.sys_id )
    WHEN matched THEN
    UPDATE SET x1.STG_DEL_CONDITION=x2.condition;

  • Insert multiple records into a table(Oracle 9i) from a single PHP statement

    How can I insert multiple records into a table(Oracle 9i) from a single PHP statement?
    From what all I've found, the statement below would work if I were using MySQL:
         insert into scen
         (indx,share,expire,pitch,curve,surface,call)
         values
         (81202, 28, 171, .27, 0, 0, 'C' ),
         (81204, 28, 501, .25, 0, 0, 'C' ),
         (81203, 17, 35, .222, 0, 0, 'C' ),
         (81202, 28, 171, .27, 2, 0, 'C' ),
         (81204, 28, 501, .20, 0, 1, 'C' ),
         (81203, 28, 135, .22, 1, 0, 'C' )
    The amount of records varies into the multiple-dozens. My aim is to utilize the power of Oracle while avoiding the i/o of dozens of single-record inserts.
    Thank you,
    Will

    You could look at the INSERT ALL statement found in the documentation here:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_913a.htm#2133161
    My personal opinion is that you probably won't see any benefit because under the hood I think Oracle will still be doing single row inserts. I could be wrong though.
    The only way to confirm was if you did a test of multiple inserts vs an INSERT ALL, that is if the INSERT ALL met your requirements.
    HTH.

  • Merge statement - update multiple columns from a single sub-select

    Is it possible to write in 10gR2, a MERGE statement, with UPDATE for multiple columns from a single sub_select?
    like this:
    MERGE INTO tableA
    using ( select * from temp) tmp
    on( tableA. col1 = tmp.col1)
    when matched then
    update set  ( tableA.col5,
                       tableA.col6,
                       tableA.col7) = ( select sum(col2), sum(col3), sum(col5)
                                                                                 from tableX
                                                                                where tableX.col1 = tableA.col1...)

    Hi,
    The USING clause is not a sub-query, so it can't reference columns from tables that are not in it.
    Include tableA in the USING clause if you really need to refer to it there. (It's not obvious that you do.)
    As always, it helps if you post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data (In the case of a DML statement, such as MERGE, this will be the state of the tables when everything is finished.)
    (4) Your best attempt so far (formatted)
    (5) The full error message (if any), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
    Formatted tabular output is okay for (3).

  • Update multiple columns with single update statement..

    HI all,
    i am reading the columns value from different table but i want to update it with signle update statement..
    such as how to update multiple columns (50 columns) of table with single update statement .. is there any sql statement available i know it how to do with pl/sql..

    As I understood, may be this. Here i am updating ename,sal, comm columns all at once.
    SQL> select * from emp where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17/12/1980 12:00:00        800                    20
    SQL> UPDATE emp
      2     SET ename = lower (ename),
      3         sal = sal + 1000,
      4         comm = 100
      5   WHERE empno = 7369;
    1 row updated.
    SQL> select * from emp where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7369 smith      CLERK           7902 17/12/1980 12:00:00       1800        100         20
    SQL> UPDATE emp
      2     SET ename = (SELECT 'ABCD' FROM DUAL),
      3         sal = (SELECT 1000 FROM DUAL),
      4         comm = (SELECT 100 FROM DUAL)
      5   WHERE empno = 7369;
    1 row updated.

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • Produce report NOT based on a single sql statement

    I want to produce a tabular report based on a series of sql statments. Specifically, a report of managers that wil include counts of employees that are in other tables using differing criterias.
    Name Count Count
    using using
    criteria 1 criteria 2
    Manager1 35 242
    I would expect to write an anonymous pl/sql block with a driving cursor determining the managers to report on. Within that cursor, I would execute a number of other queries to derive the count for each of the two columns.
    I have tried creating a report region based on a sql statement, but that requires a single sql statement. I also tried creating a report region based on plsql, but it required an into statement of defined items. This option looks like it can provide multiple rows, but since it selected 'INTO' named fields, it only creates a report with the last row of data.
    I must be missing something. Any suggestions are greatly appreciated!!!

    If you want a wizard to create the form and report for you then yes you need to have a table. One thing that you can do is define a view that contains the data you need and define an Instead Of trigger on that view so the automatic fetch and dml will work but you can have the data stored into the different objects. basically the view and the trigger work as a router/dispatcher for the data.
    *edit*
    I should also add that you can write a pl/sql package which does the fetch and the dml operations with the form items as input. This is the solution I would typically use for any form that was not a simple CRUD form for a table. One thing to note is for the fetch I prefer to use out parameters for the form items so it requires the developer to map the item to the param in the app so it will show up when you are searching through the app. I highly discourage hiding item references inside of packaged code.
    Good Luck!
    Tyson
    Message was edited by: TysonJouglet

  • With multiple events in a single event case, how to associate value with the correct object?

    I am playing with the template where an event structure takes note of user inputs and a main state machine is then used to respond to these inputs. When I only monitor one control I use the 'NewVal' output to read out the changed value. But when I monitor multiple objects with a single case I also have to associate the readout with the correct owner. After some tinkering I was able to extract the label property and use a case to assign them. Are there better ways of doing this? For example maybe there is a way to connect the label text directly to the 'bundle by name'?
    Also this should be easy to accomplish by simply creating local variables of the objects and read from them, but I got the impression that the use of global and local variables is now strongly discouraged?
    Thanks for any suggestions!
    Attachments:
    Untitled.png ‏39 KB

    Well, I don't really like these theroretical discussions. Can you attach a simplified version of some of your code?
    There are many other ways to identify the particular control. You could for example search an array of references for the value of the "ctlref" event data node. This would make the code much more robust (your code will fail for example if you (or some other programmer updating your code in a few years!) notices a mispelling and edits the label without also changing the case structure cases).
    LabVIEW Champion . Do more with less code and in less time .

  • Is there any way to create multiple users in a single shot in oracle db

    Can Any one tell me, is there any way to create multiple users in a single shot in oracle database.

    Hello Nunhum,
    I guess this was not my question.. This is not what I m asking.. I know there is not a single sql statement in oracle ,which could create multiusers alike UNIX/LINUX(OS LEVEL), Whatever you have written..is simple creating them one by one.
    What I am expecting is to have PL/SQL statement which could help us in this regard.

  • Multiple records as a single transaction in JDBC Receiver Adapter

    Hi,
    I am sending multiple records in a single message to a JDBC receiver adapter to get updated to the database. How to make all the insert a single transaction. Like all the records has to be inserted else all has to be rolled back.
    For eg for table Employee two fields EMPNO and EMPNAME
    EMPNO  EMPNAME
    1            Jay
    2            Christie
    These two records are in the same message and has to be updated
    if one fails the other has to be rolled back.
    How can i achieve it using a JDBC Receiver Adapter.
    Thanks
    Sebin

    Hi Rolf Micus,
    My xml structure to insert 2 tables are as follow:-
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_PODB xmlns:ns0="http://abeam.com/xi/fer_filejdbc_scenarios1">
    ..   <STATEMENT_HEADER>
    ....      <ROW action="INSERT">
    ......         <TABLE>ZPO_HEADER</TABLE>
    ......        <access>
    ........            <PONUMBER>001</PONUMBER>
    ........            <PODATE>20070801</PODATE>
    ........            <POAMOUNT>200.99</POAMOUNT>
    ....         </access>
    ....      </ROW>
    ..   </STATEMENT_HEADER>
    ..   <STATEMENT_DETAIL>
    ....      <ROW action="INSERT">
    ......         <TABLE>ZPODETAIL</TABLE>
    ......         <access>
    ........            <PONUMBER>001</PONUMBER>
    ........            <PONO>1</PONO>
    ........            <POITEMCODE>A12345</POITEMCODE>
    ........            <POITEMDESC>Testing A</POITEMDESC>
    ........            <POITEMAMOUNT>2990.00</POITEMAMOUNT>
    ........            <POITEMQTY>55</POITEMQTY>
    ......         </access>
    ....      </ROW>
    ..   </STATEMENT_DETAIL>
    </ns0:MT_PODB>
    Fro the structure that you have declared..there is only contained 1 statement, try to admend your MT to have 2 statements.
    If you wish to insert multiple records, just create a loop/multiple of access tag inside STATEMENT tag. For example, multiple records insert into Header should have multiple access tag in Header STATEMENT. Same goes for muliple records insert into Details STATEMENT should have multiple access tag in Details STATEMENT.
    With this structure, whenever any records insert/update/delete failed...it will rollback all the transactions together, ie. Header and Details.
    PS: For different table, please create different STATEMENT.
    Hope it helps.
    Message was edited by: Pua Ming Fei

  • Testing Process for Gathering Single Object stats.

    Hello Oracle Experts,
    I work a critical system and due to some high stakes all and every change is very heavily scrutinized here whatever the level is. And one of such changes which is currently under scrutiny is gathering object stats for single objects. Just to give you a background its an Oracle eBusiness site so fnd_stats is used instead of usual dbms_stats and we've an inhouse job that depending on the staleness of the objects gather stats on them using FND_STATS. (RDBMS : 10.2.0.4 Apps Release 12i).
    Now, we've seen that occasionally it leaves some of the objects that should ideally be gathered so they need to be gathered individually and our senior technical management wants a process around it - for gathering this single object stats (I know!). I think I need to explicitly mention here that this need to gather stale object stats has emerged becs one of the plans has gone pretty poor (from 2 ms to 90 mins) and sql tuning task states that stats are stale and in our PROD copy env (where the issue exists) gathering stats reverts to original good plan! So we are not gathering just because they are stale but instead because that staleness is actually causing a realtime problem!
    Anyway, my point is that it has been gathered multiple times in the past on that object and also it might get gathered anytime by that automatic job (run nightly). There arguments are:
    i. There may be several hundred sql plans depending on that object and we never know how many, and to what, those plan change and it can change for worse causing unexpected issues in the service!
    ii. There may be related objects whose objects have gone stale as well (for example sales and inventory tables both see related amount of changes on column stock_level) and if we gather stats only on one of them and since those 2 cud be highly related (in queries etc.) that may mess up the join cardinality etc. messing up the plans etc.
    Now, you see they know Oracle as well !
    My Oracle (and optimizer knowledge) clearly suggests me that these arguments are baseless BUT want to keep an open mind. So my questions are :
    i. Do the risks highlighted above stand any ground or what probably do you think is there of happening any of the above?
    ii. Any other point that I can make to convince the management.
    iii. Or if those guys are right, Do you guys use or recommend any testing strategy/process that you can suggest to us pls?
    Another interesting point is that, they are not even very clear at this stage how they are gonna 'test' this whole thing as the 'cost' option like RAT (Real Application Testing) is out of question and developing an inhouse testing tool still need analyzing in terms of efforts, worth and reliability.
    In the end, Can I request top experts from the 'Oak Table' network to make a comment so that I can take their backings!? Well I am hoping here they'll back me up but that may not necessarily the case and I obviously want an honest expert assessment of the situation and not merely my backing.
    Thanks so much in advance!

    >
    I work a critical system and due to some high stakes all and every change is very heavily scrutinized here whatever the level is.
    Another interesting point is that, they are not even very clear at this stage how they are gonna 'test' this whole thing as the 'cost' option like RAT (Real Application Testing) is out of question and developing an inhouse testing tool still need analyzing in terms of efforts, worth and reliability.Unfortunately your management's opinion of their system as expressed in the first paragraph is not consistent with the opinion expressed in the second paragraph.
    Getting a stable strategy for statistics is not easy, requires careful analysis, and takes a lot of effort for complex systems.
    >
    In the end, Can I request top experts from the 'Oak Table' network to make a comment so that I can take their backings!? Well I am hoping here they'll back me up but that may not necessarily the case and I obviously want an honest expert assessment of the situation and not merely my backing.
    The ideal with stats collection is to do something simple to start with, and then build on the complex bits that are needed - something along the lines suggested by Dan Morgan works: a table driven approach to deal with the special cases which are usually: the extreme indexes, the flag columns, the time-based/sequential columns, the occasional histogram, and new partitions. Unfortunately you can't get from where you are to where you need to be without some risk (after all, you don't know which bits of your current strategy are causing problems).
    You may have to progress by letting mistakes happen - in other words, when some very bad plans show up, work out WHY they were bad (missing histogram, excess histogram, out of date high values) to work out the minimum necessary fix. Put a defensive measure in place (add it to the table of special cases) and run with it.
    As a direction to aim at - I avoid histograms unless really necessary, I like introducing function-based indexes where possible, and I'm perfectly happy to write small programs to fix columns stats (low/high/distinct) or index stats (clustering_factor/blevel/distinct_keys) and create static histograms.
    Remember that Oracle saves old statistics when you create new ones, so any new stats that cause problems can be reversed out very promptly.
    Regards
    Jonathan Lewis

  • Multiple selects() within a single VM

    Is anyone aware of any contention issues when running multiple threads within a VM where each thread has it's own select statement?
    I have an home grown app server that allows me to run multiple applications within a single VM. The applications are unrelated however they sometimes communicate with each other via TCP. All of them are very network intensive ( 500 messages a second where each message is around 200 bytes ). These apps are usually single threaded where the main thread is a select() loop.
    Therefore, each application is a single threaded select() loop but there are multiple applications running within a single VM.
    I am seeing performance issues when two apps running within the same VM try to send messages to one another via TCP. When the two apps are running on different boxes one app can send about 10,000 messages a second to the other app. However, when the apps are running within the same VM ( localhost TCP connection ) I can only transfer about 1000 messages a second.
    Are 2 selectors running within the same VM a problem? Is it synchronized within the VM so that only one select can fire at a time?
    I am running on a dual proc RH3 box with plenty of memory.
    Any ideas?

    Works for me, though I'm trying on Windows. Test program below. I get >10,000 replies and responses per second over loopback with both "java SelectPingPong both" (one VM) and running client and server on separate VMs.
    Does this program get only 1000 messages/s on Linux? What VM version?
    import java.util.*;
    import java.net.*;
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    public class SelectPingPong
        private static final int MESSAGE_SIZE = 200;
        private String server_name;
        private Selector selector;
        private HashMap clients = new HashMap();
        static class Client
         ByteBuffer buf = ByteBuffer.allocate(MESSAGE_SIZE);
         long connect_time = System.currentTimeMillis();
         int number_of_messages;
        public SelectPingPong(int port, String server_name)
         throws IOException
         this.server_name = server_name;
         selector = Selector.open();
         ServerSocketChannel server_channel = ServerSocketChannel.open();
         server_channel.configureBlocking(false);
         server_channel.socket().bind(new InetSocketAddress(port));
         server_channel.register(selector, SelectionKey.OP_ACCEPT);
        public Socket connect(String host, int port)
         throws IOException
         SocketChannel channel = SocketChannel.open();
         Socket socket = channel.socket();
         socket.connect(new InetSocketAddress(host, port));
         configureSocket(socket);
         channel.configureBlocking(false);
         channel.register(selector, SelectionKey.OP_READ);
         clients.put(channel, new Client());
         return socket;
        private void configureSocket(Socket socket)
         throws IOException
         // Let's say we have a request-reply protocol with modest requirements
         socket.setReceiveBufferSize(1024);
         socket.setSendBufferSize(1024);
        public void mainLoop()
         while (true) {
             try {
              selector.select();
              for (Iterator iter = selector.selectedKeys().iterator(); iter.hasNext(); ) {
                  SelectionKey key = (SelectionKey) iter.next();
                  iter.remove();
                  if (!key.isValid())
                   continue;
                  if (key.isAcceptable())
                   acceptClient(key);
                  if (key.isReadable())
                   readFromClient(key);
             } catch (Exception e) {
              System.out.println(server_name + ": error in selector loop: " + e);
              e.printStackTrace();
        private void acceptClient(SelectionKey key)
         throws IOException
         ServerSocketChannel server_channel = (ServerSocketChannel) key.channel();
         if (server_channel == null)
             return;
         SocketChannel channel = server_channel.accept();
         if (channel == null)
             return;
         configureSocket(channel.socket());
         channel.configureBlocking(false);
         channel.register(selector, SelectionKey.OP_READ);
         clients.put(channel, new Client());
         System.out.println(server_name + ": got a new client; " +
                      clients.size() + " clients");
        private void readFromClient(SelectionKey key)
         throws IOException
         SocketChannel channel = (SocketChannel) key.channel();
         Client client = (Client) clients.get(channel);
         ByteBuffer buf = client.buf;
         int count;
         try {
             count = channel.read(buf);
         } catch (IOException e) {
             System.out.println(server_name + ": error reading, closing connection: " + e);
             clients.remove(channel);
             channel.close();
             return;
         if (count == -1) {
             clients.remove(channel);
             System.out.println(server_name + ": client disconnected; " +
                          clients.size() + " clients");
             channel.close();
             return;
         if (buf.position() == MESSAGE_SIZE) {
             if (++client.number_of_messages % 10000 == 0) {
              long now = System.currentTimeMillis();
              System.out.println(server_name + ": " + client.number_of_messages +
                           " messages in " + (now - client.connect_time) + " ms");
             buf.flip();
             // RFE write without blocking
             writeFully(channel, buf);
             buf.rewind();
        public static void writeFully(SocketChannel channel, ByteBuffer buf)
         throws IOException
         while (buf.remaining() != 0)
             channel.write(buf);
        private static void startClient()
         throws Exception
         SelectPingPong client = new SelectPingPong(6667, "client");
         Socket socket = client.connect("localhost", 6666);
         // Send initial message
         ByteBuffer buf = ByteBuffer.allocate(MESSAGE_SIZE);
         buf.put(new byte[MESSAGE_SIZE]);
         buf.flip();
         socket.getChannel().write(buf);
         client.mainLoop();
        public static void main(String args[])
         throws Exception
         if (args.length == 1 && args[0].equals("server")) {
             SelectPingPong server = new SelectPingPong(6666, "server");
             server.mainLoop();
         } else if (args.length == 1 && args[0].equals("client")) {
             startClient();
         } else if (args.length == 1 && args[0].equals("both")) {
             new Thread() { public void run() {
              try {
                  SelectPingPong server = new SelectPingPong(6666, "server");
                  server.mainLoop();
              } catch (Exception e) {
                  System.err.println("error in server");
             } }.start();
             startClient();
         } else {
             System.err.println("usage: SelectPingPong [client | server | both]");
    }

Maybe you are looking for

  • How to get the values of a multiple radiobutton selection?

    Hi. I have the next region source: FOR c1 IN(SELECT rownum, ttexto_opcion, id_item FROM tb_opciones where id_prueba=:p_id_prueba) LOOP HTP.P(APEX_ITEM.radiogroup(1,c1.ttexto_opcion,1)||c1.ttexto_opcion); END LOOP; That query returns a list of records

  • CS6 Extended 3D functions not working... Need help!

    This is a copy of the system info from CS6: Adobe Photoshop Version: 13.0.1 (13.0.1.2 20130522.r.24 2013/05/22:21:00:00) x64 Operating System: Windows 7 64-bit Version: 6.1 Service Pack 1 System architecture: AMD CPU Family:15, Model:1, Stepping:0 wi

  • Can't pass parameter from HTML form of multipart/form-dta type to JSP

    I am using request.getParameter(passed variable name) to pass data from HTML form to JSP with no problem. WHen I try to pass data from HTML form of multipart/form-dta type to JSP as following: < form enctype="multipart/form-data" name="theForm" metho

  • Partition exchange doumentation problems

    Oracle 10gR2 EE / Aix5L I have a partitioned table on which the primary key is DISABLE VALIDATE and want to exchange a single table with a partition. I did that because documentation "UNIQUE Constraints in a Data Warehouse" says : "However, there are

  • Change backgroundImage on rollOver

    Hello I am quite new to flex, I've desperatly been trying to change the backgroundImage of a canvas through a rollOver event. Can anyone help me out? Thank you