Why this difference in query count

Hello friends,

running the following query say
(1) SELECT table_name, num_rows, OWNER OF ALL_TABLES where table_name! = 'KEY_IDS' AND TABLE_NAME NOT LIKE '% BKP %' AND TABLE_NAME NOT LIKE ' % $% ' AND OWNER = 'KUMAR '.

output:
TABLE_NAME, NUM_ROWS OWNER
ADDL_INFO_VALUE_LANG 4457845 KUMAR


But when I run the query as

(2) select count (*) KUMAR. ADDL_INFO_VALUE_LANG;
-4524897

Why is there a number of difference in the above queries (1) and (2).


Clarify pls...

Thanks /.

And it's very clearly written in the Doc

>
Note:
The columns marked with an asterisk (*) are only filled if you collect statistics on the table with the ANALYZE statement or the DBMS_STATS package.
>

See the 'proof '.

create table test_stats as select rownum as c1 from dual connect by level <= 100;

select count(*) from scott.test_stats;

COUNT(*)
--------
     100 

--"See below, NOM_ROWS is NULL coz the stats are not yet gathered for the table

select table_name, num_rows , owner,
       last_analyzed
from all_tables
where table_name = 'TEST_STATS'
AND OWNER ='SCOTT' ;

TABLE_NAME                     NUM_ROWS OWNER                          LAST_ANALYZED
------------------------------ -------- ------------------------------ -------------
TEST_STATS                              SCOTT                                        

--"Gather the stats

exec dbms_stats.gather_table_stats('SCOTT','TEST_STATS');

anonymous block completed

--"See below, NOM_ROWS is updates properly

select table_name, num_rows , owner,
       last_analyzed
from all_tables
where table_name = 'TEST_STATS'
AND OWNER ='SCOTT' ;

TABLE_NAME                     NUM_ROWS OWNER                          LAST_ANALYZED
------------------------------ -------- ------------------------------ -------------
TEST_STATS                          100 SCOTT                          30-DEC-12     

--"truncate the table

truncate table test_stats;

table TEST_STATS truncated.

--"NUM_ROWS are wrong..

select table_name, num_rows , owner,
       last_analyzed
from all_tables
where table_name = 'TEST_STATS'
AND OWNER ='SCOTT' ;

TABLE_NAME                     NUM_ROWS OWNER                          LAST_ANALYZED
------------------------------ -------- ------------------------------ -------------
TEST_STATS                          100 SCOTT                          30-DEC-12     

--"After stats gather, it is fine..

exec dbms_stats.gather_table_stats('SCOTT','TEST_STATS');

anonymous block completed

select table_name, num_rows , owner,
       last_analyzed
from all_tables
where table_name = 'TEST_STATS'
AND OWNER ='SCOTT' ;

TABLE_NAME                     NUM_ROWS OWNER                          LAST_ANALYZED
------------------------------ -------- ------------------------------ -------------
TEST_STATS                            0 SCOTT                          30-DEC-12    

Published by: JAC December 30, 2012 11:31
NUM_ROWS is above all an approximate count

And you can set the value of NUM_ROWS using package DBMS_STATS (set_table_stats)

Tags: Database

