Order Of Null and Not Null Values while table creation

We have to create a table with 10 fields .5 of them are Null and Not Null. Now my question what should be the order of fileds??.Means Null Fields will come first or Not Null.

The only reason I can think of having the NULL columns at the end is storage space.
To conserve space, a null in a column only stores the column length (zero). Oracle
does not store data for the null column. Also, for trailing null columns, Oracle does
not even store the column length.

Similar Messages

  • Using NULL and NOT NULL in prompted filters

    Dear all,
    While trying to grap the concept of prompted filters in sap bo web intelligence, I had a question whether why we cannot use NULL and NOT NULL while creating a prompted filters in our report.

    HI,
    'Is Null' and 'Not Null' are the predefined functions in webi which only eliminate the null values or considering only null values.
    'Is Null' and 'Not Null' are itself predefined functions that why you are not getting  prompts.
    Null values are standard across the databases so this is defined  as a function in webi to specific eliminate the null values.
    If something is not standard then there is option in the webi to use different operator with static values or with prompts.
    More more information on Null see the Null wiki page.
    Null (SQL) - Wikipedia, the free encyclopedia
    Amit

  • How can I set my WebI filters to Null and not Null

    Folks,
    I have created a report in WebI and now I am to set up some filters as Null and some Not Null.
    How can I set my WebI filters to Null and not Null?
    Regards,
    Bashir Awan

    Hi,
    As you said you could do it at the report level and also at the universe level.
    One more way is to create the filters in the universe levele and add them in thequery filter.
    Ex: in the filter you need to write :
    Column1 is null and and column 2 is not null etc.
    Hope this will help.
    If this did't  solve your problem then please explain it in detail.
    Cheers,
    Ravichandra K

  • Creating table with null and not null values.

    I have to create a table with 5 Null nd 5 Not Null fields.My questionis which fields are place first?Not or Not Null and why???

    What you mean is: the person who asked you the question thought the order of columns was important, and wanted to see if you agreed. Or maybe they were just asking the question to see whether you thought it was important (as a test of your understanding of the database).
    When I started out in Oracle I was told that it was good practice to have the mandatory columns first and then the optional columns. But if you do some research you find this: the impact of column ordering on space management is: empty nullable columns at the end of the table take up zero bytes whereas empty nullable columns at the middle of the table take up one byte each. I think if that saving really is important to you you need to spring for an additional hard drive.
    Besides, even if you do organise your columns as you suggest, what happens when you add an eleventh NOT NULL column to your table? It gets tacked on to the end of your table. Your whole neat organisation is blown.
    What does still matter is the positioning of large VARCHAR2 columns: they should be the last columns on your table in case they create chaining. Then any query that doesn't need the large columns can be satisfied without reading the chained block, something that can't be guaranteed if you've got columns after a VARCHAR2(4000) column. This doesn't apply to CLOBs, etc. which are stored separately anyway.
    Cheers, APC

  • Null and not null columns

    Hi,
    I want to specify that if an ID is 0 or null to do something... I am not sure if I am writing the code properly since it does not display anything when the coulmn has data(not null)
    <%! int ID=1;%>
    <% if ((ID ==0) || (request.getParameter("ID") !=null)){ %>
    do something
    <%} else {%>
    do something else
    <%%>
    if the ID is has a number greater than 0 then I would like to display information. But my code does not get to the else statement?
    Thanks!

    Remember the functionality of logical OR operator. IF the first statement evaluated is TRUE, the next are not evaluated.

  • Checking null and not null values

    Hi!
    We have a job schedule table that has a column for each day.
    JOB_ID, TIME_ID, MO, TU, WE, TH, FR, SA, SU
    1                 1        X
    1                 2                        XSince the same job can be on different days and times, we need to check all the instances of
    that job.
    Sorry for the formatting - the X is an indicator; i.e. Wednesday and Saturday.
    How can we solve this?
    Thanks!

    Your requirements are not really clear.
    Perhaps this query could help:
    -- Your Data:
    with yourtable as
      select 1 job_id, 1 time_id, null mo, null tu, 'X' we, null th, null fr, null sa, null su from dual union all
      select 1 job_id, 2 time_id, null mo, null tu, null  we, null th, null fr, null sa, 'X' su from dual
    -- Query:
    select job_id, time_id, 'mo' day from yourtable where to_char(mo)='X' union all
    select job_id, time_id, 'tu' day from yourtable where to_char(tu)='X' union all
    select job_id, time_id, 'we' day from yourtable where to_char(we)='X' union all
    select job_id, time_id, 'th' day from yourtable where to_char(th)='X' union all
    select job_id, time_id, 'fr' day from yourtable where to_char(fr)='X' union all
    select job_id, time_id, 'sa' day from yourtable where to_char(sa)='X' union all
    select job_id, time_id, 'su' day from yourtable where to_char(su)='X'Edited by: hm on 29.07.2011 01:40
    Edited by: hm on 29.07.2011 01:41

  • Script or query to generate a report of null or not null columns

    I need a script/query it should pick up all the tables from user_tab_columns and produce a report for all the tables which are the columns are null and not null.

    As long as the columns were defined as NOT NULL on table create, or ALTERed NOT NULL, you can do this:
    SQL> CREATE TABLE t (id NUMBER NOT NULL, descr VARCHAR2(10));
    Table created.
    SQL> SELECT column_name, table_name, nullable
      2  FROM user_tab_columns
      3  WHERE table_name = 'T';
    COLUMN_NAME                    TABLE_NAME                     N
    ID                             T                              N
    DESCR                          T                              Y
    SQL> ALTER TABLE t modify (descr NOT NULL);
    Table altered.
    SQL> SELECT column_name, table_name, nullable
      2  FROM user_tab_columns
      3  WHERE table_name = 'T';
    COLUMN_NAME                    TABLE_NAME                     N
    ID                             T                              N
    DESCR                          T                              NNote that if you do:
    ALTER TABLE t ADD CONSTRAINT id_nn CHECK (id IS NOT NULL);then the nullable column in xxx_tab_columns will remain as Y.
    HTH
    John

  • Using the text and not the value of a filed

    Hi there,
    I'm programming a pdf form using life cycle, I'm using the following script in a "SEND TO" button in order to email an XML file with the data extracted from the form:
    var emailAddress = F.P1.Line.rawValue;
    var veicle = F.P1.Vehicle.rawValue;
    var shipper = F.P1.Shipper.rawValue;
    var date = F.P1.Date.rawValue;
    event.target.submitForm({cURL:"mailto:"+emailAddress+"?subject=Booking request from "+shipper+" date:"+date+" &body=Dear Sirs,Please find attached the completed PDF booking form for the following "+veicle+".",cSubmitAs:"XML",cCharset:"utf-8"});
    The problem is that I would like to use in a variable the text and not the value of the F.P1.Line.raw field.
    Thanks in advance

    Hi,
    This is not the appropriate forum to post this type of question. Please post all designer related queries in LiveCYcle Designer Forum to receive better response.
    From you query I understand you have a dropdown box with name as "Line". And you want to the "text" part of the selected item and not the "value" part. If it is so then do the following -
    1. Write the below code in onCHange event of your dropdown box.
    var ddValue = this.boundItem(xfa.event.newText);
    var nodeList = this.resolveNode("#items").nodes;
    var ddText = null;
    for (var i = 0; i < nodeList.length; i++)
    if (this.boundItem(nodeList.item(i).value) == ddValue)
    ddText = nodeList.item(i).value;
    break;
    global.selectedtxt = ddText;
    In the above code I am basically getting the "text" part of the item selected and then I am storing it in a global variable.
    2.
    Write the below code on click event of your button -
    var emailAddress = global.selectedtxt;
    Hope this helps.
    Thanks,
    Shivajiv.

  • NULL IS NOT NULL filter issue

    Can someone explain why 'Y' = 'N' is not working with PARALLEL Plan? i.e. With the filter like 'Y' = 'N' specified and if PQ is used , it does not return instantly. In fact it reads the entire table.
    Here is the test case.. Goal is to execute only one of the SQL joined by union all. I have included 'Y' = 'N' in both SQLs for the test purpose.
    DB Version is 10.2.0.4
    Create table test_tbl_01 nologging as select do.* from dba_objects do , dba_objects d1 where rownum < 22000001;
    Create table test_tbl_02 nologging as select do.* from dba_objects do , dba_objects d1 where rownum < 22000001;
    execute DBMS_STATS.GATHER_TABLE_STATS('SCOTT', 'TEST_TBL_01');
    execute DBMS_STATS.GATHER_TABLE_STATS('SCOTT', 'TEST_TBL_02');
    *Serial path with 2 table join*
    SQL> select
      2    /* parallel(t1,2 ) parallel(t2,2) */
      3    t1.*
      4    from test_tbl_01 t1 ,test_tbl_02 t2
      5    where t1.object_name = t2.object_name
      6    and  'Y' = 'N'
      7    and  t1.object_type = 'TABLE'
      8    union all
      9    select
    10    /* parallel(t1,2 ) parallel(t2,2) */
    11    t1.*
    12    from test_tbl_01 t1 ,test_tbl_02 t2
    13    where t1.object_name = t2.object_name
    14    and  'Y' = 'N'
    15  /
    no rows selected
    Elapsed: 00:00:00.01
    Execution Plan
    Plan hash value: 3500703583
    | Id  | Operation            | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |             |     2 |   168 |       |     0   (0)|          |
    |   1 |  UNION-ALL           |             |       |       |       |            |          |
    |*  2 |   FILTER             |             |       |       |       |            |          |
    |*  3 |    HASH JOIN         |             |   660G|    50T|   449M|  6242K (99)| 24:16:38 |
    |*  4 |     TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M|       | 41261   (2)| 00:09:38 |
    |   5 |     TABLE ACCESS FULL| TEST_TBL_02 |    22M|   212M|       | 40933   (2)| 00:09:34 |
    |*  6 |   FILTER             |             |       |       |       |            |          |
    |*  7 |    HASH JOIN         |             |  2640G|   201T|   467M|    24M(100)| 95:54:53 |
    |   8 |     TABLE ACCESS FULL| TEST_TBL_02 |    22M|   212M|       | 40933   (2)| 00:09:34 |
    |   9 |     TABLE ACCESS FULL| TEST_TBL_01 |    21M|  1546M|       | 41373   (3)| 00:09:40 |
    Predicate Information (identified by operation id):
       2 - filter(NULL IS NOT NULL)
       3 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
       4 - filter("T1"."OBJECT_TYPE"='TABLE')
       6 - filter(NULL IS NOT NULL)
       7 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed
    *Parallel path with 2 table join*
    SQL> select
      2    /*+ parallel(t1,2 ) parallel(t2,2) */
      3    t1.*
      4    from test_tbl_01 t1 ,test_tbl_02 t2
      5    where t1.object_name = t2.object_name
      6    and  'Y' = 'N'
      7    and  t1.object_type = 'TABLE'
      8    union all
      9    select
    10    /*+ parallel(t1,2 ) parallel(t2,2) */
    11    t1.*
    12    from test_tbl_01 t1 ,test_tbl_02 t2
    13    where t1.object_name = t2.object_name
    14    and  'Y' = 'N'
    15  /
    no rows selected
    Elapsed: 00:01:09.34
    Execution Plan
    Plan hash value: 1557722279
    | Id  | Operation                   | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT            |             |     2 |   168 |       |     0   (0)|          |     |         |            |
    |   1 |  PX COORDINATOR             |             |       |       |       |            |          |     |         |            |
    |   2 |   PX SEND QC (RANDOM)       | :TQ10004    |       |       |       |            |          |  Q1,04 | P->S | QC (RAND)  |
    |   3 |    BUFFER SORT              |             |     2 |   168 |       |            |          |  Q1,04 | PCWP |            |
    |   4 |     UNION-ALL               |             |       |       |       |            |          |  Q1,04 | PCWP |            |
    |*  5 |      FILTER                 |             |       |       |       |            |          |  Q1,04 | PCWC |            |
    |*  6 |       HASH JOIN             |             |   660G|    50T|   224M|  3465K (99)| 13:28:42 |  Q1,04 | PCWP |            |
    |   7 |        PX JOIN FILTER CREATE| :BF0000     |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,04 | PCWP |            |
    |   8 |         PX RECEIVE          |             |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,04 | PCWP |            |
    |   9 |          PX SEND HASH       | :TQ10000    |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,00 | P->P | HASH       |
    |  10 |           PX BLOCK ITERATOR |             |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,00 | PCWC |            |
    |* 11 |            TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M|       | 22861   (2)| 00:05:21 |  Q1,00 | PCWP |            |
    |  12 |        PX RECEIVE           |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,04 | PCWP |            |
    |  13 |         PX SEND HASH        | :TQ10001    |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | P->P | HASH       |
    |  14 |          PX JOIN FILTER USE | :BF0000     |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | PCWP |            |
    |  15 |           PX BLOCK ITERATOR |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | PCWC |            |
    |  16 |            TABLE ACCESS FULL| TEST_TBL_02 |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,01 | PCWP |            |
    |* 17 |      FILTER                 |             |       |       |       |            |          |  Q1,04 | PCWC |            |
    |* 18 |       HASH JOIN             |             |  2640G|   201T|   233M|    13M(100)| 53:15:52 |  Q1,04 | PCWP |            |
    |  19 |        PX RECEIVE           |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,04 | PCWP |            |
    |  20 |         PX SEND HASH        | :TQ10002    |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,02 | P->P | HASH       |
    |  21 |          PX BLOCK ITERATOR  |             |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,02 | PCWC |            |
    |  22 |           TABLE ACCESS FULL | TEST_TBL_02 |    22M|   212M|       | 22679   (1)| 00:05:18 |  Q1,02 | PCWP |            |
    |  23 |        PX RECEIVE           |             |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,04 | PCWP |            |
    |  24 |         PX SEND HASH        | :TQ10003    |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,03 | P->P | HASH       |
    |  25 |          PX BLOCK ITERATOR  |             |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,03 | PCWC |            |
    |  26 |           TABLE ACCESS FULL | TEST_TBL_01 |    21M|  1546M|       | 22924   (2)| 00:05:21 |  Q1,03 | PCWP |            |
    Predicate Information (identified by operation id):
       5 - filter(NULL IS NOT NULL)
       6 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
      11 - filter("T1"."OBJECT_TYPE"='TABLE')
      17 - filter(NULL IS NOT NULL)
      18 - access("T1"."OBJECT_NAME"="T2"."OBJECT_NAME")
    Statistics
           1617  recursive calls
              3  db block gets
         488929  consistent gets
         493407  physical reads
            636  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              6  sorts (memory)
              0  sorts (disk)
              0  rows processedHowever single table with UNION ALL and PQ works..
    *NO Joins (i.e. Single Table with PQ )  , Issue does not show-up.*
    _*SERIAL PLAN with one Table*_
    SQL> select
      2    /* parallel(t1,2 )   */
      3    t1.*
      4    from test_tbl_01 t1
      5    where 'Y' = 'N'
      6    and  t1.object_type = 'TABLE'
      7    union all
      8    select
      9    /* parallel(t1,2 )   */
    10    t1.*
    11    from test_tbl_01 t1
    12    where 'Y' = 'N'
    13  /
    no rows selected
    Elapsed: 00:00:00.01
    Execution Plan
    Plan hash value: 2870519681
    | Id  | Operation           | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |             |     2 |   148 |     0   (0)|          |
    |   1 |  UNION-ALL          |             |       |       |            |          |
    |*  2 |   FILTER            |             |       |       |            |          |
    |*  3 |    TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M| 41261   (2)| 00:09:38 |
    |*  4 |   FILTER            |             |       |       |            |          |
    |   5 |    TABLE ACCESS FULL| TEST_TBL_01 |    21M|  1546M| 41373   (3)| 00:09:40 |
    Predicate Information (identified by operation id):
       2 - filter(NULL IS NOT NULL)
       3 - filter("T1"."OBJECT_TYPE"='TABLE')
       4 - filter(NULL IS NOT NULL)
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed
    _*PARALLEL PLAN with one Table*_
    SQL> select
      2    /*+ parallel(t1,2 )      */
      3    t1.*
      4    from test_tbl_01 t1
      5    where 'Y' = 'N'
      6    and  t1.object_type = 'TABLE'
      7    union all
      8    select
      9    /*+ parallel(t1,2 )      */
    10    t1.*
    11    from test_tbl_01 t1
    12    where 'Y' = 'N'
    13  /
    no rows selected
    Elapsed: 00:00:00.09
    Execution Plan
    Plan hash value: 3114025180
    | Id  | Operation              | Name        | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT       |             |     2 |   148 |     0   (0)|          |        |      |            |
    |   1 |  PX COORDINATOR        |             |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)  | :TQ10000    |       |       |            |          |  Q1,00 | P->S | QC (RAND)  |
    |   3 |    UNION-ALL           |             |       |       |            |          |  Q1,00 | PCWP |            |
    |*  4 |     FILTER             |             |       |       |            |          |  Q1,00 | PCWC |            |
    |   5 |      PX BLOCK ITERATOR |             |  5477K|   386M| 22861   (2)| 00:05:21 |  Q1,00 | PCWC |            |
    |*  6 |       TABLE ACCESS FULL| TEST_TBL_01 |  5477K|   386M| 22861   (2)| 00:05:21 |  Q1,00 | PCWP |            |
    |*  7 |     FILTER             |             |       |       |            |          |  Q1,00 | PCWC |            |
    |   8 |      PX BLOCK ITERATOR |             |    21M|  1546M| 22924   (2)| 00:05:21 |  Q1,00 | PCWC |            |
    |   9 |       TABLE ACCESS FULL| TEST_TBL_01 |    21M|  1546M| 22924   (2)| 00:05:21 |  Q1,00 | PCWP |            |
    Predicate Information (identified by operation id):
       4 - filter(NULL IS NOT NULL)
       6 - filter("T1"."OBJECT_TYPE"='TABLE')
       7 - filter(NULL IS NOT NULL)
    Statistics
             28  recursive calls
              3  db block gets
              7  consistent gets
              0  physical reads
            628  redo size
            567  bytes sent via SQL*Net to client
            232  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              2  sorts (memory)
              0  sorts (disk)
              0  rows processed

    The same behvious appears in 11.1.0.6, and you don't need such a large data set to prove the point. The paralllel distribution may change to a broadcast with a smaller data set, but I demonstrated the effect when my two tables simply selected 30,000 rows each from all_objects.
    I think you should pass this to Oracle Corp. as a bug - using the smaller data set.
    The problem seems to be the way that Oracle combines multiple lines of a plan into groups of operations (as in PCWC, PCWC, PCWP). It looks like this particularly example has managed to fold the FILTER into a group in such a way that Oracle has lost track of the fact that it is a 'pre-emptng - i.e. always false' filter rather than an ordinary data filter; consequently the filter doesn't apply until after the hash join starts running.
    In my example (which did a broadcast distribution) I could see that Oracle read the entire first table, then started to read the second table, but stopped after one row of the second table, because my plan allowed the join and filter to be applied immediately after the first row from the second table. And I think Oracle decided that the filter was alway going to be false at that moment - so stopped running the second tablescan. You've used a hash/hash distribriution, which has resulted in both scans completing because the slaves in each layer don't talk to each other.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan

  • NULL in not null column

    Hi,
    I have a table
    SQL> desc tabula.M$$USERS;
    Name Null? Type
    USERLOGIN NOT NULL VARCHAR2(20)
    PASSWORD NOT NULL VARCHAR2(30)
    T$USER NOT NULL NUMBER(38)
    USERNAME NOT NULL VARCHAR2(30)
    USERID NOT NULL NUMBER(38)
    USERGROUP NOT NULL NUMBER(38)
    T$LINKID NOT NULL VARCHAR2(50)
    password column is not null.
    Application get ORA-01400 (can't insert to null into not null colum) and also when I run -
    Edited by: user10237262 on Nov 29, 2011 12:54 AM

    Hi welcome to forum
    see below example
    SQL> create table t(empno number(4) not null, ename varchar2(10))
      2  /
    Table created.
    SQL> insert into t values(100,'abc');
    1 row created.
    SQL> insert into t values(200,'def');
    1 row created.
    SQL> insert into t values(null,'def');
    insert into t values(null,'def')
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("SYSTEM"."T"."EMPNO")
    SQL> desc t
    Name                                      Null?    Type
    EMPNO                                     NOT NULL NUMBER(4)
    ENAME                                              VARCHAR2(10)
    SQL>"Null?" tells the perticular column is null or not...
    Usage
    The description for tables, views, types and synonyms contains the following information:
    each column's name
    whether or not null values are allowed (NULL or NOT NULL) for each column
    refer:
    http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12019.htm
    Edited by: newbie on Nov 29, 2011 12:54 AM

  • Filter(NULL IS NOT NULL) in Explain Plan ??

    Hi All,
    Can someone please explain what this explain plan statement means? I see a filter(NULL IS NOT NULL) as the first statement - could not figure out why it came up so from googling.
    My Query Used:
    EXPLAIN PLAN FOR
    MERGE INTO summary_bysrccd
    USING
    (SELECT LAST_DAY(TRUNC(to_timestamp(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS SUMMARY_DATE,
    os.acctnum,
    ol.sourcecode AS sourcecode,
    ol.sourcename AS sourcename,
    count(1) cnt_articleview
    FROM article_views os , master_sourcecode ol
    where os.sourcecode = ol.sourcecode
    AND os.acctnum IS NOT NULL
    AND ol.sourcecode IS NOT NULL
    AND os.requestdatetime IS NOT NULL
    AND UPPER(os.success_ind) = 'S'
         AND (
              ('INCR'  = 'FULL'
              AND  (get_date_timestamp(os.requestdatetime) BETWEEN TO_DATE('23-AUG-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('27-AUG-2011 23:59:59','DD-MON-YYYY HH24:MI:SS')
              AND   os.entry_CreatedDate BETWEEN TO_DATE('22-AUG-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('28-AUG-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
              OR ('INCR' = 'FULL'
              AND os.entry_createddate BETWEEN TO_DATE('23-AUG-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('27-AUG-2011 23:59:59','DD-MON-YYYY HH24:MI:SS') )
    group by LAST_DAY(TRUNC(to_timestamp(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))),
    os.acctnum,ol.sourcecode,ol.sourcename) mrg_query
    ON (ods_av_summary_bysrccd.acctnum = mrg_query.acctnum AND
    ods_av_summary_bysrccd.summary_date=mrg_query.summary_date AND
    ods_av_summary_bysrccd.sourcecode=mrg_query.sourcecode)
    WHEN NOT MATCHED THEN
    INSERT (SUMMARY_date,ACCTNUM,SOURCECODE,SOURCENAME,CNT_ARTICLEVIEW,ENTRY_LASTUPDATEDDATE)
    VALUES(mrg_query.summary_date,mrg_query.acctnum,mrg_query.sourcecode,mrg_query.sourcename,
    mrg_query.cnt_articleview,sysdate)
    WHEN MATCHED THEN
    UPDATE SET ods_av_summary_bysrccd.cnt_articleview=
    CASE WHEN NVL('INCR','INCR') = 'FULL' THEN mrg_query.cnt_articleview
    ELSE ods_av_summary_bysrccd.cnt_articleview+mrg_query.cnt_articleview
    END,
    ods_av_summary_bysrccd.entry_lastupdateddate=sysdate;My Explain Plan:
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 268591246
    | Id  | Operation                                 | Name                      | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | MERGE STATEMENT                           |                           |     1 |   456 |       |     3   (0)| 00:00:01 |       |       |
    |   1 |  MERGE                                    | ODS_AV_SUMMARY_BYSRCCD    |       |       |       |            |          |       |       |
    |   2 |   VIEW                                    |                           |       |       |       |            |          |       |       |
    |   3 |    NESTED LOOPS OUTER                     |                           |     1 |   417 |       |     3   (0)| 00:00:01 |       |       |
    |   4 |     VIEW                                  |                           |     1 |   360 |       |     5 (100)| 00:00:01 |       |       |
    |   5 |      SORT GROUP BY                        |                           |     1 |    73 |   595M|            |          |       |       |
    PLAN_TABLE_OUTPUT
    |*  6 |       FILTER                              |                           |       |       |       |            |          |       |       |
    |*  7 |        HASH JOIN                          |                           |  6975K|   485M|  3944K| 17594   (1)| 00:03:32 |       |       |
    |   8 |         TABLE ACCESS FULL                 | ODS_MASTER_SOURCECODE     | 84021 |  2953K|       |   273   (1)| 00:00:04 |       |       |
    |*  9 |         TABLE ACCESS BY GLOBAL INDEX ROWID| ODS_ARTICLE_VIEWS         |  7007K|   247M|       |   826   (0)| 00:00:10 |    33 |    33 |
    |* 10 |          INDEX FULL SCAN                  | IDX_AV_ACCTNUM            |    25M|       |       |    26   (0)| 00:00:01 |       |       |
    |  11 |     TABLE ACCESS BY GLOBAL INDEX ROWID    | ODS_AV_SUMMARY_BYSRCCD    |     1 |    57 |       |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 12 |      INDEX UNIQUE SCAN                    | ODS_AV_SUMMARY_BYSRCCD_PK |     1 |       |       |     2   (0)| 00:00:01 |       |       |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       6 - filter(NULL IS NOT NULL)
       7 - access("OS"."SOURCECODE"="OL"."SOURCECODE")
       9 - filter("OS"."REQUESTDATETIME" IS NOT NULL AND "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-08-23 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' 2011-08-27 23:59:59', 'syyyy-mm-dd hh24:mi:ss') AND UPPER("OS"."SUCCESS_IND")='S')
      10 - filter("OS"."ACCTNUM" IS NOT NULL)
      12 - access("ODS_AV_SUMMARY_BYSRCCD"."SUMMARY_DATE"(+)=INTERNAL_FUNCTION("MRG_QUERY"."SUMMARY_DATE") AND
                  "ODS_AV_SUMMARY_BYSRCCD"."ACCTNUM"(+)="MRG_QUERY"."ACCTNUM" AND "ODS_AV_SUMMARY_BYSRCCD"."SOURCECODE"(+)="MRG_QUERY"."SOURCECODE")
    Note
    PLAN_TABLE_OUTPUT
       - dynamic sampling used for this statement

    Hi Toon,
    Thanks for the quick resolution. I went back and verified the table's colunm details and it has a NOT NULL constraint.
    Regards,
    Chaitanya
    P.S: Is it ok if I ask you for some help regarding a production issue I have been encountering since 15 days but haev no clear resolution yet about what/why is the reason (the said issue is neither uniform nor regular - its affecting some modules and happening on some days - i shall give the full details if you are willing to have a look) - i shall start a new post or email you directly - yur convenience.

  • ViewCriteriaRow attribute to check for null or not null

    I Want to apply a view criteria to check for null or not null on a column , i see examples on how to set for value like
    vcRow.setAttribute("Sal", "> 2500")but i need to check for Sal is null or not null ,
    tried vcRow.setAttribute("Sal", null) and it is not working
    and vcRow.setAttribute("Sal", "is null") gives me error .
    can somebody help with correct syntax for this
    Thanks for your time

    looks like vcRow.setAttribute("Sal", "null") works

  • Not Understanding the filter in Explain Plan - filter(NULL IS NOT NULL)

    Hi All,
    Request your help in understanding the below scenario. (I am not aware of teh application and table details. Just trying to help my friend)
    SQL> conn
    Enter user-name: [email protected]
    Enter password:
    Connected.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for Linux: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    --Checking the count in PO_LINES
    SQL> select count(*) from po_lines;
      COUNT(*)
             0
    --PO_LINES is a synonym
    SQL> select object_type,owner from dba_objects where object_name = 'PO_LINES';
    OBJECT_TYPE         OWNER
    SYNONYM             APPS
    --The synonym is pointing to PO.PO_LINES_ALL
    SQL> select * from user_synonyms where synonym_name = 'PO_LINES';
    SYNONYM_NAME                   TABLE_OWNER                    TABLE_NAME                     DB_LINK
    PO_LINES                       PO                             PO_LINES_ALL
    --But when counting PO.PO_LINES_ALL I am getting different result
    SQL> select count(*) c from po.po_lines_all;
             C
          8828
    --Explain plan of teh original query is
    SQL> explain plan for
      2  select
      3  * from po_lines;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation          | Name         | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT   |              |     1 |   252 |     0   (0)|
    |*  1 |  FILTER            |              |       |       |            |
    |   2 |   TABLE ACCESS FULL| PO_LINES_ALL |  8796 |  2164K|   106   (4)|
    Predicate Information (identified by operation id):
       1 - filter(NULL IS NOT NULL)
    --Now the object PO.PO_LINES_ALL is TABLE, not an mview.
    SQL> select object_type,owner from dba_objects where object_name = 'PO_LINES_ALL';
    OBJECT_TYPE         OWNER
    TABLE               POSeek your help in understanding what is happening here.
    Thanks in Advance,
    jeneesh

    Next time, prefix with APPS. when you show us the explain plan:
    SQL> explain plan for
      2  select
      3  * from apps.po_lines;  -- added the prefix of owner.Just like you prefixed with PO. when you showed us the query on PO_LINES_ALL. It ensures that you are using the synonym which you showed us.
    Btw. PO_LINES_ALL, could still be a VIEW given your overview of the situation.
    Anyway a filter "NULL IS NOT NULL" is indicative that the optimizer performed something called semantic query optimization (SQO).
    SQO is the process of deducing new predicates based upon a) existing predicates in your query (which there is none), b) added predicates to your query (eg. by a VPD policy function), and c) declared constraints on the tables invovled in your query.
    A typical example of when a "NOT is NOT NULL" predicate will show up is when for instance in the EMP table there is a declared constraint on EMPNO like this:
    check(EMPNO > 0)And your query would hold a predicate that is inconsistent with the constraint, for instance like this:
    select *
    from EMP
    where EMPNO <= 0Oracle will deduce that EMPNO cannot be both greater than zero (constraint) as well as smaller than or equal to zero (your query predicate), and will transform the query into:
    select *
    from EMP
    where EMPNO <= 0
      and NULL is NOT NULLThus preventing accessing the EMP table all together, and immediately returning this query with no data found.
    Edited by: Toon Koppelaars on Mar 15, 2010 7:17 AM

  • What is the difference between "= NULL" and "IS NULL" in SQL?

    Hi,
    I believe there is a difference between "= NULL" and "IS NULL" comparsion, but I couldn't find it. Anyone knows the difference?
    Thanks,
    Denny

    Aha, thanks:
    SQL> create table william_test_tab (col binary_double);
    Table created.
    SQL> insert into william_test_tab
      2  select rownum / (rownum - 1) from user_tables where rownum < 4;
    select rownum / (rownum - 1) from user_tables where rownum < 4
    ERROR at line 2:
    ORA-01476: divisor is equal to zero
    SQL> insert into william_test_tab
      2  select 1d * rownum / (rownum - 1) from user_tables where rownum < 4;
    3 rows created.
    SQL> select * from william_test_tab;
           COL
           Inf
      2.0E+000
      1.5E+000
    3 rows selected.
    SQL> select * from william_test_tab where col is infinite;
           COL
           Inf
    1 row selected.
    SQL>

  • Planned order creation with PDS valid on only order start date and not finish date

    Hi All,
    We have requirement to allow creation of planned order manually if production version is valid on order start date and not finish date.  This is because lead time of order is longer. I refered OSS notes 385602. I could find out solution for this is implementation of OSS note 694140 to change validity mode at activity level to consider start date of first produce activity  in validity interval. Problem is even If I create order in APO by implementiong this note planned order is not transfered to ECC and it gets stuck with error production version not valid.
    Is there any way in ECC to control this? Any config or customization?
    Regards,
    Santosh

    Nilesh,
    I think there is a simple procedural skip happening in your business process. You are right when a planned order is created after MRP it would default assign it to the first available production version. 2options available for us,
    1. First use transaction MF50 and do the line loading and assign the quantites to the production versions/Production lines, so that the actual capacity planning is getting completed. This way you can have planned orders with both the production versions and matching to your actual line capacity.
    2. Use Quota arrangement concept, to automatically split the Planned orders during MRP for a percentage based on individual production versions.
    Now when backflush is performed S225 table is updated and Planned order qty also gets reduced.
    Hope this helps....
    Regards,
    Prasobh

Maybe you are looking for

  • Consume a WebService that exists in SAP ECC 6.0

    Hello evrybody, I have a requirement that I've never done before, I have a webservice in transaction WSADMIN in a SAP ECC 6.0, and I need to consume it from PI but I don't know how, I've worked before with BAPI's and ABAP Proxies but never with WebSe

  • VGA Splitter issue

    Hi there, new to this forum and am after some guidance. .. I have recently purchased a Mac Mini and wanted to connect it to two displays, one standard monitor and one LCD TV in the next room via a 5m VGA cable. I purchased a powered VGA splitter and

  • How to transfer Customers to APO based on selection criteria of Division

    Hello, We have to transfer Customer Master specific to one business unit to APO and we don't want to transnfer the Customers of another business units. The differentiation of customers is done at a Distribution Channel & Division level. But we don't

  • SSMS hanging and no exception out

    Hi, we installed SQL 2005 Cluster with Active/Passive, all went smooth. Later we tried to connect the database through SSMS but failed to connect from one site and able to connect from other site. It's not failing, when click connect its tryring to c

  • Hunt group in CUCDM is ringing first extension in list when set to broadcast?

    I'm working with CUCDM 8.1.3+er1. We have a Hunt Group setup that rings 4 extensions through broadcast. Each of these 4 users have each others line appearances on their phones too. Hunt Group example: 0 - User1 1 - User2 2 - User3 3 - User4 Problem i