Sub-Select Count query breaking TOAD

Oracle 10.2.0.4.0
Running TOAD 9.1
I am running some SQL on our eBusiness Suite:
SELECT pha.segment1
     , pha.type_lookup_code
     , (SELECT COUNT(DISTINCT pha2.po_header_id)
          FROM po.po_headers_all pha2
             , po.po_lines_all pla
         WHERE pha2.po_header_id = pla.po_header_id
           AND pla.contract_id = pha.po_header_id) po_count
     , (SELECT MAX(pha2.creation_date)
          FROM po.po_headers_all pha2
             , po.po_lines_all pla
         WHERE pha2.po_header_id = pla.po_header_id
           AND pla.contract_id = pha.po_header_id) latest_cpa_po
  FROM po.po_headers_all pha
     , po.po_vendors pv
     , po.po_vendor_sites_all pvsa
WHERE pha.vendor_id = pv.vendor_id
   AND pha.vendor_site_id = pvsa.vendor_site_id
--   AND pv.VENDOR_NAME LIKE 'H%'
   AND pha.vendor_id = 98
   AND pha.type_lookup_code = 'CONTRACT'
   AND pha.org_id IN(7041, 7042);The above query runs quicky (approx. 1 second). If I take out the AND pha.vendor_id = 98 then the query takes a few minutes to run.
When I try to export it, or scroll down to view > 500 rows, TOAD crashes.
I know this isn't a TOAD forum, but I think that this is probably an issue with my no doubt rubbish SQL.
If I take out this sub-select, then the problem doesn't happen:
     , (SELECT COUNT(DISTINCT pha2.po_header_id)
          FROM po.po_headers_all pha2
             , po.po_lines_all pla
         WHERE pha2.po_header_id = pla.po_header_id
           AND pla.contract_id = pha.po_header_id) po_countHowever, I can't work out a better way of getting the data I need.
The sub-select counts POs which have been raised where the contractID on the PO line is the same as the PO Header ID from the main query.
Any advice please, on what I could do to sort this out would be much appreciated.
Thanks!

Hi,
It looks like you can replace both scalar sub-queries with a join, like this:
WITH     header_lines_summary     AS
     SELECT    pla.contract_id
          ,       COUNT (DISTINCT pha2.po_header_id)     AS po_count
          ,       MAX (pha2.creation_date)          AS latest_cpa_po
          FROM        po.po_headers_all pha2
             ,        po.po_lines_all   pla
         WHERE        pha2.po_header_id = pla.po_header_id
      GROUP BY       pla.contract_id
)                                        -- Everything up to this line is new
SELECT pha.segment1
     , pha.type_lookup_code
     , hls.po_count                              -- Changed
     , hls.latest_cpa_po                         -- Changed
  FROM po.po_headers_all     pha
     , po.po_vendors           pv
     , po.po_vendor_sites_all      pvsa
     , header_lines_summary     hls                    -- New
WHERE pha.vendor_id          = pv.vendor_id
   AND pha.vendor_site_id     = pvsa.vendor_site_id
   AND pha.po_header_id          = hls.contract_id (+)          -- New
--   AND pv.VENDOR_NAME      LIKE 'H%'
   AND pha.vendor_id           = 98
   AND pha.type_lookup_code      = 'CONTRACT'
   AND pha.org_id           IN (7041, 7042);Aside from the sub-query (which is entirely new), the query above is just what you posted, with 2 lines changed and 2 lines added, as marked.
This should be more efficient, but I don't know for certain that it will solve the Toad problem.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
It never hurts to say what version of Oracle you're using.

