count the number of occurrence in the table with toplink

Hello!

There is no way to create a query with the expressionbuilder or... to count the number of occurences in my table?
I don't want to use the query " select count (*) from table .

Thank you

Not sure about the question. You are looking to get the SQL "select count (*) table" to use the framework of expression TopLink or pull you that SQL already and want something else?

If you are looking just to get the count of a table/class, you can use a ReportQuery:
ReportQuery rquery = new ReportQuery (ClassToQueryOn.class);
rquery.addCount (); equivalent to count (*);

session.executeQuery (rquery);

You can use a report query to return data instead of objects and use the criteria for selection as a normal read request.

Best regards
Chris

Tags: Fusion Middleware

Similar Questions

  • Count the number of records in all tables with a querry URGENT please...

    I downloaded ORACLE 9I DATA DUMP in my computer. There are number of tables. I need to know the tables with records more of say 100 or on the go. Is it possible... If so kindly let me know.

    Second, the database that I downloaded, I discovered that Audit_ trial was not activated by cooking
    ' select name, value of v$ parameter.
    where name like '% verification' and it turned out to be false.
    Can we assume that the database in the server as the audit_trial has been disabled...

    Published by: user1287492 on October 21, 2009 09:07

    Hello

    Place the table name with quotes. Maybe that's the problem.

    Try this code

    select table_name,
     to_number(
     extractvalue(
     xmltype(
     dbms_xmlgen.getxml('select count (*) c from "'||table_name||'"' ))
     ,'/ROWSET/ROW/C')) COUNT
     FROM USER_TABLES
     where iot_type IS NULL
    /
    

    SS

  • 'For' loop with a different number of iterations. Second, the auto-indexation of the tables with different sizes is done. It can affect the performance of the Vi?

    Hello

    I have a loop 'for' which can take different number of iterations according to the number of measures that the user wants to do.

    Inside this loop, I'm auto-indexation four different 1 d arrays. This means that the size of the tables will be different in the different phases of the execution of the program (the size will equal the number of measures).

    My question is: the auto-indexation of the tables with different sizes will affect the performance of the program? I think it slows down my Vi...

    Thank you very much.

    My first thought is that the compiler to the LabVIEW actually removes the Matlab node because the outputs are not used.  Once you son upward, LabVIEW must then call Matlab and wait for it to run.  I know from experience, the call of Matlab to run the script is SLOW.  I also recommend to do the math in native LabVIEW.

  • Can fill us transitional attribute in the table with no serial like 1,2,3, etc.? And how?

    Mr President.

    Can fill us transitional attribute in the table with no serial like 1,2,3, etc.? And how?

    Concerning

    You want to show serial No. on the page for all the lines?

    Check once-

    Blog of Ashish Awasthi (Jdev/ADF): Add the serial number to the table of the ADF, column to auto-increment in the table to the ADF

    Actually transitional attribute loses its value when page refreshes or viewObject is not appropriate in this case if your use case is different, so please tell us

    Ashish

  • Identify the tables with data or not

    Hello

    I want to find the tables with data and containing not data without checking each table. Is there a possible way?

    Like this?

    select
      table_name,
        to_number(
          extractvalue(
            xmltype(
     dbms_xmlgen.getxml('select count(*) c from '||table_name))
            ,'/ROWSET/ROW/C')) count
      from user_tables;
    

    Or may be

    select
      table_name,
       CASE WHEN
           to_number(
              extractvalue(
                xmltype(
         dbms_xmlgen.getxml('select count(*) c from '||table_name))
                ,'/ROWSET/ROW/C'))>0 THEN 'Table Has Data'
        ELSE 'Table is Empty'
        END
      from user_tables;
    
  • Fill the table with random values

    Another thing I've come across is this:
    the table name is LOR, who has 3 fields NUMBER, DATA, TEXT with number, date and varchar2 data type.
    On a page, I have a text field where if I write 3, then it would add 3 lines to the table with predefined values ("number, something like 2222, for 12 January 09, and for text, something like" Lorem ipsum dolor sit amet, 195kgs adipisicing elit"). So basically, with the number that I give, it populates the table with lines... How can I do this? Thanks for helping me
    INSERT INTO LOR
    SELECT 222
    , sysdate
    , 'you string'
    FROM dual
    CONNECT BY level <= :Pxx_
    
  • implementation of the table with the scroll bar. (data scrolling)

    Hello

    I want to show the web service data in the table with scroll bar using java script or html or css .actuall I want only a part of the screen is not whole screen scrollable. can you suggest how it is possible.any suggestion? I used phone gap technology. I used iscroll but it does not work in blackberry data are not displayed in the Simulator... Help, please

    Thank you

    ravi1989 wrote:

    Hello

    I want to show the web service data in the table with scroll bar using java script or html or css .actuall I want only a part of the screen is not whole screen scrollable. can you suggest how it is possible.any suggestion? I used phone gap technology. I used iscroll but it does not work in blackberry data are not displayed in the Simulator... Help, please

    According to devices/operating systems that you want to support, you could give bbUI.js a change. It works really well in most of the cases, and I think there are a lot of things you don't need to worry more because bbUI.js is just for you.

    Look more at the scrollPanel example that does exactly what it takes, a part only of the entire screen of scrolling you can configure a height in the HTML source code directly.

  • I want to change the table with the expression of dangerousness of the virtual columns with her, need advice

    Hi all

    Here is the structure of the table with two expression of virtual columns associated highlighted, now I want to delete these expressions with virtual columns (but must keep my VIRTUAL columns as it is).

    Is it possible the alter or I need to raise the table, make a new structure and copy content back to newly structured table... Pleae help!

    CREATE TABLE TEST_COL)

    SAGE_TRADE_TYPE VARCHAR2 (50 BYTE),

    LOCAL_TZ VARCHAR2 (20 BYTE),

    ACE GMT_CONV_ENTERED_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, ENTERED_DT_TS)) VIRTUAL,.

    ACE GMT_CONV_EXECUTION_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, UPSTREAM_EXECUTION_TS)) VIRTUAL,.

    EOD_IND VARCHAR2 (10 BYTE)

    );

    Thank you very much

    Arpit

    Try this

    ALTER table test_col change gmt_conv_entered_dt_ts (0) virtual;

    ALTER table test_col change gmt_conv_execution_dt_ts (1) virtual;

  • How to export data from the table with the colouring of cells according to value.

    Hi all

    I use jdeveloper 11.1.1.6

    I want to export data from the table with a lot of formatting. as for color cells based on value and so much. How to do this?

    You can find us apache POI-http://poi.apache.org/

    See this http://www.techartifact.com/blogs/2013/08/generate-excel-file-in-oracle-adf-using-apache-poi.html

  • How the values to insert into the table with the command insertion

    Dear all
    can someone tell me how the values to insert into the table with the command insert, I want to say I always use command insert behind my forms on what shutter release button press the button of my save, but today I had a form of 6i, where controls (textbox, combo, etc.) are delineated with directly the table with I guess than the Properties Windows , I created 3 columns in tand 3 text on forms fields, now kindly tell me how to do this fields to fill and do not insert command, I mean directly defined with table column



    Please help me its urgent

    Hello

    If the block is based on your database table, just committed the shape, then changes will be applied to the database.

    François

  • Creating the table with time stamp

    I need to create the table with the data inside buffer

    Can you help me pls

    If it works today,

    create the table test_04NOV2010 in select * from product where product_code = '101'

    If executed tmrw,

    create the table test_05NOV2010 in select * from product where product_code = '101'
    declare
    
    v_date varchar2(25);
    v_sql  varchar2(20);
    
    begin
    
    select to_char(sysdate,'DDMONYYYY') into v_date from dual;
    
     v_sql := ' create table ' ||TEST||'_'||'v_date'|| 
                 ' as '
                 ' select * from Product where product_code = '101'
              
     EXECUTE IMMEDIATE v_sql;
    
    end;
    can is it you pls let me know how to use it in PL SQL

    Can you help me pls

    Thank you very much
    declare
    
    v_date varchar2(25);
    v_sql  varchar2(2000); --Noted this. this was also small.
    
    begin
    
    select to_char(sysdate,'DDMONYYYY') into v_date from dual;
    
     v_sql := ' create table TEST_'||v_date||
                 ' as select * from Product where product_code = ''101''';
    
     EXECUTE IMMEDIATE v_sql;
    
    end;
    

    You can use the Q operator also.

    DECLARE
    
    v_date varchar2(25);
    v_sql  varchar2(2000);
    
    BEGIN
    
    select to_char(sysdate,'DDMONYYYY') into v_date from dual;
    
     v_sql := ' create table TEST_'||v_date||
                Q'[ as select * from Product where product_code = '101']';
    
     EXECUTE IMMEDIATE v_sql;
    
    END;
    

    Published by: mohamed on November 4, 2010 05:32

  • How to update the table with the number management

    Hello

    I need as there is a loc_tab of the created table as below,

    CREATE TABLE loc_tab
    (
    Country_ID NUMBER,
    country_code VARCHAR2 (3),
    country_name VARCHAR2 (50).
    State_ID NUMBER,
    state_code VARCHAR2 (3),
    state_name VARCHAR2 (50).
    city_id NUMBER,
    city_code VARCHAR2 (3),
    city_name VARCHAR2 (50)
    );

    I inserted records like below,
    COUNTRY_ID     COUNTRY_CODE     COUNTRY_NAME     STATE_ID     STATE_CODE     STATE_NAME     CITY_ID     CITY_CODE     CITY_NAME
    
              IND          INDIA                    TN          TAMIL NADU          CHN          CHENNAI
              IND          INDIA                    TN          TAMIL NADU          TRI          TRICHY
              IND          INDIA                    TN          TAMIL NADU          CMT          COIMBATORE
              IND          INDIA                    TN          TAMIL NADU          MDU          MADURAI
              IND          INDIA                    AP          ANDHRA PRADESH          HYD          HYDERABAD
              IND          INDIA                    AP          ANDHRA PRADESH          SEC          SECUNDRABAD
              AUS          AUSTRALIA               QLD          QUEENSLAND          BRI          BRISBANE
              AUS          AUSTRALIA               TAS          TASMANIA          HB          HOBART
              AUS          AUSTRALIA               TAS          TASMANIA          CCE          CITY OF CLEARANCE
              AUS          AUSTRALIA               TAS          TASMANIA          BUR          BURNIE
    Now, I wanted to update the table such that all ID columns are updated with running number.

    Each ID columns should get incremented so that, for Country_ID column corresponding to "India" If country_id is 1, that there must be one for all the lines with the name as "India". Likewise for "Australia".

    In the case of State, she also has the same logic with numbers repeated until the very name of the State comes.

    For the city, it of course will hold separate ID only because the name of the city will not get duplicated.

    This update must be done in the normal way using simple SQL such as no PLSQL don't like looping, etc... is involved.

    Here are the contents of the table, and that's how the table should be updated,
    COUNTRY_ID     COUNTRY_CODE     COUNTRY_NAME     STATE_ID     STATE_CODE     STATE_NAME     CITY_ID     CITY_CODE     CITY_NAME
                                            
    1          IND          INDIA          1          TN          TAMIL NADU     1     CHN          CHENNAI
    1          IND          INDIA          1          TN          TAMIL NADU     2     TRI          TRICHY
    1          IND          INDIA          1          TN          TAMIL NADU     3     CMT          COIMBATORE
    1          IND          INDIA          1          TN          TAMIL NADU     4     MDU          MADURAI
    1          IND          INDIA          2          AP          ANDHRA PRADESH     1     HYD          HYDERABAD
    1          IND          INDIA          2          AP          ANDHRA PRADESH     2     SEC          SECUNDRABAD
    2          AUS          AUSTRALIA     1          QLD          QUEENSLAND     1     BRI          BRISBANE
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     1     HB          HOBART
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     2     CCE          CITY OF CLEARANCE
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     3     BUR          BURNIE
    Thank you and best regards,
    Shiva
  • How to update exists column on the table with the exact number and auto increment

    Hello

    I have a table with more than 10 million rows and there is a column called 'number_zaq', I want to update this column on line frist from 2000 and + 1 for the next all ranks.

    Update your_table

    Set number_zaq = rownum + 2000-1;

  • reliable detect number of occurrences (necessary lock table or?)

    Hi all

    I had a problem with the detection of duplicate messages. Customer database deal with files and messages and create a hash value that is passed to the database. The database must return the number of occurrences of this hash value in (for example) the last 14 days.
    create table HashHistory ( ID NUMBER, 
    MESSAGEHASH VARCHAR2 (20),
    TS TIMESTAMP);
    
    create sequence SomeSequence;
    
    insert into HashHistory values (SomeSequence.nextval,'first hash', systimestamp); 
    insert into HashHistory values (SomeSequence.nextval,'second hash', systimestamp); 
    
    create or replace procedure DuplDetection  (p_HashIn varchar2, 
                                         p_occurences OUT number) AS
    l_timestamp timestamp default systimestamp;                           
    begin
     
      -- possible exclusive table lock here... lock table HashHistory in exclusive mode;
    
      insert into HashHistory values (SomeSequence.nextval, p_HashIn, l_timestamp);
    
      select count (1) 
      into p_occurences
      FROM HashHistory
      where MESSAGEHASH = p_HashIn
      and   TS < l_timestamp
      and   TS > l_timestamp-14;
    
      commit; --to release the table lock if applicable
    end;
    When this procedure is called by two different machines at the same time with the same new hash value ("third hash"). A session should return 0 while the other must return 1 as the number of occurences... With the behavior of the default Oracle using row-level locking and run them in parallel the two sessions will not be able to see the other sessions of hash values, and both return 0 hits. Is an exclusive table lock my only option to respect this behavior or I can trust Oracle to handle this correctly?

    I expect 10 ^ 6 axe every day and possible up to 10 or 20 customers running at the same time generate and check these hash values. What are the changes of these two sessions, return the same value without an exclusive table lock (as in this example)? What are the other settings in your opinion?

    I'm on Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

    Calls to your DUPLDETECTION procedure must be serialized to same values of the parameter P_HASHIN, to fix the problem you describe.

    Kordirko showed you a way how manually do this by using a second table with a primary key constraint.
    He also mentioned the use of DBMS_LOCK to achieve this. That would be my preferred solution. First, create a procedure to acquire a lock in demand (a key dbms_lock):

    create or replace procedure lock_assertion(p_lockname in varchar2) as
    pl_id number(38);
    pl_return number;
    begin
      -- Get a unique hash for this lockname.
      pl_id := dbms_utility.get_hash_value(name      => p_lockname
                                          ,base      => 1
                                          ,hash_size => power(2,30));
      -- Request the application lock in the specified mode.
      pl_return := dbms_lock.request(id                => pl_id
                                    ,lockmode          => dbms_lock.ssx_mode
                                    ,timeout           => 999
                                    ,release_on_commit => true);
      if pl_return not in (0,4)
      then
        raise_application_error(-20000,'Unable to acquire assertion-lock: '||
         p_lockname||' ('||to_char(pl_return)||').');
      end if;
      --
    end;
    /
    

    Then call LOCK_ASSERTION before your insert command by using P_HASHIN as the input parameter value. Who must serialize calls to your procedure of dupldetection for values of p_hashin. When two clients now call the procedure with the same hash, one of these calls will wait you, for another call at the end (this is assuming that you'RE at the end of the dupldetection call, freeing the application blocking).

  • How to count impact / number of occurrence of a string

    Hello

    If I start with this:

    WITH approval_tbl AS
         (SELECT 123456 docno, 'SUBMIT' action_code, '02-MAY-2013 13:09:55' action_date, 0 seq FROM DUAL UNION ALL
          SELECT 123456, 'RESERVE', '02-MAY-2013 13:09:55', 1 FROM DUAL UNION ALL
          SELECT 123456, 'APPROVE', '02-MAY-2013 14:59:47', 2 FROM DUAL UNION ALL
          SELECT 123456, 'APPROVE', '02-MAY-2013 16:25:14', 3 FROM DUAL)
    SELECT * FROM approval_tbl WHERE action_code = 'APPROVE';
    

    I wish I could count the number of the impact of each action_code "APPROVE", where the first "APPROVE" impact / occurrence with a SEQ of '2', would have a number of impact of '1', and the following, with a SEQ 3, would be the 2nd impact / occurrence of the string "APPROVE" and therefore would have a number of the impact of the '2 '.

    I don't know if my sample data are too basic to be able to generate that info?

    Any advice would be much appreciated.

    Thank you!

    Hello

    Do you want results as follows:

    A_NUM DOCNO ACTION_ ACTION_DATE SEQ

    ---------- ---------- ------- -------------------- ----------

    1 123456 APPROVE 2 MAY 2013 14:59:47 2

    2 123456 APPROVED MAY 2, 2013 16:25:14 3

    where the a_num column is generated by the query?

    You can use the ROW_NUMBER analytic function for this:

    SELECT ROW_NUMBER () OVER (ORDER BY seq) AS a_num

    ,         a.*

    Of approval_tbl one

    WHERE action_code = 'APPROVE '.

    ORDER BY seq - if desired

    ;

Maybe you are looking for

  • That means "use work and movement? ''

    When you open the window of information on an album, there is a checkbox for "use work and movement".  What does that mean?  Feel if you tick the box? Thank you!

  • Qosmio G50 - 12 K - LCD is strongest at the highest resolution

    Hello! I bought Toshiba G50 - 12K and I have the first problem. LCD screen resolution is 1920 x 1080, and on it, everything is very nice and very strong. But when I would use any other screen resolution isn't very nice. So, I have the question: 1. it

  • My iPhone 6 s does not?

    I was on my phone, just checked on social media and when I went back to the home screen, I went to click on the 'Google', and it wouldn't work. I thought my phone was freezing. I went to erase my apps, so I doubled tapped the home button, and it woul

  • Satellite A300-17N where is the reset button

    Hello I have laptop toshiba A300 17N but, I can't find the reset button on it? :) if anyone knows... Please help me...:) Thank you..

  • I have Media Center 2002 and upgrade to 2006. How can I do?

    I recently had a new hard drive and now can't use higher than Windows Media Player 9 I can't find plug-ins to play the DVD in there.  I want Media Center 2006 edition to support Windows Media Player 11.  Can I download it somewhere without losing my