IS NOT NULL and performance

I have a performance issue with a query - it would be something like -
select col1,col2, sum(col3), get_val(col_4)
from table1
where
get_val(col_4) is not null
group by col1,col2, get_val(col_4)
I have simplified this but it is something similar. This works great - performance is great. Now I commented out the where clause as I needed to populate null values - and that's it the query does not retrieve the resultset - it keeps running forever. With the where clause it comes back in 60 seconds. There is only one row out of 560 rows that has null value for col_4 which i need to display.
Any help is appreciated.

The only difference I notice between the two sqls is HASH(UNIQUE) -
with IS NOT NULL in where clause -
SELECT STATEMENT     ALL_ROWS     1598     1     209
HASH(UNIQUE)          1598     1     209
HASH(GROUP BY)          1598     1     209
When is not null is removed from the where clause -
SELECT STATEMENT     ALL_ROWS     1598     1     206
HASH(GROUP BY)          1598     1     206          
I'm guessing that the index is being used in the first scenario and not in the second. Any idea/suggestion as to how to over come this?          
Thanks

Similar Messages

  • Default Value , Not Null and EJB2.1

    Hi ,
    Am using Weblogic10.3 + Oracle Db + EJB2.1 Local Entity Beans .
    The issue is that one of the table has createdDt which is not null and is defualt is set to Sysdate. When I try to create this Entity with createdDt null , I get an exception like below , But since I have mentioned default value , I shouldnt be getting this. Have I missed something ?
    Code is quite straighforward
    Organisation org = organisationHome.create();
    ....org.setter methods..
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01400: cannot insert NULL into ("XXX"."ORGANISATION_T"."CREATEDDT_F")
    ErrorCode=1400 SQLState=23000
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01400: cannot insert NULL into ("XXX"."ORGANISATION_T"."CREATEDDT_F")
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbcspy.SpyPreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:159)
         at weblogic.ejb.container.manager.BaseEntityManager.executeInsertStmt(BaseEntityManager.java:763)
         at weblogic.ejb.container.internal.TxManager$TxListener.executeInsert(TxManager.java:900)
         at weblogic.ejb.container.internal.TxManager$TxListener.executeDBOperations(TxManager.java:831)
         at weblogic.ejb.container.internal.TxManager$TxListener.beforeCompletion(TxManager.java:1054)
         at weblogic.transaction.internal.ServerSCInfo.doBeforeCompletion(ServerSCInfo.java:1217)
         at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1195)
         at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:118)
         at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1302)
         at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:2114)
         at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:263)
         at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:230)
         at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemoteObject.java:621)
         at weblogic.ejb.container.internal.StatelessRemoteObject.postInvoke1(StatelessRemoteObject.java:60)
         at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(BaseRemoteObject.java:441)
         at com.tieto.tix.core.domain.DomainServices_7p8lqs_EOImpl.createOrganisation(DomainServices_7p8lqs_EOImpl.java:7717)
         at com.tieto.tix.core.domain.DomainServices_7p8lqs_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    parmTest( , "param2") is syntactically incorrect, so there can be no "workaround".
    In addition to solutions offered by SwapnilVJ and Saransoft84, you could also use a rest parameter:
    function parmTest(... args)
    // set up default values
    var val1:Boolean=true;
    var val2:String="";
    switch(args.length)
      case 0:break;
      case 1:
       if(args[0] is String){val2=args[0] as String;}
       else{val1=args[0] as Boolean;}
       break;
      case 2:
      default:
       val1=args[0] as Boolean;
       val2=args[1] as String;
       break;
       trace(val1 + " " +val2);
    parmTest();
    parmTest("hello");
    parmTest(null,"hello");
    parmTest("hello",null);

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Difference between Not Null and Null..

    Hi All,
    In Conditional Region portion i would like to know the difference between
    Value of item in Expression 1 is not null and we will assign the text filed name in expression.
    Value of item in Expression 1 is null
    When we have use the above two scenerio's ..
    Not null means what it has some value in text filed or not.
    pls help me out.
    Anoo..

    Hello Anoo,
    Validations check the input and will return an error message if the validation is not met (like 'Field is required').
    Conditions can be used to run a Process (or render an item) when some condition is met - or not- (like do this only when field is not null).
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Is there a way that i can downgrade my iOS 7.1 on my iPhone 4 to iOS 6xx? battery life not good, and performance isn't better than iOS 6.. Please apple i am really disappointed with iOS 7 on my iPhone 4

    Is there a way that i can downgrade my iOS 7.1 on my iPhone 4 to iOS 6xx? battery life not good, and performance isn't better than iOS 6.. Please apple i am really disappointed with iOS 7 on my iPhone 4, it can runs great on iPhone above 4 such as 5/5s/etc.. iPhone 4 just good with iOS 6...

    No.

  • Not null and enable or disable  column in tabular form

    Hi,
    Using apex version 4.1 and working on tabular form.
    ACT_COA_SEGMENT_MAS is Master table
    and
    ACT_SEGMENT_VALUES_MAS is detail table
    I have entered 8 rows in master table and PARENT_SEGMENT_ID is column in master table which is null able. If i specified PARENT_SEGMENT_ID with value in master table then in detail table there is column PARENT_ID that should not be null and enable.
    How i can enable or disable column when in master table PARENT_SEGMENT_ID column is null then in detail table PARENT_ID column should disable and vice versa.
    I have created tabular form on Detail table. before insert into the tabular form Check in master table in first entry if PARENT_SEGMENT_ID is not null in first row of master table then in tabular form PARENT_ID should enable and not null able in corresponding to this first row id's lines in tabular form.
    Same should check for second row in master table if PARENT_SEGMENT_ID is not null then entered rows with PARENT_ID into tabular form corresponding to 2nd id in master table should not nullable and column should enable in tabular form.
    Thanks & Regards
    Vedant
    Edited by: Vedant on Jan 9, 2013 9:12 PM

    Vedant,
    You need to create you own manual tabular form and not use the wizard.
    Using APEX_ITEM api you should be build you own form and you will be able to control how you wan to display the rows. (See Link [Apex Item Help|http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CACEEEJE] )
    select case when PRIMARY_TABLE_COLUMN is null then APEX_ITEM.DISPLAY_AND_SAVE(3 , DETAIL_COLUMN ) else APEX_ITEM.TEXT(2,detail_column) end "ALIAS" from detail table
    Hope that help.
    Vivek

  • Is not null and null join

    Hi, I am trying to properly display a list of tasks for a project however without a join to the project number (which I was aware of) and the employee table, I get over 500 results.
    The task can be created without a employee assigned to it so therefore the page does not require the field to be filled in.
    Here is the SQL code, any does anyone have any ideas?
    select
        pd.pk_proj_detail_id    "Task Number",
        pd.task_title           "Task Title",
        pd.DETAIL_STATUS        "Task Status",
        pm.name                 "Associated Project",
        pps.last_name||', '||pps.first_name||', '||pps.middle_initial||'.' "Assigned Employee",
        pd.TRACKIT_NUMBER       "TrackIt! Number",
        pd.CREATEBY_DATE        "Date Entered",
        pd.DATE_BEGIN           "Date Began",
        pd.ESTIMATED_DATE       "Estimated Completion Date",
        pd.DATE_END             "Date Completed"
    from
        PROTRAC_DETAIL pd,
        protrac_master pm,
        cobr.vw_pps_payroll pps,
        resources r
    where
        pd.fk_proj_master_id = pm.PK_PROJ_MASTER_ID
        and r.fk_master_id = pm.PK_PROJ_MASTER_ID
        and (r.emp_id = pps.emple_no
            or r.emp_id is null)

    It's 10g r2 with Application Express 3.1.0.00.32
    This is the tasks (detail) table
    ALTER TABLE PROTRAC_DETAIL
    DROP PRIMARY KEY CASCADE;
    DROP TABLE PROTRAC_DETAIL CASCADE CONSTRAINTS;
    CREATE TABLE PROTRAC_DETAIL
      PK_PROJ_DETAIL_ID      NUMBER                 NOT NULL,
      FK_PROJ_MASTER_ID      NUMBER,
      TRACKIT_NUMBER         NUMBER,
      DETAIL_DESCRIPTION     VARCHAR2(4000 CHAR),
      DETAIL_STATUS          VARCHAR2(19 CHAR),
      DETAIL_STATUS_COMMENT  VARCHAR2(4000 CHAR),
      DATE_BEGIN             DATE,
      DATE_END               DATE,
      ESTIMATED_DATE         DATE,
      CREATEBY_DATE          DATE,
      CREATEBY_USER          VARCHAR2(50 CHAR),
      LASTMOD_DATE           DATE,
      LASTMOD_USER           VARCHAR2(50 CHAR),
      TASK_TITLE             VARCHAR2(100 CHAR)
    TABLESPACE DEVPROTRAC_DATA
    PCTUSED    0
    PCTFREE    10
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    CREATE UNIQUE INDEX PROTRAC_DETAIL_PK ON PROTRAC_DETAIL
    (PK_PROJ_DETAIL_ID)
    TABLESPACE DEVPROTRAC_DATA
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    CREATE OR REPLACE TRIGGER BUI_PROTRAC_DETAIL
    before insert or update
    on PROTRAC_DETAIL
    referencing new as New old as Old
    for each row
    begin
        if inserting then
            select users_seq.nextval, sysdate, apex_application.g_user
                into :new.pk_proj_detail_id, :new.createby_date, :new.createby_user
                from dual;
        elsif updating then
            select sysdate, apex_application.g_user
                into :new.lastmod_date, :new.lastmod_user
                from dual;
        end if;
    end;
    SHOW ERRORS;
    ALTER TABLE PROTRAC_DETAIL ADD (
      CONSTRAINT PROTRAC_DETAIL_PK
    PRIMARY KEY
    (PK_PROJ_DETAIL_ID)
        USING INDEX
        TABLESPACE DEVPROTRAC_DATA
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    MINEXTENTS       1
                    MAXEXTENTS       2147483645
                    PCTINCREASE      0
    ALTER TABLE PROTRAC_DETAIL ADD (
      CONSTRAINT PROTRAC_DETAIL_NUM
    FOREIGN KEY (FK_PROJ_MASTER_ID)
    REFERENCES PROTRAC_MASTER (PK_PROJ_MASTER_ID));
    ALTER TABLE DEVPROTRAC.RESOURCES ADD (
      FOREIGN KEY (FK_DETAIL_ID)
    REFERENCES DEVPROTRAC.PROTRAC_DETAIL (PK_PROJ_DETAIL_ID));
    SET DEFINE OFF;
    Insert into PROTRAC_DETAIL
       (PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
        DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
        CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
    Values
       (34, 24, NULL, 'test', 'Queued',
        NULL, NULL, NULL, NULL, TO_DATE('10/30/2008 13:37:01', 'MM/DD/YYYY HH24:MI:SS'),
        'LREDMOND', TO_DATE('11/03/2008 15:19:35', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'bananana');
    Insert into PROTRAC_DETAIL
       (PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
        DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
        CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
    Values
       (41, 40, NULL, '2354234', 'Queued',
        NULL, NULL, NULL, NULL, TO_DATE('10/31/2008 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        'LREDMOND', TO_DATE('11/03/2008 13:52:02', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', 'I can type on the keyboarddf');
    Insert into PROTRAC_DETAIL
       (PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
        DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
        CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
    Values
       (49, 32, 78888, 'one day fishsticks will walk on the moon.', 'Queued',
        'waiting for fishsticks.', NULL, NULL, NULL, TO_DATE('11/03/2008 11:28:11', 'MM/DD/YYYY HH24:MI:SS'),
        'LREDMOND', NULL, NULL, 'Fix the keyboard');
    Insert into PROTRAC_DETAIL
       (PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
        DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
        CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
    Values
       (50, 38, NULL, 'dfdfdfdfdfdfdfdfdf', 'Queued',
        NULL, NULL, NULL, NULL, TO_DATE('11/03/2008 12:03:06', 'MM/DD/YYYY HH24:MI:SS'),
        'LREDMOND', TO_DATE('11/03/2008 15:19:44', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'resreeeeeeeeee');
    Insert into PROTRAC_DETAIL
       (PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
        DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
        CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
    Values
       (33, 31, NULL, 'Make sure the bananas are fresh', 'Queued',
        NULL, NULL, NULL, NULL, TO_DATE('10/29/2008 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        'LREDMOND', TO_DATE('11/03/2008 15:19:52', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'e543563465');
    Insert into PROTRAC_DETAIL
       (PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
        DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
        CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
    Values
       (48, 37, NULL, 'guitar heros! yay', 'Queued',
        NULL, NULL, NULL, NULL, TO_DATE('11/03/2008 11:26:06', 'MM/DD/YYYY HH24:MI:SS'),
        'LREDMOND', TO_DATE('11/03/2008 15:19:57', 'MM/DD/YYYY HH24:MI:SS'), NULL, '34444444444444543etfg');
    COMMIT;This is for the resources table:
    ALTER TABLE RESOURCES
    DROP PRIMARY KEY CASCADE;
    DROP TABLE RESOURCES CASCADE CONSTRAINTS;
    CREATE TABLE RESOURCES
      PK_RESOURCES_ID   NUMBER,
      FK_DETAIL_ID      NUMBER,
      EMP_ID            NUMBER,
      RESOURCE_STATUS   VARCHAR2(8 CHAR),
      RESOURCE_COMMENT  VARCHAR2(4000 CHAR),
      CREATEBY_DATE     DATE,
      CREATEBY_USER     VARCHAR2(50 CHAR),
      LASTMOD_DATE      DATE,
      LASTMOD_USER      VARCHAR2(50 CHAR),
      FK_MASTER_ID      NUMBER
    TABLESPACE DEVPROTRAC_DATA
    PCTUSED    0
    PCTFREE    10
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    CREATE UNIQUE INDEX RESOURCES_PK ON RESOURCES
    (PK_RESOURCES_ID)
    TABLESPACE DEVPROTRAC_DATA
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    CREATE OR REPLACE TRIGGER BUI_RESOURCES
    before insert or update
    on RESOURCES
    referencing new as New old as Old
    for each row
    begin
        if inserting then
            select users_seq.nextval, sysdate, apex_application.g_user
                into :new.pk_resources_id, :new.createby_date, :new.createby_user
                from dual;
        elsif updating then
            select sysdate, apex_application.g_user
                into :new.lastmod_date, :new.lastmod_user
                from dual;
        end if;
    end;
    SHOW ERRORS;
    ALTER TABLE RESOURCES ADD (
      CONSTRAINT RESOURCES_PK
    PRIMARY KEY
    (PK_RESOURCES_ID)
        USING INDEX
        TABLESPACE DEVPROTRAC_DATA
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    MINEXTENTS       1
                    MAXEXTENTS       2147483645
                    PCTINCREASE      0
    ALTER TABLE RESOURCES ADD (
      FOREIGN KEY (FK_DETAIL_ID)
    REFERENCES PROTRAC_DETAIL (PK_PROJ_DETAIL_ID),
      FOREIGN KEY (FK_MASTER_ID)
    REFERENCES PROTRAC_MASTER (PK_PROJ_MASTER_ID));
    SET DEFINE OFF;
    Insert into RESOURCES
       (PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
        CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
    Values
       (53, 50, 356654, 'Active', NULL,
        TO_DATE('11/04/2008 09:32:06', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', NULL, NULL, NULL);
    Insert into RESOURCES
       (PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
        CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
    Values
       (51, 41, 447250, 'Active', 'No Sure.',
        TO_DATE('11/03/2008 14:23:11', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('11/04/2008 09:00:04', 'MM/DD/YYYY HH24:MI:SS'), NULL, 40);
    Insert into RESOURCES
       (PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
        CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
    Values
       (54, 50, 323829, 'Active', NULL,
        TO_DATE('11/04/2008 10:26:08', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', NULL, NULL, 38);
    Insert into RESOURCES
       (PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
        CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
    Values
       (52, 33, 8915, 'Active', 'get to work',
        TO_DATE('11/03/2008 15:20:18', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', TO_DATE('11/03/2008 15:35:10', 'MM/DD/YYYY HH24:MI:SS'), NULL, NULL);
    COMMIT;The results I want is everything above regardless of emp_id assigned (if any). Without the r.emp_id = pps.emple_no join, the query will generate 234234239482304234 results.
    Hope this helps.
    Edited by: leland on Nov 4, 2008 12:56 PM

  • Get list of Not Null and PK Columns

    hi All,
    I need to get the list of all the columns which are part of PK and not null, can you help me on this?
    with the below query I am getting the not null ones but need to get the PK columns  also
    SqlServer Version is 2008R2
    SELECT TABLE_CATALOG AS Database_Name, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, IS_NULLABLE
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_SCHEMA = 'Express'
    AND IS_NULLABLE = 'NO'
    Thanks!
    Neil

    Give this a go. It includes by bitval solver function, as the status column is stored that way.
    CREATE FUNCTION dbo.solveBitVal(@val BIGINT)
    RETURNS @result TABLE (id INT, bitvalue BIGINT)
    BEGIN
    DECLARE @bitTranslate TABLE (id INT, bitvalue BIGINT)
    DECLARE @numbah TABLE (num INT)
    DECLARE @loopah INT
    SET @loopah = 1
    WHILE @loopah <= 63
    BEGIN
    INSERT INTO @bitTranslate (id, bitvalue) VALUES (@loopah, POWER(CAST(2 AS BIGINT),@loopah-1))
    INSERT INTO @numbah (num) VALUES (@loopah)
    SET @loopah = @loopah + 1
    END
    WHILE @val > 0
    BEGIN
    INSERT INTO @result
    SELECT MAX(id), MAX(bitvalue) FROM @bitTranslate WHERE bitvalue <= @val
    SELECT @val = @val - MAX(bitvalue) FROM @bitTranslate WHERE bitvalue <= @val
    END
    RETURN
    END
    GO
    ;WITH cons AS (
    SELECT o.name, c.*, b.id AS statusID, ROW_NUMBER() OVER (PARTITION BY c.id, colid ORDER BY b.id) AS seq
    FROM sys.sysconstraints c
    INNER JOIN sys.objects o
    ON c.id = o.object_id
    CROSS APPLY dbo.solveBitVal(c.status) b
    ), rCTE AS (
    SELECT c.name, c.constid, c.id, c.colid, c.spare1, c.status, c.actions, c.error, CAST(CASE WHEN statusID = 1 THEN 'PRIMARY KEY constraint '
    WHEN statusID = 2 THEN 'UNIQUE KEY constraint '
    WHEN statusID = 3 THEN 'FOREIGN KEY constraint '
    WHEN statusID = 4 THEN 'CHECK constraint '
    WHEN statusID = 5 THEN 'DEFAULT constraint '
    WHEN statusID = 16 THEN 'Column-level constraint'
    WHEN statusID = 32 THEN 'Table-level constraint '
    END AS NVARCHAR(MAX)) AS statusName, c.seq, c.statusID
    FROM cons c
    WHERE seq = 1
    UNION ALL
    SELECT c.name, c.constid, c.id, c.colid, c.spare1, c.status, c.actions, c.error, CAST(r.statusName + ', ' + CASE WHEN c.statusID = 1 THEN 'PRIMARY KEY constraint '
    WHEN c.statusID = 2 THEN 'UNIQUE KEY constraint '
    WHEN c.statusID = 3 THEN 'FOREIGN KEY constraint '
    WHEN c.statusID = 4 THEN 'CHECK constraint '
    WHEN c.statusID = 5 THEN 'DEFAULT constraint '
    WHEN c.statusID = 16 THEN 'Column-level constraint'
    WHEN c.statusID = 32 THEN 'Table-level constraint '
    END AS NVARCHAR(MAX)), c.seq, c.statusID
    FROM cons c
    INNER JOIN rCTE r
    ON c.id = r.id
    AND c.colid = r.colid
    AND c.seq - 1 = r.seq
    SELECT *
    FROM rCTE
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • DB Diagram: Modality Difference between NOT NULL and check constraint

    Hi,
    I am using jdev 11g (11.1.1.10) I am trying to create a db diagram from two tables. I have a FK that is NOT NULL (defined on the column). When i try to display these two tables modality, it does not show up in the diagram. I noticed that there are two ways NOT null can be defined on a table (right click on the db object to edit it; a) under column definitions there is a check box for not null, b) there is a check constraint that one can add to do not null.
    I am confused and was wondering whether I must I have check constraints on the database in order to display modality (optional versus mandatory). Logically speaking it does not make any sense though.

    Hi Susan,
    Thanks for your email. I understand that in order to show modality under
    UML notation, one must define a COLUMN being NOT NULL instead of defining a check constraint.
    I still do not understand how modality (optional versus mandatory) is shown in ERD notation in JDev. I tried flipping ERD/UML notations and made sure icons for tables were showing, but no MODALITY is shown in ERD notation ( an '0" icon or a "|" icon for optional and mandatory). Is it the solid line versus dotted line in the ERD diagram? I am confused because generally under Crawfoot ERD notation '0" icon or a "|" icon is shown for modality.
    Modality gets picked up in jdev diagram when COLUMN not null is specified and UML notation is used
    ALTER TABLE DETAILAJ MODIFY EMPID not null;
    Modality does not get picked up in jdev db diagram when check constraint is specified and UML notation is used
    ALTER TABLE DETAILAJ
    ADD CONSTRAINT CK_NN_DETAILAJ__EMPID CHECK(EMPID IS NOT NULL) ;
    Another question i have related to the matter mentioned above is as follows. Since I want to see modality in db diagram, it follows that I must define a column as not null instead of a check constraint. I must also use NO VALIDATE on NOT NULL column because i have prior data that does not meet the new restriction. I noticed that if i use the following syntax to define a NOT NULL column, two things happen.
    a) A constraint is defined as not null automatically and a system generated name is given to the constraint.
    b) DB diagram in Jdev does not show the modality.
    My question is whether there is a way to see modality in this case.
         alter table DETAILAJ
         MODIFY EMPID NOT NULL ENABLE NOVALIDATE ;
    Edited by: user11219846 on Nov 19, 2009 11:07 AM

  • How To know Which Columns are not null and Which are null

    Hi Freinds,
    I want to Know ,How by Wrting a Query we can get the Names of The Columns from the Table which is set to not-null or null,
    Thanks
    Shoaib

    SELECT * FROM user_tab_columns
    WHERE table_name='Your_Table_Name'Check NULLABLE column.

  • Graphics drivers not starting and performance

    I cannot get the Standard VGA Graphics adapter to start after trying all methods to do so.
    Does this affect the laptop performance?
    The device manager also has Intel HD Graphics 3000 so is this doing all the work?
    Should I be able to see the AMD Radeon HD 7690 MXT ?
    I tried to reinstall the AMD Catalyst driver but got Install package failure. Wouldnt restart but after several attempts it started normally
    Will a clean Windows install fix this?
    Thanks

    Hi:
    It is possible that reinstalling windows may fix the issue.
    The most important thing to know is that you should only install the AMD graphics driver for your model which installs the drivers for both the amd and intel gpu's.  The one on your notebook's support page, not from AMD.
    If you install the standalone Intel graphics driver or allow any update program to install an updated Intel graphics driver, your AMD GPU will no longer function.
    The AMD graphics driver from your notebook's support page is the only one you should ever install.
    Before installing the graphics driver, always install the Intel chipset installation utility first and reboot.

  • Trying to return query dynamically if parameter value is not null and null

    Hi,
    I wrote a custom code like this....
    Public Shared Function GETSQL(ByVal month as Date, ByVal year as Date, ByVal partyCode as Integer)
    Dim sql1 As String
    Dim sql2 As String
    Dim sql3 As String
    Dim sql4 As String
    If (IsNothing(partyCode)) Then
    sql1 = " select " & vbCrLf
    sql3 = " where " & vbCrLf
    sql3 = sql3 & " Month(SaleHDR.Date)=month " & vbCrLf
    sql3 = sql3 & " and year(SaleHDR.Date)=year " & vbCrLf
    sql4 = " GROUP BY Month(SaleHDR.Date), " & vbCrLf
    sql4 = sql4 & " YEAR(SaleHDR.Date), " & vbCrLf
    sql4 = sql4 & " DAY(SaleHDR.Date), " & vbCrLf
    sql4 = sql4 & " ProductGroup.ProductGroupCode " & vbCrLf
    Else
    sql1 = " select " & vbCrLf
    sql3 = " where " & vbCrLf
    sql3 = sql3 & " Month(SaleHDR.Date)=month " & vbCrLf
    sql3 = sql3 & " and year(SaleHDR.Date)=year " & vbCrLf
    sql3 = sql3 & " and Party.PartyCode=partyCode " & vbCrLf
    sql4 = " GROUP BY Month(SaleHDR.Date), " & vbCrLf
    sql4 = sql4 & " YEAR(SaleHDR.Date), " & vbCrLf
    sql4 = sql4 & " DAY(SaleHDR.Date), " & vbCrLf
    sql4 = sql4 & " ProductGroup.ProductGroupCode " & vbCrLf
    End If
    sql2 = " Month(SaleHDR.Date) as Month, " & vbCrLf
    sql2 = sql2 & " YEAR(SaleHDR.Date)as Year, " & vbCrLf
    sql2 = sql2 & " DAY(SaleHDR.Date) as Day, " & vbCrLf
    sql2 = sql2 & " ProductGroup.ProductGroupCode, " & vbCrLf
    sql2 = sql2 & " SUM(ISNULL(SaleDTL.ProductRate,0)*isnull(SaleDTL.ProductQuantity,0)) as SalesAmount " & vbCrLf
    sql2 = sql2 & " from " & vbCrLf
    sql2 = sql2 & "  SaleDTL " & vbCrLf
    sql2 = sql2 & "  inner Join " & vbCrLf
    sql2 = sql2 & " SaleHDR " & vbCrLf
    sql2 = sql2 & "  ON SaleDTL.Id = SaleHDR.id " & vbCrLf
    sql2 = sql2 & "  inner Join " & vbCrLf
    sql2 = sql2 & "  ProductMaster " & vbCrLf
    sql2 = sql2 & "  ON SaleDTL.ProductId = ProductMaster.ProductID " & vbCrLf
    sql2 = sql2 & "  inner Join" & vbCrLf
    sql2 = sql2 & "  ProductGroup " & vbCrLf
    sql2 = sql2 & "  ON ProductMaster.ProductGroupId = ProductGroup.ProductGroupID " & vbCrLf
    sql2 = sql2 & "  inner Join " & vbCrLf
    sql2 = sql2 & "  Party " & vbCrLf
    sql2 = sql2 & "  ON SaleHDR.PartyId = Party.PartyID " & vbCrLf
    GETSQL = sql1 & sql2 & sql3 & sql4
    End Function
    to use in my project report. I'm just trying to combine two reports(first one without partycode condition, second with a party code condition) into one report by using above custom code.
    then i use this as a query expression in a dataset: Code.GETSQL(Parameters!Month.Value,Parameters!Year.Value,Parameters!PartyCode.Value)
    but when i try to preview the report i'm getting a error saying:
    Cannot set the command text for dataset 'DataSet1'
    Error during processing of the command text expression of dataset 'DataSet1'.
    Can anyone help me here Please!!!
    Very much appreciated if anyone can guide me if there is a other way around.
    Thank you!!

    I think you just need to do this as a SQL query in your data source, and use the condition:
    WHERE (Party.PartyCode = @pPartyCode or @pPartyCode is null)
    I rewrote your vb as t-sql here:
    (if you're using this as a data source, remove the first line where the parameters are declared, as SSRS will create the parameters for you)
    declare @pMonth int, @pYear int, @pPartyCode nvarchar(20)
    select
    month(SaleHDR.[Date]) as [Month],
    year(SaleHDR.[Date]) as [Year],
    day(SaleHDR.[Date]) as [Day],
    ProductGroup.ProductGroupCode,
    SUM(ISNULL(SaleDTL.ProductRate,0)*isnull(SaleDTL.ProductQuantity,0)) as SalesAmount
    from SaleDTL
    inner join SaleHDR ON SaleDTL.Id = SaleHDR.id
    inner join ProductMaster ON SaleDTL.ProductId = ProductMaster.ProductID
    inner join ProductGroup ON ProductMaster.ProductGroupId = ProductGroup.ProductGroupID
    inner join Party ON SaleHDR.PartyId = Party.PartyID
    where
    Month(SaleHDR.[Date])= @pMonth
    and year(SaleHDR.[Date])= @pYear
    and (Party.PartyCode= @pPartyCode or @pPartyCode is null)
    group by month(SaleHDR.[Date]),
    year (SaleHDR.[Date]),
    day (SaleHDR.[Date]),
    ProductGroup.ProductGroupCode

  • When the about:config setting for swipe are changed to allow changing tabs with swipe it does not repond and performs the default back and forward in browsing history action on the selected window instead of switching tabs. How do I get it to work?

    In about:config, the values I changed to for the preference name browser.gesture.swipe.left was Browser:PrevTab and for browser.gesture.swipe.right was Browser:NextTab.
    I have the latest synaptics touch pad on my laptop and it supports three touch swipe on windows pcs and on firefox. The about:config setting seem to be specific for MACs and so does not responds to windows changes.

    Hi,
    I suggest you try the steps in this thread for test:
    Disable Suggested Sites does not work.
    http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/disable-suggested-sites-does-not-work/4ba064b1-1c6e-43f1-939e-2db1d335b2ef
    Regards,
    Vincent Wang
    TechNet Community Support

  • 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

  • Bloom filter and performance

    I have the following query:
    SELECT 
                    obst.obst_id obstructionId
                   ,oost.comment_clob CommentClob
                   ,chp1.ptcar_no StartPtcar
                   ,chp2.ptcar_no EndPtcar
                   ,oost.track_code Track
                   ,oost.start_date StartPeriod
                   ,oost.end_date EndPeriod
                   ,oost.doc_no RelaasId
                   ,obst.status_code Status
            FROM   T1 obst
                 , T2 oost
                 , T3 chp1
                 , T3 chp2
              where obst.oost_id      = oost.oost_id
              and oost.chp_id_start = chp1.chp_id
              and oost.chp_id_end   = chp2.chp_id
              and obst.obs_stat     = 2
       and add_months(obst.mod_date,13) >= :ld_curr_date
       and oost.start_date between :ld_from_date and :ld_to_date         
              and exists (select 1
                            from T4  obsv
                               , T5  veh
                            where  obsv.veh_id = veh.veh_id
                            and (:ln_opr_id is null
                                   OR veh.opr_id = :ln_opr_id)
                            and  obsv.obst_id = obst.obst_id
                            and  veh.ac_number between :ln_min_number and :ln_max_number
                            and  obsv.start_date > obst.start_date
             order by obst.obst_id;
    Giving the following execution plan where a bloom filter has been used.
    | Id  | Operation                           | Name                    | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   0 | SELECT STATEMENT                    |                         |      1 |        |     10 |00:02:13.09 |     128K|  94376 |
    |   1 |  SORT ORDER BY                      |                         |      1 |      8 |     10 |00:02:13.09 |     128K|  94376 |
    |   2 |   NESTED LOOPS                      |                         |      1 |        |     10 |00:02:13.06 |     128K|  94376 |
    |   3 |    NESTED LOOPS                     |                         |      1 |      8 |     10 |00:02:13.06 |     128K|  94376 |
    |   4 |     NESTED LOOPS                    |                         |      1 |      8 |     10 |00:02:13.06 |     128K|  94376 |
    |*  5 |      HASH JOIN SEMI                 |                         |      1 |      8 |     10 |00:02:13.06 |     128K|  94376 |
    |   6 |       JOIN FILTER CREATE            | :BF0000                 |      1 |        |   1469 |00:00:02.06 |   12430 |     76 |
    |   7 |        NESTED LOOPS                 |                         |      1 |        |   1469 |00:00:00.17 |   12430 |     76 |
    |   8 |         NESTED LOOPS                |                         |      1 |    307 |   5522 |00:00:00.11 |   10545 |     52 |
    |*  9 |          TABLE ACCESS BY INDEX ROWID| T2                      |      1 |    316 |   5522 |00:00:00.07 |    3383 |     46 |
    |* 10 |           INDEX RANGE SCAN          | T2_OOST_START_DATE_I    |      1 |   1033 |   8543 |00:00:00.03 |      33 |      3 |
    |* 11 |          INDEX RANGE SCAN           | T1_OBST_OOST_DK_I       |   5522 |      1 |   5522 |00:00:00.08 |    7162 |      6 |
    |* 12 |         TABLE ACCESS BY INDEX ROWID | T1                      |   5522 |      1 |   1469 |00:00:00.13 |    1885 |     24 |
    |  13 |       VIEW                          | VW_SQ_1                 |      1 |  64027 |   1405 |00:00:07.82 |     115K|  94300 |
    |* 14 |        FILTER                       |                         |      1 |        |   1405 |00:00:07.82 |     115K|  94300 |
    |  15 |         JOIN FILTER USE             | :BF0000                 |      1 |  64027 |   1405 |00:00:07.82 |     115K|  94300 |
    |  16 |          PARTITION REFERENCE ALL    |                         |      1 |  64027 |  64027 |00:01:48.22 |     115K|  94300 |
    |* 17 |           HASH JOIN                 |                         |     52 |  64027 |  64027 |00:02:03.37 |     115K|  94300 |
    |  18 |            TABLE ACCESS FULL        | T4                      |     52 |  64027 |  64027 |00:00:00.34 |    1408 |    280 |
    |* 19 |            TABLE ACCESS FULL        | T5                      |     41 |    569K|   5555K|00:02:08.32 |     114K|  94020 |
    |  20 |      TABLE ACCESS BY INDEX ROWID    | T3                      |     10 |      1 |     10 |00:00:00.01 |      22 |      0 |
    |* 21 |       INDEX UNIQUE SCAN             | T3_CHP_PK               |     10 |      1 |     10 |00:00:00.01 |      12 |      0 |
    |* 22 |     INDEX UNIQUE SCAN               | T3_CHP_PK               |     10 |      1 |     10 |00:00:00.01 |      12 |      0 |
    |  23 |    TABLE ACCESS BY INDEX ROWID      | T3                      |     10 |      1 |     10 |00:00:00.01 |      10 |      0 |
    Predicate Information (identified by operation id):
       5 - access("ITEM_1"="OBST"."OBST_ID")
           filter("ITEM_2">"OBST"."START_DATE")
       9 - filter(("OOST"."CHP_ID_START" IS NOT NULL AND "OOST"."CHP_ID_END" IS NOT NULL))
      10 - access("OOST"."START_DATE">=:LD_FROM_DATE AND "OOST"."START_DATE"<=:LD_TO_DATE)
      11 - access("OBST"."OOST_ID"="OOST"."OOST_ID")
      12 - filter(("OBST"."OBS_STAT"=2 AND ADD_MONTHS(INTERNAL_FUNCTION("OBST"."MOD_DATE"),13)>=:LD_CURR_DATE))
      14 - filter((:LN_MIN_ac_number<=:ln_max_number AND TO_DATE(:LD_FROM_DATE)<=TO_DATE(:LD_TO_DATE)))
      17 - access("OBSV"."VEH_ID"="VEH"."VEH_ID")
      19 - filter(((:LN_OPR_ID IS NULL OR "VEH"."OPR_ID"=:LN_OPR_ID) AND "VEH"."ac_number">=:LN_MIN_ac_number AND
                  "VEH"."ac_number"<=:ln_max_number))
      21 - access("OOST"."CHP_ID_START"="CHP1"."CHP_ID")
      22 - access("OOST"."CHP_ID_END"="CHP2"."CHP_ID")
    This query completes in a not acceptable response time of more than 2 minutes and this is why it has been handled to me for possible improvement.
    As you might have already pointed it out from the above execution plan, the operation number 19 is the most time consuming operation (TABLE ACCESS FULL of T5). The query without the EXISTS part represents our data. This part of the query is very fast. It gives about 1500 rows. However, when we want to limit those 1500 records to only records satisfying the exists clause (10 records), the query starts not performing very well because of this full table scan on T5 (5,5 millions).
    The ideal situation would have been to :
    (a) first join table T5(alias veh) with the table T4(alias obs) using the join condition (predicate 17) limiting the number of record from T5 table
    (b) and then filter from T5 table (predicate 19)
    But in this case the CBO is starting by a costly full scan of the entire T5 table (5,5 millions of rows operation 19) before sending this enormous amount of data to the HASH JOIN operation 17 which finally throw away the majority of T5 rows not satisfying the join condition : access("OBSV"."VEH_ID"="VEH"."VEH_ID")
    I have already verified that the table statistics and their join column statistics are up-to-date and are reflecting the reality. But failed to know how to let the CBO automatically doing what I want it to do i.e. Join first and then filter.
    When I discussed with the client we agreed to re-factor a little bit this query so that it is now completing in few seconds.
    The new plan is not using bloom filter and the veh table is accessed via its unique index on VEH_ID (18 - access("OBSV"."VEH_ID"="VEH"."VEH_ID")) before applying the filter operation. Exactly as I wanted it to be in the original query
    Have you any idea on how to change this join method/order so that the full table scan is post poned? of course without refactoring the query
    Do you think that bloom filter is the culprit here?
    Thanks in advance
    Mohamed Houri
    PS : and  veh.ac_number between :ln_min_number and :ln_max_number
    These two imput parameters are beyound the known low and high value. But even when I used min and max value taken from the table (min = low_value from stats and max = high value from stat), the plan didn't changed

    Jonathan,
    I got the plan I was looking for.
    It is not exactly the same as the execution plan that corresponds to the re-factored query but it is what I wanted to have.
    SELECT  /*+ gather_plan_statistics */
                   obst.obst_id obstructionId
                   ,oost.comment_clob CommentClob
                   ,chp1.ptcar_no StartPtcar
                   ,chp2.ptcar_no EndPtcar
                   ,oost.track_code Track
                   ,oost.start_date StartPeriod
                   ,oost.end_date EndPeriod
                   ,oost.doc_no RelaasId
                   ,obst.status_code Status
            FROM   T1 obst
                 , T2 oost
                 , T3 chp1
                 , T3 chp2
            where obst.oost_id = oost.oost_id
              and oost.chp_id_start = chp1.chp_id
              and oost.chp_id_end = chp2.chp_id
              and obst.obs_stat = 2 -- only reeel       
                    and exists (select /*+ no_unnest push_subq */ 1
                            from T4 obsv
                               , T5 veh
                            where obsv.veh_id = veh.veh_id
                              and (null is null
                                   OR veh.opr_id = null
                              and  obsv.obst_id = obst.obst_id
                              and veh.ac_number between 1 and 99999
                              and obsv.start_date > obst.start_date
              and oost.start_date between to_date ('20/11/2013','DD/MM/YYYY') and to_date ('27/11/2013','DD/MM/YYYY')
              and add_months(obst.mod_date,13) >= sysdate
             order by obst.obst_id
    | Id  | Operation                                 | Name                    | Starts | E-Rows | A-Rows |   A-Time   |
    |   0 | SELECT STATEMENT                          |                         |      1 |        |      6 |00:00:00.56 |
    |   1 |  SORT ORDER BY                            |                         |      1 |    254 |      6 |00:00:00.56 |
    |*  2 |   HASH JOIN                               |                         |      1 |    254 |      6 |00:00:00.11 |
    |   3 |    TABLE ACCESS FULL                      | T3                      |      1 |   2849 |   2849 |00:00:00.01 |
    |*  4 |    HASH JOIN                              |                         |      1 |    254 |      6 |00:00:00.11 |
    |   5 |     TABLE ACCESS FULL                     | T3                      |      1 |   2849 |   2849 |00:00:00.01 |
    |   6 |     NESTED LOOPS                          |                         |      1 |        |      6 |00:00:00.10 |
    |   7 |      NESTED LOOPS                         |                         |      1 |    254 |   5012 |00:00:00.09 |
    |*  8 |       TABLE ACCESS BY INDEX ROWID         | T2                      |      1 |    262 |   5012 |00:00:00.06 |
    |*  9 |        INDEX RANGE SCAN                   | T2_OOST_START_DATE_I    |      1 |    857 |   7722 |00:00:00.01 |
    |* 10 |       INDEX RANGE SCAN                    | T1_OBST_OOST_DK_I       |   5012 |      1 |   5012 |00:00:00.03 |
    |* 11 |      TABLE ACCESS BY INDEX ROWID          | T1                      |   5012 |      1 |      6 |00:00:00.48 |
    |  12 |       NESTED LOOPS                        |                         |   1277 |        |      6 |00:00:00.46 |
    |  13 |        NESTED LOOPS                       |                         |   1277 |      2 |      6 |00:00:00.46 |
    |  14 |         PARTITION REFERENCE ALL           |                         |   1277 |      4 |      6 |00:00:00.46 |
    |* 15 |          TABLE ACCESS BY LOCAL INDEX ROWID| T4                      |  66380 |      4 |      6 |00:00:00.43 |
    |* 16 |           INDEX RANGE SCAN                | T4_OBSV_OBST_FK_I       |  66380 |     86 |      6 |00:00:00.28 |
    |* 17 |         INDEX UNIQUE SCAN                 | T5_VEH_PK               |      6 |      1 |      6 |00:00:00.01 |
    |* 18 |        TABLE ACCESS BY GLOBAL INDEX ROWID | T5                      |      6 |      1 |      6 |00:00:00.01 |
    Predicate Information (identified by operation id):
       2 - access("OOST"."CHP_ID_END"="CHP2"."CHP_ID")
       4 - access("OOST"."CHP_ID_START"="CHP1"."CHP_ID")
       8 - filter(("OOST"."CHP_ID_START" IS NOT NULL AND "OOST"."CHP_ID_END" IS NOT NULL))
       9 - access("OOST"."START_DATE">=TO_DATE(' 2013-11-20 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OOST"."START_DATE"<=TO_DATE(' 2013-11-27
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      10 - access("OBST"."OOST_ID"="OOST"."OOST_ID")
      11 - filter(("OBST"."OBS_STAT"=2 AND ADD_MONTHS(INTERNAL_FUNCTION("OBST"."MOD_DATE"),13)>=SYSDATE@! AND  IS NOT NULL))
      15 - filter("OBSV"."START_DATE">:B1)
      16 - access("OBSV"."OBST_ID"=:B1)
      17 - access("OBSV"."VEH_ID"="VEH"."VEH_ID")
      18 - filter(("VEH"."ac_number">=1 AND "VEH"."ac_number"<=99999))
    Spot how the predicate 17 and 18 are now in the position I wanted them to be i.e probe first the T5 unique index using the join condition and then filter the table T5
    But, there is always a but, why am I obliged to hint?
    Where did I got something wrong (statistics, optimizer parameter, etc...) so that the CBO did not opted for this execution plan without a hint?
    Thanks
    Mohamed Houri

Maybe you are looking for

  • Merged documents openxml mailmerge

    I am a chemistry graduate and very new to programming, having learned everything from the Internet. I have a Word document with mail merge fields. The data source is an Excel file. I want to change the datasource Excel file dynamically and save the t

  • Workitem is not appearng in the user's inbox

    Hi All, In my workflow the workitem is not appearing in the user's inbox. can anyone tell me how can i resolve this? thanks and regards, K.Perumalraj

  • ITunes update v9 on Windows7

    Hi When I started itunes I received an update request for version 9. I accepted and the latest edition was successfully installed. Problem however is that itunes do not start anymore when I click it to execute. I removed iTunes and installed it again

  • Trying to find a file...

    Hi I�m trying to read a file from a JSP page using a Java class. When I pass the folder and the file to the method of the class, I try to verify that exists the Folder and later that exists the file, but I have not any result (the method returns null

  • How to add/ remove softwares in mac

    Hi If any one of you can help me, In adding or removing the softwares in Mac os X. And also, help me about the .dmg / .bin formats. Kindly fwd it to [email protected] Thanks in advance!!