Similar Messages

  • Sub-Select SQL query in Oracle BI Answers

    Hi
    What's the proper usage of Sub-Select SQL query in Oracle BI Answers Version Oracle Business Intelligence 10.1.3.2.1?
    I get [SQL_STATE: HY000] [nQSError: 10058] A general error has occured when trying to Sub Select query like:
    itemno = (SELECT MIN(orders.itemno) FROM mydatabase where rownum < 2 order by orders.itemno)

    Maybe the best is to create a new physical and logical object for your sub-select and join this with your current objects.

  • Query with many sub-selects on the same table

    Hi,
    Please consider the example below (Oracle 11g):
    create TABLE test1 (order_id number, CODE VARCHAR2(10), VALUE NUMBER);
    insert into test1 VALUES (1, 'A', 100);
    insert into test1 VALUES (1, 'B', 200);
    insert into test1 VALUES (1, 'C', 300);
    insert into test1 VALUES (1, 'D', 400);
    insert into test1 VALUES (2, 'A', 10);
    insert into test1 VALUES (2, 'B', 20);
    SELECT order_id,
           CODE,
           VALUE,
           (SELECT VALUE FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code = 'B') b_Value,
           (SELECT SUM(VALUE)/COUNT(*) FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code IN ('C', 'D')) cd_Value,
           (SELECT COUNT(*) FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code IN ('C', 'D')) cd_qty
    FROM   TEST1 t
    WHERE  CODE = 'A';In my real-life case, I don't have 3 but tens of sub-query columns like those. The performance is OK but I was wondering whether there were a better way in terms of performance and maintainability to write this query.
    I thought of the WITH clause but couldn't see how it could help much.
    Please note that some sub-queries can be more complex than just looking up a column, like in column cd_value/cd_qty.
    Any suggestions?
    Thanks
    Luis

    Simpler, but will go for two table scans. You will have to use outer joins according to your requirement.
    select t1.order_id,
           t1.CODE,
           t1.VALUE,
           max(decode(t2.code,'B',t2.value)) b_value,
           sum(decode(t2.code,'C',t2.value,'D',t2.value,0))/nullif(sum(decode(t2.code,'C',1,'D',1,0)),0)  cd_value,
           sum(decode(t2.code,'C',1,'D',1,0))  cd_qty 
    from TEST1 t1,test1 t2
    where t1.CODE = 'A'
    and t1.ORDER_ID = t2.order_id
    group by t1.order_id,
           t1.CODE,
           t1.VALUEEdited by: jeneesh on Feb 7, 2012 11:54 AM

  • Custom Hierarchy sub selection from BEx Query to Webi

    Hi All,
    The client has requested that from a hierarchy only certain accounts / account nodes be brought into the Webi report.
    I have made a Account Number Filter in the BEx query containing the nodes that the client has requested. In order to get a hierarchical view, I activated the hierarchy display through BEx and selected the hierarchy the the selection of the nodes came from.
    I ran the report through Analyzer and all works - the only nodes that show are the nodes that were filtered on through query designer and all lower nodes below it. It displays as a hierarchy properly.
    When running in Webi, I bring in the hierarchy object for Account number and the report crashes giving me the general Webi error. (I have added a screenshot).
    In conclusion, what I am trying to do is take a sub selection of certain account nodes from a hierarchy and display those nodes with all lower levels below in a hierarchy. It works in BEx, not in Webi.
    If this won't work in Webi, any idea how to build this in BEx so it will work in Webi?

    I haven't tried this myself yet - but did you register your Google API key?  Please see Google Maps in SDK Extension

  • Sub select query Help

    I have to do a task of finding records which matches the following logic.
    My table has PID varchar(15), Amount varchar (50),Status varchar(20) columns.
    Each PID can go thru changes in a period of time, in my case i dont have a data range I just have a flatfile which consists of three types of PID`s
    123456 = Original_PID, Reversal =123456R1,Adjustment= 123456A1.
    Basically What I am trying to find out if there are any original PID`s which has a Reversal or an Adjustment.
    here`s the code I have started on... Can someone help me get it finished?
    select R1. pid,a1.pid,org.pid from (
    select SUBSTRING(Pid,1,11)as Original_PID, status, paid_amount as Amount from dbo.Q2STATUS)org
    inner join (select SUBSTRING(Pid,1,13)as Original_Icn,status,paid_amount from dbo.Q2STATUS
    where SUBSTRING(Pid,12,2) ='R1')r1 on r1.pid=org.pid
    inner join (select SUBSTRING(claim_id,1,13)as Original_Icn,status,paid_amount from dbo.Q2STATUS
    where SUBSTRING(Pid,12,2) ='A1')A1 on a1.Pid=org.PID
    FM

    Hi,
    Please check following item
    It uses a
    SQL string function, please create it first
    create table Q2STATUS (Pid nvarchar(200), Status varchar(20), paid_amount int)
    insert into Q2STATUS select '123456 = Original_PID, Reversal =123456R1, Adjustment= 123456A1',NULL,250
    with cte2 as (
    select rn = row_number() over (order by pid), * from Q2STATUS
    ), cte as (
    select cte2.*, s.id typeid, v.*
    from cte2
    cross apply dbo.split(cte2.Pid, ',') s
    cross apply dbo.split(s.val, '=') v
    ), cte3 as (
    select
    rn, pid, status, paid_amount, max(pidtype) pidtype, max(pidval) pidval
    from (
    select
    rn, Pid, status, paid_amount, typeid,
    case when (typeid = 1 and id = 2) or (typeid <> 1 and id = 1) then ltrim(rtrim(val)) else null end as pidtype,
    case when (typeid = 1 and id = 1) or (typeid <> 1 and id = 2) then ltrim(rtrim(val)) else null end as pidval
    from cte
    ) g
    group by rn, pid, status, paid_amount, typeid
    select
    cte2.rn, cte2.pid,
    cte3.pidval as 'Original_PID',
    cte4.pidval as 'Reversal',
    cte5.pidval as 'Adjustment'
    from cte2
    left join cte3 on cte3.rn = cte2.rn and pidtype = 'Original_PID'
    left join cte3 as cte4 on cte4.rn = cte2.rn and cte4.pidtype = 'Reversal'
    left join cte3 as cte5 on cte5.rn = cte2.rn and cte5.pidtype = 'Adjustment'
    Here is the result,
    Please note that I have used
    SQL CTE expressions a lot in the SQL query to prevent usage of sub-select and temp tables.
    There is also a
    SQL ROW_NUMBER() function used in the first SELECT statement to distinquish all items from each other instead of using the PID column value. Perhaps you have already an ID key column, you can use it too
    SQL Server, SQL Server 2012 Denali and T-SQL Tutorials

  • Very slow Sub Select Query

    Oracle Version 9.2.0.7.0
    Sorry to ask what is probably a stupid question that only serves to highlight how useless my SQL is!
    I have this SQL which counts total requisition lines, and then counts how many of those lines have converted to Sales Orders:
    SELECT prha.segment1
         , (SELECT COUNT(*)
              FROM po.po_requisition_lines_all prla
             WHERE prla.requisition_header_id = prha.requisition_header_id)
                                                                      req_line_ct
         , (SELECT COUNT(*)
              FROM po.po_requisition_lines_all prla
                 , ont.oe_order_lines_all sol
             WHERE prla.requisition_line_id = sol.source_document_line_id
               AND prla.requisition_header_id = prha.requisition_header_id)
                                                                       so_line_ct
      FROM po.po_requisition_headers_all prha
    WHERE  prha.creation_date >= '03-JUL-2008';The SQL works, but it is really, really slow. Is that just because it is running through lots and lots of data?
    If I comment out the 2nd Count SELECT, it runs immediately. Perhaps it is so slow because the join between the po_requisition_lines_all and the oe_order_lines_all table is not via primary keys. Also, there is not an index on the oe_order_lines_all table related to the source_document_line_id field.
    I'm sorry I haven't provided the full table designs for the tables involved - but the primary keys joining the requisition tables = via the requisition_headers_all table, and the join via the po_requisition_lines_all and the oe_order_lines_all table is not via a primary key or an index.
    Sorry once again, for probably talking nonsense.

    Please note this is a untested code as you didn't provide any of the required information like
    a) Test Data
    b) Relationship between the tables
    You could try something like this. But as already @someoneelse suggested it is definitely worth reading the link.
    select prha.segment1, count(case when prla.requisition_header_id is not null then 1 end) req_line_ct,
    count(case when sol.source_document_line_id is not null then 1 end) so_line_ct
    from
    po.po_requisition_header_all prha,
    po.po_requisition_lines_all prla,
    ont.oe_order_lines_all sol
    where
    prha.creation_date >= to_date('03.07.2008','dd.mm.yyyy')
    and
    prha.requisition_header_id = prla.requisition_header_id (+)
    and
    prla.requsition_line_id = sol.source_document_line_id (+)
    group by prha.segment1;Regards
    Raj

  • Problem to get count from resultset with select count(1) like query

    Hi,
    The snippet of code is like this ...!
    preparedStatement = connection.prepareStatement("select count(1) as count from acf_users where acf_user_name like ? and acf_user_password like ?");
    preparedStatement.setString(1,stringUsername);
                   preparedStatement.setString(2,stringPassword);
                   resultSet = preparedStatement.executeQuery() ;
                   System.out.println("The ResultSet Count checkUser() : "+resultSet.getString("count"));
                   preparedStatement.close();
    But there is a SQLException like :
    java.sql.SQLException: ResultSet.next was not called
    I want to extract and check the count in the program..
    Does anyone has the solution, comments on this.
    Thanks in Advance,
    -Sachin

    Thanks a lot to have a look on it :
    I got the solution on it as :
    preparedStatement = connection.prepareStatement("select count(*) as total from acf_users where acf_user_name like ? and acf_user_password like ?");
                   preparedStatement.setString(1,stringUsername);
                   preparedStatement.setString(2,stringPassword);
                   resultSet = preparedStatement.executeQuery() ;
    resultSet.next();
                   System.out.println("The ResultSet checkUser() : "+resultSet.getInt("total"));
    The important line is :
    resultSet.next()
    Thanks once again,
    Sachin !

  • Stuck on CONNECT_BY ... PRIOR statement / sub-select Query

    I am trying to generate a list of customisations made to our eBusiness system.
    I'm using this example as a starting point:
    SELECT *
       FROM applsys.jdr_paths jp1
      WHERE UPPER(jp1.path_name) = 'CUSTOMIZATIONS'
        AND jp1.path_docid BETWEEN 18000 AND 18700;
    _NAME                                                    PATH_DOCID PATH_OWNER_DOCID PATH_TYPE                        PATH_SEQ PATH_XML_V PATH_XML_E CREATED_BY                     CREATION_ LAST_UPDATED_BY                LAST_UPDA LAST_UPDATE_LOGIN
    customizations                                                18479             1650 PACKAGE                                -1                       1                              24-SEP-05 1                              24-SEP-05 1
    customizations                                                18665            18663 PACKAGE                                -1                       1                              24-SEP-05 1                              24-SEP-05 1
    customizations                                                18010            18009 PACKAGE                                -1                       1                              24-SEP-05 1                              24-SEP-05 1I can then use this to extract the full path - for example, using the example above, the "PATH_OWNER_DOCID" = 18663:
    SELECT     LEVEL
             , SYS_CONNECT_BY_PATH(p.path_name, '/') PATH
             , p.path_docid
          FROM (SELECT jp.path_name
                     , jp.path_seq
                     , jp.path_docid
                     , jp.path_owner_docid
                  FROM applsys.jdr_paths jp) p
    CONNECT BY path_docid = PRIOR path_owner_docid
    START WITH p.path_docid = 18665;
    LEVEL     PATH                                                                  PATH_DOCID
    1     /customizations                                                          18665     
    2     /customizations/webui                                                  18663     
    3     /customizations/webui/pagesetup                                          18661     
    4     /customizations/webui/pagesetup/printmgmt                          18660     
    5     /customizations/webui/pagesetup/printmgmt/bpa                          10174     
    6     /customizations/webui/pagesetup/printmgmt/bpa/ar                  10173     
    7     /customizations/webui/pagesetup/printmgmt/bpa/ar/apps                  2     
    8     /customizations/webui/pagesetup/printmgmt/bpa/ar/apps/oracle          1What I'd really like to do is to include the bottom most path (i.e. the most detailed, full path (path_docid = 1 in the e.g. above) in the first SQL statement.
    That way, against each customisation, listed via this:
    SELECT *
       FROM applsys.jdr_paths jp1
      WHERE UPPER(jp1.path_name) = 'CUSTOMIZATIONS'
        AND jp1.path_docid BETWEEN 18000 AND 18700;I would like to include, possibly via a sub-select, the full path of the customisation - not all of the other lines leading up to the full path, just the full path itself.
    But I can't work out how to combine the 2 SQLs, assuming it can be done at all.
    Any advice much appreciated.
    Thanks!

    If understand your question right... Just a MAX would work.
    select (SYS_CONNECT_BY_PATH(object_name, '/'))
    from
    select object_name, rownum lv
           from all_objects
       where rownum <= 5
       ) t
        START WITH lv = 1
       CONNECT BY PRIOR lv = lv - 1
    (SYS_CONNECT_BY_PATH(OBJECT_NAME,'/'))                                         
    /WRH$_SERVICE_WAIT_CLASS_PK                                                    
    /WRH$_SERVICE_WAIT_CLASS_PK/WRH$_SERVICE_WAIT_CLASS                            
    /WRH$_SERVICE_WAIT_CLASS_PK/WRH$_SERVICE_WAIT_CLASS/WRH$_SYS_TIME_MODEL_PK     
    /WRH$_SERVICE_WAIT_CLASS_PK/WRH$_SERVICE_WAIT_CLASS/WRH$_SYS_TIME_MODEL_PK/WRH$_SYS_TIME_MODEL
    /WRH$_SERVICE_WAIT_CLASS_PK/WRH$_SERVICE_WAIT_CLASS/WRH$_SYS_TIME_MODEL_PK/WRH$_SYS_TIME_MODEL/WRH$_OSSTAT_PK
    5 rows selected.
    select max(SYS_CONNECT_BY_PATH(object_name, '/'))
    from
    select object_name, rownum lv
           from all_objects
       where rownum <= 5
       ) t
        START WITH lv = 1
       CONNECT BY PRIOR lv = lv - 1
    MAX(SYS_CONNECT_BY_PATH(OBJECT_NAME,'/'))                                      
    /WRH$_SERVICE_WAIT_CLASS_PK/WRH$_SERVICE_WAIT_CLASS/WRH$_SYS_TIME_MODEL_PK/WRH$_SYS_TIME_MODEL/WRH$_OSSTAT_PK
    1 row selected.vr
    Sudhakar B.

  • Difference in count(*) query and select * query results

    i am using Oracle9i Enterprise Edition Release 9.2.0.8.0.
    in a table select count(*) returns 34, but when i run select * statement it returns only 6 rows. Results are pasted below. Can any one knows the reason of this mismatch
    SQL> select * from pay_at;
    EMP_CODE STA IN_OUT_DA TIME
    100341 IN 07-MAR-04 09:32
    100341 OUT 07-MAR-04 10:24
    103165 IN 31-MAR-03 14:41
    103165 OUT 31-MAR-03 20:00
    101204 IN 19-APR-04 13:00
    101204 OUT 19-APR-04 23:59
    6 rows selected.
    SQL> select count(*) from pay_at;
    COUNT(*)
    34
    ------------------------------------------------------

    Maybe you pressed CTRL-c during the fetch phase of "select * from" ?
    If this is not the case, try to build a very small test case we can run that shows this behaviour and post it here.
    Regards,
    Rob.

  • Select count(*) for each row of a table

    Hello All,
    Following query gives a statistics for each user (how many items he owns, home many tickets authored, how many objects he is subscribed to etc...)
    select auser.userid,
    (select count(*) from item where owner like '%' || auser.id || '%') ITEM_OWNER_CNT,
    (select count(*) from tkt where originator = auser.id) TKT_ORIGINATE_CNT,
    (select count(*) from tkt where assigned_to = auser.id) TKT_QA_CNT,
    (select count(*) from tkt where create_user = auser.id) TKT_AUTHOR_CNT,
    (select count(*) from subscriptions where subscriber_id = auser.id) SUBSCRIPTION_CNT
    from
    user auser
    I was not happy with the performance of this query, so I tried the same using group by. The performance was even worse.
    Is there any other option for me to try? Please advice.
    Thanks,
    Sathish

    Hi, Sathish,
    As SBH said, a lot depends on your data. Please post some sample data (CREATE TABLE adn INSERT statemetns) for all tables, and the results you want from that data. Describe and give examples of any relationships that are not one-to-one..
    You probably want to do joings, like SBH suggested, rather than scalar sub-queries.
    The connection between the auser and item tables
    (select count(*) from item where owner like '%' || auser.id || '%') ITEM_OWNER_CNT,is very suspicious. Perhaps the item table is poorly designed, and the query would be faster if that table were changed. Is changing the design of the item table an option?
    You should be able to get all the information from the tkt table in one pass. It looks like you need to unpivot the data, so instead of one row per ticket (with 3 different people connected to it), there are 3 rows per ticket, each with only 1 person referenced. This is not necessarily a bad table design. Unpivoting, even more than most other things, depends on your database version, so you'll have to tell what version of Oracle you're using.

  • A very slow select with sub selects sql statement on Oracle

    Hi,
    I'm moving an application from MySql to Oracle. The following select were very efficiently executed in MySql. In oracle its slow like a snail.
    Do anyone have a hint on how to speed it up?
    The slow part is the four sub selects in the select part. Removing them makes the select about 50 times faster on Oracle.
    Best Regards,
    Stephane
    select
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and (rr.relation_type_id = 'link' OR rr.relation_type_id = 'product')) as relationList,
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and rr.relation_type_id = 'number') as relationNumber,
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and rr.relation_type_id = 'title') as relationTitle,
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and rr.relation_type_id = 'content') as relationText,
    d.*
    from document d,(
    select distinct r.document_id id
    from relation r
    where
    r.product_id = ?
    ) dd
    where d.id=dd.id

    You are accessing the relation-table too many times, so a rewrite to a query like this
    SQL> select dept.deptno
      2       , dept.dname
      3       , count(decode(job,'CLERK',1)) clerk
      4       , count(decode(job,'MANAGER',1)) manager
      5       , count(decode(job,'SALESMAN',1)) salesman
      6    from dept, emp
      7   where dept.deptno = emp.deptno (+)
      8   group by dept.deptno
      9       , dept.dname
    10  /
        DEPTNO DNAME               CLERK    MANAGER   SALESMAN
            10 ACCOUNTING              1          1          0
            20 RESEARCH                2          1          0
            30 SALES                   1          1          4
            40 OPERATIONS              0          0          0
    4 rijen zijn geselecteerd.will be worth the effort.
    If still not satisfied, you have to do some investigation, as described [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]here
    Regards,
    Rob.

  • Select count(*) not working in Apex

    Hello,
    The following sql works in both SQL*Plus and Toad but not in apex.  The variable seems always to be 0 no matter what data I have on the table.
    Basically I try to flip the status from "Inactive" to "Active" only when there is no "Inactive" status left on the table.  Say there are 2 inactive statuses.
    If I delete one inactive status, the overall status should still be "Inactive".  However, with this code, it flips to "Active" status regardless. 
    I tried manually assign the variable to 1 and the status was not flipped.  Therefore, it sounds to me that the count(*) is not working in APEX.
    Does anyone experience this before? 
    Thanks in advance,
    Ning
    ===================================
    DECLARE
    v_status_count NUMBER;
    BEGIN
    UPDATE LGR_APP_STATUSES
    SET DELETED = 'Y'
    WHERE LGR_APP_STATUS_ID = :P42_LGR_APP_STATUS_ID;
    commit;
    select count(LGR_STATUS_ID) into v_status_count from LGR_APP_STATUSES
    where DELETED = 'N'
    and LGR_APPLICATION_ID = :p42_application_id
    and LGR_STATUS_ID in (3,8);
    IF (v_status_count = 0) THEN
    update lgr_applications
      set lgr_application_status = 'ACTIVE'
      where LGR_APPLICATION_ID = :P42_LGR_APPLICATION_ID;
    commit;
    END IF;
    END;

    Hi,
    In query you have used p42_application_id.
    Other statements use P42_LGR_APP_STATUS_ID
    Do you have that item? What is session state for that?
    Regards,
    Jari

  • Attribute created by 'SELECTED IN QUERY' dont refresh in jsp

    Hello,
    I have an application with:jdev 10.1.2 and jhs 10.1.2
    for the management of the following tables:
    CREATE TABLE PROJECTS(
    ID NUMBER(6),
    DESCRIPTION VARCHAR2(100)
    CREATE TABLE EMPLOYEES(
    ID NUMBER(6),
    PROJECT_ID NUMBER(6)
    In jhsStruture file I create 1 group for ProjectView (layout:table-form)
    and 1 sub-group for EmployeeView (layout:table)
    IN the query for PROJECTVIEW I ADD AN ATTRIBUTE: Employees =>
    (SELECT COUNT(ID) FROM EMPLOYEES WHERE PROJECT_ID = ID)
    Then when I add an employee in the application (Employee Tab) and I go to projects tab, the attribute
    EMPLOYEES dont increase...
    NOW, i want that this attribute refresh..
    HOW TO CONFIGURE THIS FEATURE PLEASE?...
    THIS IS POSSIBLE?
    thanks,
    Rigoberto

    Rigoberto,
    This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. Try if you can reproduce the problem in the ADF BC Tester (right-click your Application Module and choose Test).
    If so, can you please log a TAR at MetaLink ( http://metalink.oracle.com/ ), or ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ? Thanks.
    kind regards,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting

  • Is select count(*) correct way to find speed

    Environment I am using:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Toad 11.6
    In oracle in general, if i want to know how fast I can get data from a table (or a pipelined function), is select count(*) accurate way to do it ?
    Eg:
    select count(*) from table(schema_name.pkg_name.proc_name(paremter1 in 123 ))
    select count(*) from table(schema_name.pkg_name.proc_name(paremter1 in 123 ))
    or
    select count(*) from tableA
    so can i give above queries and note down the time, is this accurate way to know the fastness?

    In oracle in general, if i want to know how fast I can get data from a table (or a pipelined function), is select count(*) accurate way to do it ?
    There is no such thing as 'in general'.
    It all depends on 'what' data you want to get if you are querying a table and exactly how the function actually works if you are calling a function.
    A query that 'gets' one column very fast might take days to 'get' ALL columns.
    A function that does different queries based on the parameters might return data quickly for one parameter value and be very slow for a different parameter value.
    Start over and tell us what BUSINESS PROBLEM you are trying to solve.

  • Attn: PDO Experts (COUNT query)

    This is an example of the type of a PHP/MySQL query I use to display dynamic web pages. This particular query is associated with a website/section that displays URL's like MySite/People/Crazy_Horse, where Crazy_Horse = both $MyURL and a value in the field URL, table people...
    $res = mysql_query("SELECT COUNT(URL)
      FROM people
      WHERE URL = '$MyURL' AND Site = 'PX'
      OR '$MyURL' = CONCAT('Washington/', URL) AND Site = 'SM'");
      if (!$res) {
        die('Invalid query: ' . mysql_error());
    $result = mysql_result($res, 0);
    // PART 2 - Interpret the results...
    switch ($result)
    case 1:
    // include related files
    break;
    case 0:
    // include 404 NOT FOUND error message
    break;
    default:
    // multiple entries; deal with as needed
    break;
    Now I'm trying to learn PDO, and I assumed the simplest queries would be the simplest to convert to PDO. To my surprise, many online references say PDO can't perform COUNT queries! As I understand it, all the PDO queries that do this sort of thing are workarounds. After consulting several tutorials and forums and trying several scripts, I still don't have a working model. This is what I'm trying at the moment:
    I start out with my PDO database connection (replacing "USERNAME" and "PASSWORD" with my username and password, of course...
    try {
        $db = new PDO('mysql:host=localhost;dbname=db_new;charset=utf8', 'USERNAME', 'PASSWORD');
    } catch (PDOException $e) {
        print "Error!: " . $e->getMessage() . "<br/>";
        die();
    The above code is on a separate file that's included in every page on my website.
    I then have this code on a downstream file...
    $sql= "SELECT URL FROM people
    WHERE URL = '$MyURL'";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $total = $stmt->rowCount();
    But it doesn't work, and there's no error message to indicate what the problem is. (However, if I modify my username or password in the connection script, I do get an error message referring to my database connection.) Once I do get it to work, I assume I can finish the job by simply replacing $result with $total...
    switch ($total)
    case 1:
    // include related files
    break;
    case 0:
    // include 404 NOT FOUND error message
    break;
    default:
    // multiple entries; deal with as needed
    break;
    Can anyone tell me what I'm doing wrong, and how I can fix it?
    Thanks.

    How does this post relate to Web Design?   Any ideas?

Maybe you are looking for

  • My provider can not help me in unlock code, I need...

    Hopefully somebody will be able to help me. I have a Nokia N70 from 3-network in UK. Then I have moved to T-mobile. So I have asked 3 to unlock my mobile, they have charched me £15 for that and gave me a code. I have entered that code first time and

  • CD not playing from both speakers

    iTunes - when I burn a CD I can play it on my computer, however, when I play it in a boombox cd player, I only hear one speaker. Other CD's are fine. It is not the boombox. I think I may be saving file or converting improperly. Any thoughts?

  • Draw polygon using iText

    hi... i am working on projects that create some pdf files.. and am using iText to create the pdf files.. i am trying to draw a polygon(size-5) ..but i cant find anything in itext that help me to create that polygon,,,, so tell me some way or any tuto

  • The photoshop library operation failed because quicktime is not installed on this computer

    I'm getting this when importing a Photoshop Timeline Animation into After Effects. "The photoshop library operation failed because quicktime is not installed on this computer" I have all updates to date. Any clues?

  • Getting rid of changes in FireFox that tor button made.

    I am using Firefox 14.0.1 and wanted to install Tor to privatize my surfing. Tor would not load properly so I tried to load TorButton separately and that didn't work. but after I tried to run Firefox it appeared that Tor had disabled my Flash player