Similar Questions

  • Hi there, I have a question about storage, even if I have 2, 53GB, storage watch 21, 99GB usage, why this difference? I use an iMac 2009, thank you!

    Hi there, I have a question about storage, even if I have 2, 53GB, storage watch 21, 99GB usage, why this difference? I use an iMac 2009, thank you!

    Spotlight re-indexing.

  • Why this difference in speed?

    I have the Sandisk Ultra 480 g, why am I burst speeds of 350 MB and 300 MB on average during its 550 MB advertised? I used HDTACH and crystalmark to the bench it. I use a port SATA3, what gives? Thank you

    What is the MB you have? I can't find the exact part that you number provided

    http://www.gigabyte.com/products/product-page.aspx?pid=4139#SP

    If this map looks like so he has 2 different SATA 6 GB chipsets. One is Marvell and the other is not listed in the specifications. You can try the connected both SSD and see who gets the best speed. The Council has also SATA 3 Gb ports so make sure that you are not connected to one of those.

    With regard to the pilots to check the MB manufacturers website and see if there are drivers updated, you can try. If the MB has a chipset intel use intel RST AHCI driver. It has the best performance. If the Committee does not have a chipset intel, you will need to use that provides the MB website or the Microsoft driver.

  • Why this difference in time functions?



  • Stupid old backpacker (me) cannot understand why this query returns 1 row

    Hi all

    In reference to {: identifier of the thread = 2456973}, why do
    select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
    , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
    from emp group by job;
    only 1 rank and not 1 for each task? In fact, I had to test it myself to believe.

    It returns the data as if the query were
    select sum(CLERKS), sum(SALESMANS)
    from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
             from emp group by job)
    Using only a single aggregate (count or sum) returns 1 row per job, as expected

    John Stegeman wrote:
    It returns the data as if the query were

    select sum(CLERKS), sum(SALESMANS)
    from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
    from emp group by job)
    

    Exactly the point ;-)

    It seems that Oracle actually do, a group of 'double' in the same operation.
    Attend plans to explain in this example:

    SQL> select count(decode(job, 'CLERK', 1, null)) CLERKS
      2       , count(decode(job, 'SALESMAN', 1, null)) SALESMANS
      3  from scott.emp group by job;
    
        CLERKS  SALESMANS
    ---------- ----------
             0          0
             0          0
             0          0
             0          4
             4          0
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1697595674
    
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   1 |  HASH GROUP BY     |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    

    And compare it to the one with the double aggregates:

    SQL> select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
      2       , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
      3  from scott.emp group by job;
    
        CLERKS  SALESMANS
    ---------- ----------
             4          4
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 417468012
    
    ----------------------------------------------------------------------------
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   2 |   HASH GROUP BY     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    

    There are GROUP BY hash and SORT GLOBAL times.

    It is really unnecessary to an aggregate on an aggregate - if two aggregates are used "in the same group level.
    Sum() aggregates are used on an already aggregated value, so it doesn't look like Oracle which actually cures like 'first do the internal aggregate using the group specified by and then do the external aggregation on the result with any group.'

    Look at this example where I combine aggregates "double" with "single" aggregates:

    SQL> select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
      2       , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
      3       , count(decode(job, 'SALESMAN', 1, null)) SALESMANS2
      4       , count(*) COUNTS
      5  from scott.emp group by job;
    
        CLERKS  SALESMANS SALESMANS2     COUNTS
    ---------- ---------- ---------- ----------
             4          4          1          5
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 417468012
    
    ----------------------------------------------------------------------------
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   2 |   HASH GROUP BY     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    

    When you mix "doubles" and "single" aggregates, Oracle decides that unique aggregates belong to the 'outer' aggregation
    SALESMAN2 did a count on the aggregated work column which is the result of the 'internal' group by - so only 1.
    The count (*) is also the result of the aggregation of the 'internal '.

    I don't know if it's documented or if it is an 'effect' of internal code used for GROUPING SETS or the internal code used to enable the analytical functions like this:

    SQL> select count(decode(job, 'CLERK', 1, null)) CLERKS
      2       , count(decode(job, 'SALESMAN', 1, null)) SALESMANS
      3       , sum(count(decode(job, 'CLERK', 1, null))) over () CLERKS2
      4       , sum(count(decode(job, 'SALESMAN', 1, null))) over () SALESMANS2
      5  from scott.emp group by job;
    
        CLERKS  SALESMANS    CLERKS2 SALESMANS2
    ---------- ---------- ---------- ----------
             0          0          4          4
             4          0          4          4
             0          0          4          4
             0          0          4          4
             0          4          4          4
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4115955660
    
    ----------------------------------------------------------------------------
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   1 |  WINDOW BUFFER      |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   2 |   SORT GROUP BY     |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    

    Personally, I think that I would have preferred if Oracle has raised an error on this "double aggregation" and therefore require me to write this way (if it's the result I wanted):

    select sum(CLERKS), sum(SALESMANS)
    from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
             from emp group by job)
    

    I don't really see a good use case for aggregations of 'double'-, but rather that he could give you undetected bugs in your code, if you happen to do double aggregation without noticing.

    Interesting thing to know ;-)

  • Why this query produces no output?

    Why this query produces no output?
    select * from
    (
    SELECT 40 as startvalue, (24 * 60)*(To_Date('00:40', 'HH24:MI') - To_Date('00:00', 'HH24:MI')) as c
    FROM dual di
    ) q
    where q.c = q.startvalue

    And just to show that it works if round you...

    SQL> ed
    Wrote file afiedt.buf
    
      1  select * from
      2  (
      3  SELECT 40 as startvalue, round((24 * 60)*(To_Date('00:40', 'HH24:MI') - To_Date('00:00', 'HH24:MI')),0) as c
      4  FROM dual di
      5  ) q
      6* where q.c = q.startvalue
    SQL> /
    
    STARTVALUE          C
    ---------- ----------
            40         40
    

    I certainly wouldn't say using TRIM as PS has suggested. TRIM is a string function, not a digital function.

  • Can't understand why this query returns multiple lines with the same data

    Hi all
    I am a relative novice and self-taught when it comes to SQL. I wrote a query to our reporting tool that returns multiple rows, and I can't understand why. I know that I can use the SELECT DISTINCT option, but it really slows the execution when I do. I'd really rather understand if I can change the code to avoid the multiples. This is the query. I've included a few statements in italics to help explain the break. Any ideas?

    SELECT MATSITE, MATPONUM, FIRSTRECPTDATE
    Of
    Subquery that concludes the first date on which purchase orders have been implemented with ACK State
    (SELECT ACKSTAT. PONUM AS 'ACKPONUM', (MIN (ACKSTAT. CHANGEDATE)) AS 'FIRSTACKDATE '.
    OF PZMAX. POSTATUS ACKSTAT
    WHERE (ACKSTAT. STATE = 'ACK') AND (ACKSTAT.ORGID ='CGSALTUS)
    GROUP OF ACKSTAT. PONUM),
    Subquery that concludes the first reception against a purchase order transaction for purposes of comparison
    (SELECT TRANS. PONUM AS "MATPONUM", TRANS. SITEID AS 'MATSITE', (MIN (TRANS. TRANSDATE)) AS 'FIRSTRECPTDATE '.
    OF PZMAX. MATRECTRANS TRANS
    WHERE (TRANS.ORGID ='CGSALTUS) AND (TRANS. HOUR > =: startDate and TRANS. TRANSDATE < =: endDate)
    TRANS GROUP. SITEID, TRANS. PONUM)
    WHERE
    (ACKPONUM = MATPONUM AND FIRSTRECPTDATE < FIRSTACKDATE) OR (NOT EXISTS (SELECT 1 FROM PZMAX. POSTATUS ACKSTAT2 WHERE (ACKSTAT2. PONUM = MATPONUM) AND (ACKSTAT2. STATE = 'ACK') AND (ACKSTAT2.ORGID ='CGSALTUS)))

    The where the instruction is intended to find when one of two conditions exists. ((1) received happened before the command either in ACK or 2) a reception that's happened, but the purchase order is never in ACK State. It seems that this second condition that creates multiple lines.

    Any thoughts will be appreciated geratly.

    Dave Teece
  • Why this query can remove duplicates?

    Why this query can remove duplicates? Can someone give me detailed explanation?

    Thank you
    select salary from employees union select salary from employees;

    Hello

    See the docs.

    ' Example of the UNION
    The following statement combines the results of two queries with the UNION operator which eliminates duplicates of selected lines.
    "This statement shows that you must match the data type (using the function TO_CHAR) when the columns do not exist in one or the other table"

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/queries004.htm#i2054381

    Edit

    Here's another interpretation of your question:

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1224636375004

    Published by: hoek on October 22, 2009 17:40

  • Why this request required 2 additional columns in GROUP BY

    Hi all

    This is my query:
    SELECT "parent_level_id",
           "parent_level_name"
           "parent_level_id",                     
           "child_level_id",
           "child_level_name",
           "scenario_id",
           "scenario_name",
           "exported",
           "regress_cob",
           "scn_status_id",
           "tgt_scenario_name",
           "load_status_id",
           "load_count",
           "PRESENT_VALUE",
           "DELTA",
           "GAMMA",
           "VEGA",
           "PNL",
           "ORIGINAL_PRESENT_VALUE"
    
    FROM
    (
    select   0-fssPV.feed_id                        as "parent_level_id",
             fssPV.feed_description                 as "parent_level_name",
             fssPV.book_id                          as "child_level_id",
             fssPV.book_display_name                as "child_level_name",
             fssPV.parent_scenario_id               as "scenario_id",
             fssPV.scenario_display_name            as "scenario_name",
             nvl(sc.exported, 'N')                  as "exported",
             nvl(fssPV.parent_regressed_cob_date,  fssPV.parent_cob_date)    as "regress_cob",
             fssPV.scn_status_id                    as "scn_status_id",
             fssPV.tgt_scenario_display_name        as "tgt_scenario_name",
             fssPV.load_status_id                   as "load_status_id",
             count(*)                               as "load_count",
            sum(fssPV.present_value)                as "PRESENT_VALUE",
             sum(fssPV.delta)                       as "DELTA",
             sum(fssPV.gamma)                       as "GAMMA",
             sum(fssPV.vega)                        as "VEGA",
             sum(fssPV.present_value) - sum (srbase.present_value) as "PNL",
             (
                select SUM(vsr.original_present_value) 
    
                from validated_position vp , validated_scenario_result vsr
                where
                VSR.FEED_INSTANCE_ID= fssPV.feed_instance_id
                AND VSR.COB_DATE= fssPV.cob_date
                and vsr.validated_position_id= vp.validated_position_id
                 AND vsr.scenario_id in  (SELECT   distinct mn.node_id as "SCENARIO_ID"
                                           FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
                                                    marsnode mn
                                           WHERE    nodeIds.column_value = mn.node_id
                                           AND      mn.close_date is null
                                          )
                                          
                                         
             ) "ORIGINAL_PRESENT_VALUE" 
    from   (
    
    select fssTgts.*,
           mntgt.display_name        as "TGT_SCENARIO_DISPLAY_NAME",
           mnscenario.display_name   as "SCENARIO_DISPLAY_NAME",
           mnbook.display_name       as "BOOK_DISPLAY_NAME",
           fs.feed_description,
           sr.present_value,
           sr.delta,
           sr.gamma,
           sr.vega,
           p.position_id
    from (
    /** Treewalk to find Feed/Scenario dependencies **/
    Select fssBooks.feed_id,
           fssLinks.cob_date,
           fssLinks.scenario_id,
           fssBooks.load_status_id,
           fssBooks.scn_status_id,
           fssBooks.tgt_scenario_id,
           fssBooks.book_id,
           fssBooks.regressed_cob_date,
           fssLinks.feed_instance_id,
           fssLinks.parent_cob_date,
           fssLinks.parent_tgt_scenario_id,
           fssLinks.parent_regressed_cob_date,
           fssLinks.parent_scenario_id,
           fssLinks.parent_feed_instance_id
    from   (
    
    /** Treewalk (backwards) to find underlying data over FSS control table **/
    WITH fss AS
             /* Initial filter on feed_scenario_status for peformance           */
             /* cannot filter on scenario as we don't know the dependencies yet */
             ( select DISTINCT scenario_id,
                      f.cob_date,
                      f.scn_status_id,
                      f.regressed_cob_date,
                      f.tgt_scenario_id,
                      f.feed_id,
                      f.feed_instance_id
               from   feed_scenario_status f,
                      feed_group_xref fgx
               where    cob_date <= l_cobdate -- PVs for this cob must be loaded either today, or its regressed to a previous cob
               and    f.feed_id = fgx.feed_id
               and    fgx.feed_group_id like l_feed_group_id
               and    fgx.feed_id like l_feed_id
             )
      select   feed_instance_id,
               scenario_id,
               prior scenario_id,
               cob_date,
               feed_id,
               scn_status_id,
               regressed_cob_date,
               /* Need to maintain the root values to identify the scenarios that users are seeing */
               CONNECT_BY_ISLEAF "ISLEAF",
               CONNECT_BY_ROOT scenario_id        as "PARENT_SCENARIO_ID",
               CONNECT_BY_ROOT feed_id            as "PARENT_FEED_ID",
               CONNECT_BY_ROOT cob_date           as "PARENT_COB_DATE",
               CONNECT_BY_ROOT tgt_scenario_id    as "PARENT_TGT_SCENARIO_ID",
               CONNECT_BY_ROOT regressed_cob_date as "PARENT_REGRESSED_COB_DATE",
               CONNECT_BY_ROOT feed_instance_id   as "PARENT_FEED_INSTANCE_ID"
      from     fss
      start with fss.cob_date = l_cobdate
    
      connect by (prior fss.regressed_cob_date = fss.cob_date and
                  prior fss.scenario_id = fss.scenario_id and
                  prior fss.feed_id = fss.feed_id and
                  prior fss.tgt_scenario_id is null
                 ) -- Connect if regressed (rule: same feed/book/scenario, different cob)
              or (prior fss.tgt_scenario_id = fss.scenario_id and
                  prior fss.cob_date = fss.cob_date and
                  prior fss.feed_id = fss.feed_id and
                  prior fss.feed_instance_id = fss.feed_instance_id
                 ) -- and connect if paste as (rule: same feed/cob/book, different scenario)
      ) fssLinks,
      feed_scenario_status fssBooks
    where isLeaf = 1
    and   fssLinks.parent_feed_id = fssBooks.feed_Id
    and   fssLinks.parent_cob_date = fssBooks.cob_date
    and   fssLinks.parent_scenario_id = fssBooks.scenario_id
    ) fssTgts,
    position p,
    scenario_result sr,
    marsnode mntgt,
    marsnode mnbook,
    marsnode mnscenario,
    feed_static fs
    where fssTgts.feed_id = fs.feed_id
    and   fssTgts.parent_tgt_scenario_id = mntgt.node_id (+)
    and   mntgt.close_date (+) is null
    and   fssTgts.feed_instance_id = p.feed_instance_id
    and   fssTgts.book_id = p.book_id
    and   fssTgts.cob_date = sr.cob_date
    and   fssTgts.scenario_id = sr.scenario_id
    and   p.feed_instance_id = sr.feed_instance_id
    and   p.position_id = sr.position_id
    and   p.book_id = mnbook.node_id
    and   mnbook.close_date is null
    and   fssTgts.parent_scenario_id = mnscenario.node_id
    and   mnscenario.close_date is null
    ) fssPV
    left outer join scenario_control sc
      on fssPV.parent_feed_instance_id = sc.feed_instance_id
      and upper(fssPV.scenario_display_name) = upper(sc.scenario)
    /* Join to SBM to calculate P&Ls */
    left outer join scenario_base_map sbm
      on  fssPV.scenario_id = sbm.scenario_id
      and sbm.begin_cob_date <= l_cobdate
      and sbm.end_cob_date > l_cobdate
    left outer join scenario_result srbase
      on  fssPV.cob_date = srbase.cob_date
      and fssPV.feed_instance_id = srbase.feed_instance_id
      and nvl(sbm.mapped_scenario_id, l_original_scn_id) = srbase.scenario_id
      and fssPV.position_id = srbase.position_id
    /* Only display (root) scenarios that users have selected */
    where fssPV.parent_scenario_id in (SELECT   distinct mn.node_id as "SCENARIO_ID"
                                       FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
                                                marsnode mn
                                       WHERE    nodeIds.column_value = mn.node_id
                                       AND      mn.close_date is null
                                      )
    
    group by fssPV.feed_id,
             fssPV.feed_description,
             fssPV.book_id,
             fssPV.book_display_name,
             fssPV.parent_scenario_id,
             fssPV.scenario_display_name,
             sc.exported,
             fssPV.parent_regressed_cob_date,
             fssPV.scn_status_id,
             fssPV.tgt_scenario_display_name,
             fssPV.load_status_id,
             fssPV.parent_cob_date
    --         fssPV.feed_instance_id,
    --         fssPV.cob_date
    );
    In this query for the initial section where I select the part "ORIGINAL_PRESENT_VALUE".
    (
                select SUM(vsr.original_present_value) 
    
                from validated_position vp , validated_scenario_result vsr
                where
                VSR.FEED_INSTANCE_ID= fssPV.feed_instance_id
                AND VSR.COB_DATE= fssPV.cob_date
                and vsr.validated_position_id= vp.validated_position_id
                 AND vsr.scenario_id in  (SELECT   distinct mn.node_id as "SCENARIO_ID"
                                           FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
                                                    marsnode mn
                                           WHERE    nodeIds.column_value = mn.node_id
                                           AND      mn.close_date is null
                                          )
                                          
                                         
             ) "ORIGINAL_PRESENT_VALUE" 
    Even if fssPV.feed_instance_id and fssPV.cob_date are not used anywhere in the clause SELECT requires tobe added to the last clause GROUP BY else
    the query if compile it successfully does giving "not a group of" error.

    Can someone tell me why that is the problem and why these columns must be added to the final GROUP BY clause.

    Rgds,
    Aashish

    Hi, Michael,

    Aashish S. wrote:
    Even if fssPV.feed_instance_id and fssPV.cob_date are not used anywhere in the clause SELECT requires tobe added to the last clause GROUP BY else
    the query if compile it successfully does giving "not a group of" error.

    In fact, you use both of these columns in the SELECT clause, when you calculate the original_present_value:

    (
    select SUM(vsr.original_present_value) 
    
    from validated_position vp , validated_scenario_result vsr
    where
    VSR.FEED_INSTANCE_ID= fssPV.feed_instance_id
    AND VSR.COB_DATE= fssPV.cob_date
    and vsr.validated_position_id= vp.validated_position_id
    AND vsr.scenario_id in  (SELECT   distinct mn.node_id as "SCENARIO_ID"
    FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
    marsnode mn
    WHERE    nodeIds.column_value = mn.node_id
    AND      mn.close_date is null
    )
    ) "ORIGINAL_PRESENT_VALUE" 
    

    Since the scalar subquery is correlated to the fsspv.feed_instance_id and fsspv.cob_date, it is depenedant on these columns, the same, say TRUNC (fsspv.cobb_date, 'YEAR') is depenedant on fsspv.cob_date.

    You will have to perhaps put the SUM in the main query, not the scalar subquery, or replace the scalar subquery with a join (probably faster). Without knowing your table, or the results you want from your data, I can't say more.

    Whenever you have a problem, post a small example of data (TABLE CREATED and instructions INSERT for all tables) and the desired results from these data.
    Simplify the problem as much as possible. In this case, I think you can show that the problem is using just two tables, the alias fsspv and mn ones.
    If you can illustrate your problem using commonly available tables, like those of the scott schema, then you don't need to display all data; just the results you want.

    Looks like you're doing something like this:

    SELECT       job
    ,       COUNT (*)     AS cnt
    ,       (          -- Begin scalar sub_query to compute min_loc
                SELECT     MIN (loc)
              FROM     scott.dept
              WHERE     deptno     = e.deptno
           ) min_loc     -- End scalar sub_query to compute min_loc
    FROM       scott.emp     e
    GROUP BY  job
    ,            deptno     -- Omitting this causes ORA_00979: not a GROUP BY expression
    ;
    

    When you really should do something like this:

    SELECT       job
    ,       COUNT (*)     AS cnt
    ,       MIN ( (          -- Begin scalar sub_query to compute min_loc
                SELECT     loc
              FROM     scott.dept
              WHERE     deptno     = e.deptno
               ) ) min_loc     -- End scalar sub_query to compute min_loc
    FROM       scott.emp     e
    GROUP BY  job
    ;
    

    to achieve these results:

    JOB              CNT MIN_LOC
    --------- ---------- -------------
    CLERK              4 CHICAGO
    SALESMAN           4 CHICAGO
    PRESIDENT          1 NEW YORK
    MANAGER            3 CHICAGO
    ANALYST            2 DALLAS
    
  • Foxfire flies from site to site, but the links open very slowly in my e-mail program. Why the difference?

    Foxfire when open, flies from site to site, but when I click on a link in my email, even if Foxfire is open, it is very very slow to react, aggravatingly Yes. Why the difference?

    What part solved the problem?

    Was it places.sqlite?

    In this case he may have had a problem with history.

  • Remote Desktop. Why the differences?

    In this case I use Remote Desktop to connect a system from Vista Home Premium to Windows XP Professional on a local network.  Still, it establishes a connection, but can behave in 3 different ways:

    1. the session starts and works very well.  After entering the password (I ask the password), it goes directly on the desktop of the remote PC

    2. the session begins, then I am taken to the login screen of the normal remote PC (what you expect to see if you were working on this PC).  When you enter the password, it then goes to the desktop.

    3. I get the blah "can not load your profile...". ", where Windows will load a temporary profile that takes you back office.  Logging and lumbering back to still seems to work, i.e. log on normally.

    So, no show stopping issues, but why?  Certainly why the difference between 1 and 2?  Thoguh that you arrive at the same place, with 2, you get also present with all the other user accounts on this computer.  For my part, it is not a constraint, but what happens if I don't want to have other possibilities of connection presented?  Remote Desktop Client indicates the account to Log On with, so why present all others?  On the question of the profile, there are a lot of intel available, but I have yet to find the cause in my configuration.  It's exhausting rather than as a problem, but I would be very happy to eliminate this behavior.

    Hello

    You can check out the following link and check:

    Remote Desktop connection: frequently asked questions

    The problems of desktop remotely

    Hope this information is useful.

  • Query of query count (column) returns empty not zero

    This seems to be a bug in 7,0,1,116466 and 8,0,1,195765

    Query of query count (column) or count (*) returns empty not zero when there is no match. Correctly returns a number when there is query matches.

    For example select count (i_id) of PersonnelQuery where i_id < 100

    Where does a report these?

    scottcook,

    It's a known bug in ColdFusion 6.x which apparently has not been set.

    Bug in CF6 (see the comments section of the page linked below)
    http://livedocs.Adobe.com/ColdFusion/6.1/htmldocs/using_29.htm

    Workaround
    http://www.bennadel.com/blog/244-ColdFusion-query-of-queries-odd-count-behavior.htm

    Report it as a bug
    http://www.Adobe.com/cfusion/mmForm/index.cfm?name=wishform

  • After the installation of Sierra, websites follow me like crazy!  This has not happened before.  Why this is happening and what can I do to stop it?

    After the installation of Sierra, Web sites started to follow me like crazy!  This has not happened before.  Why this is happening and what can I do to stop it?

    What are your privacy settings in Safari preferences.

  • My Airport Express will randomly start flashing orange and I have to unplug it to make it back to the green.  Wifi continues to operate even when the light is orange flashing.  Anyone know why this is happening?

    My Airport Express will randomly start flashing orange and I have to unplug it to make it back to the green. Wifi continues to operate even when the light is orange flashing. Anyone know why this is happening?

    The next time you see the flashing light amber...

    Open Finder > Applications > utilities > AirPort Utility

    Click on the image of the AirPort Express

    If you see a button update, click on update the firmware on the airport

    Otherwise, find status and click on the little orange dot it. A message will appear to say why the airport complained and suggest a remedy for the issue.

  • Why this message: you are not allowed to view or update this topic

    Why this message: you are not allowed to publish or comment on it.

    It's a legitimate question.

    You encounter a bug in the Jive Software that runs this forum. Most of the time simply try again or refresh the page will fix the problem. There is one caveat with respect to time. You can't post more than once every 30 seconds, and it's to discourage spamming.

Maybe you are looking for

  • Is iphoto a duplicate

    I have about 11g of photos on my Macbook Air.  They in office / my documents/photos. Finder shows also 15g of photos in my Iphoto library. Are they duplicates?  Delete a game?

  • Safari bug/adware/malware won't go even after full restore

    Hello I can't get rid of a bug that continues to make windows pop up or forcing me on stupid 'you have won a prize' sites, even after having repeatedly a clean full restore (no backup) of the iPhone. I thought he might come back through the data of S

  • Open several windows after clicking on the button options

    When I click on "tools > options" Firefix will open a number of new windows. When I click or uncheck an option it will open more windows, which seems to have begun after that I restarted firefix after it recommended only to use the function

  • HP Officejet 6700 Premium - only scan wireless

    Hello My new printer is connected wireless to my network.  It prints very well. It will NOT scan ontop my computer unless I physically connect it with a usb cord. I tried to go to the HP utility folder to confirm the scan settings are on, but it's no

  • 15 - r127nv: password administrator or power on password

    My phone is blocked, need help for unlock: System to disable the code: 76576559 Need help as soon as possible. Thank you for your time.