Logical OR (where clause) is not capable of change.

select * from V$version;

BANNER
-------------------------------------------------------
Oracle Database 11g Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss';

create table TestTable(ID,DateCol) as
select 1,date '2011-11-11' from dual union all
select 2,date '2012-07-13' from dual union all
select 3,date '2030-12-31' from dual;

-- FirstSQL
SELECT *
  FROM TestTable
 WHERE sysdate <= DateCol
    OR DateCol = date '2011-11-11';

ID  DateCol
--  -------------------
 3  2030-12-31 00:00:00

-- SecondSQL
SELECT *
  FROM TestTable
 WHERE DateCol = date '2011-11-11'
    OR sysdate <= DateCol;

ID  DateCol
--  -------------------
 1  2011-11-11 00:00:00
 3  2030-12-31 00:00:00

Why return record figures are diff

Logical OR (where clause) must be able to change.

(Ex "Where A or B", "where B or" can change)

I found the logical predicate have diff.

set autot trace

-- FirstSQL
SELECT *
  FROM TestTable
 WHERE sysdate <= DateCol
    OR DateCol = date '2011-11-11';

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter("DATECOL">=SYSDATE@!)

-- SecondSQL
SELECT *
  FROM TestTable
 WHERE DateCol = date '2011-11-11'
    OR sysdate <= DateCol;

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter("DATECOL"=TO_DATE(' 2011-11-11 00:00:00', 'syyyy-mm-dd
              hh24:mi:ss') OR "DATECOL">=SYSDATE@!)

And for 11.2.0.3 as well:

BANNER
-----------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE Production 11.2.0.3.0
AMT for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

5 selected lines.

SQL > drop table testtable is serving;

Deleted table.

SQL > create table TestTable (ID, DateCol) as
2 Select 1, date '' 2011-11-11 of all the double union
3 select 2, '' 2012-07-13 of all the double union
4 Select 3, date ' 2030-12-31' double.

Table created.

SQL >-FirstSQL
SQL > SELECT *.
2 from TestTable
3. WHERE sysdate<=>
4 GOLD DateCol = date '' 2011-11-11;

ID DATECOL
---------- -------------------
1 11/11/2011 00:00:00
3 31/12/2030 00:00:00

2 selected lines.

SQL >-SecondSQL
SQL > SELECT *.
2 from TestTable
3 WHERE DateCol = date ' 2011-11-11.
4 GOLD sysdate<=>

ID DATECOL
---------- -------------------
1 11/11/2011 00:00:00
3 31/12/2030 00:00:00

2 selected lines.

I believe that I've read about this on Metalink somewhere, have yet to find the document, but I'm sure this is a known bug...

Tags: Database

Similar Questions

  • Max value return value despite where clause is not not really looking for the reason

    Hello

    Using oracle 11.2.0.3

    Select 'A '.

    of the double

    where 1 = 2

    No returns no row, as expected

    Select max ('A')

    of the double

    where 1 = 2 - that is to say isn't true

    Returns the line with null

    Why is this?

    Thank you

    Hello

    user5716448 wrote:

    Hello

    Thanks for the reply.

    I guess that's rule ageneral wait even if no line because of the place where the condition.

    where 1 = 2 - that is to say isn't true

    Thank you

    Yes, if there are no rows in the table, or no line meets the conditions in the WHERE clause, it would be logical that the query return lines exactly 0, but it is also logical that the query returns exactly 1 row.  People who have designed SQL apperantly thought return 1 row was most helpful.

    If you want the query to return 0 rows when there is no data, you can GROUP BY a constant.  For example:

    SELECT MAX (hiredate) AS last_hitedate

    FROM scott.emp

    WHERE deptno = & deptno_wanted

    GROUP 0

    ;

    If there are any rows that meet the condition in the WHERE clause, then the query will produce 1 row, but if no rows meet this condition, then the query will return 0 rows.

    Personally, I'm happy that they designed this way SQL.  I find it rather convenient that the aggregates without GROUP BY clause will return 1 row.  I do things like

    SELECT COUNT (*)

    FROM table_x;

    often, when I want to know if a table has been filled or not.  Seeing a 0 for the output is much clearer that does not get any results.

  • Convert and To_Char in where clause does not

    Hello

    I try to get the following sql beating, but it always generates an error. Any ideas?

    SELECT

    e_Equipment.EQU_ID,

    e_Equipment.EQU_PC_name,

    e_Equipment.EQU_DESCR,

    e_Equipment.EQU_SERIAL_NO,

    e_Equipment.EQU_STATUS,

    a_POBSYSENUMS. PSS_ID

    Of e_equipment

    LEFT JOIN

    A_POBSYSENUMS

    ON e_Equipment.EQU_STATUS = CONVERT (A_POBSYSENUMS. PSS_ID, ' varchar (2)') AND A_POBSYSENUMS. PSS_PSE_PK = '76'

    WHERE

    e_Equipment.EQU_ORG_PK = 8271;

    Thank you very much

    Christina

    Looks like you are trying to use the MS SQL Server syntax rather than the Oracle syntax.

    You did not say why to_char does not work for you...

    Try...

    e_Equipment.EQU_STATUS = TO_CHAR (A_POBSYSENUMS. PSS_ID)

  • Programmatic setting of the place where clause does not.

    Hello

    I use Jdeveloper 11.1.2.2.

    I'm trying to interview some lines of the VO by placing the VO in the programmatic way as it appears in this documentation: http://docs.oracle.com/cd/E15523_01/web.1111/b31974/bcquerying.htm#CHDEBEAF

    But it returns no rows. While I was trying to interview through the SQL command line he questions the lines.

    Are there conditions that only bind the variables declared in the VO can be queried in the programmatic way? I tried also. It is not always all the lines.

    Thank you

    Nigel.

    I meant turn on diagnostics.

    http://jdeveloperfaq.blogspot.com/2009/12/FAQ-6-How-to-fine-tune-ADF-Diagnostics.html

    Published by: in the line of fire on July 25, 2012 11:54

  • DECODE does not work in the WHERE clause when subquery returns more than one line

    Hi gurus,

    I want to write a query against the table CCENTERS (Script given below) and wait for the following result:

    1. in the transition from a value of 0 for the ID, it returns all the rows in the table.
    2. in the passage of one value other than 0, it returns the row corresponding to the given value and all its records of the child.

    CCENTER has parent-child relationship in the column ID and the BASE. I use a query with the DECODE function. but the function in the WHERE clause is not capable of managing the subquery with multiple lines of DECODE.

    *************************************************
    VARIABLE ParaCCenter NUMBER

    BEGIN
    : paraccenter: = 0;
    END;
    /

    CREATE TABLE ccenters
    (id NUMBER,
    name VARCHAR2 (20).
    number base);

    INSERT INTO ccenters VALUES(1,'NUST',null);
    INSERT INTO ccenters VALUES(2,'SEECS',1);
    INSERT INTO ccenters VALUES(3,'NBS',1);
    commit;

    SELECT * from ccenters
    WHERE id IN DECODE(:ParaCCenter, 0, id,)
    (SELECT id FROM ccenters
    START WITH basic =: ParaCCenter
    ID of CONNECTION BY PRIOR = base
    UNION
    SELECT: ParaCCenter OF double
    )
    )
    /
    BEGIN
    : paraCCenter: = 1;
    END;
    /

    SELECT * from ccenters
    WHERE id IN DECODE(:ParaCCenter, 0, id,)
    (SELECT id FROM ccenters
    START WITH basic =: ParaCCenter
    ID of CONNECTION BY PRIOR = base
    UNION
    SELECT: ParaCCenter double))
    /
    The result is
    (SELECT id FROM ccenters
    *
    ERROR at line 3:
    ORA-01427: einreihig subquery returns multiple rows

    How this query can be rewritten for the given feature. Any response will be appreciated.

    Thank you

    Try something like this:

    SELECT * FROM ccenters
    WHERE :ParaCCenter = 0
    OR id in
      (SELECT id FROM ccenters
       START WITH base=:ParaCCenter
       CONNECT BY PRIOR id = base
       UNION
       SELECT :ParaCCenter FROM dual
      )
    
  • NVL selection list does not not on the place where clause in query

    Ok. APEX 4.2...

    Im having problems with my selection lists and NULL values... I see that it has come time and time again...

    I have a tabular presentation, with a query based on a selection list.  The selection list has the ability to '- Show All -'... The value of the selection list is a number, and the display is words...  (for reference the LOV query is: select status, batch from pmt_stat_lookup by 1)

    Initially I had problems with null and invalid numbers like ' display Null = 'Yes' and the problem of null % ', so have used the code in this blog to remove the NULL values... Display Null = & amp; #34; Yes & amp; #34; and the problem of null % | Inside Oracle APEX by Patrick Wolf

    Then in the application of my report, I have a where clause clause that checks the value of the selection list... WHERE batch = nvl(:P11_STATUS_SELECT,STATUS_ID)

    everything works almost fine, and I can choose a status, or I choose - see the All-, but the query will not include the lines where the State is null.

    (I also see that maybe I should be, use the case statement instead of the NVL on where clause, but not sure of the syntax. In addition, NVL was used somewhat in the different reports in the application...)

    For reference, the code of the old blog that I as a process page is:

    BEGIN

    FOR rItem IN

    (SELECT NOM_ELEMENT

    OF APEX_APPLICATION_PAGE_ITEMS

    WHERE APPLICATION_ID = TO_NUMBER(:APP_ID)

    AND PAGE_ID IN (TO_NUMBER(:APP_PAGE_ID), 0)

    AND LOV_DISPLAY_NULL = 'Yes'

    AND LOV_DEFINITION IS NOT NULL

    -change here

    AND LOV_NULL_VALUE = '% null | '%'

    )

    LOOP

    IF V (rItem.ITEM_NAME) = "% null | '%'

    THEN

    Apex_Util.set_session_state (rItem.ITEM_NAME, NULL);

    END IF;

    END LOOP;

    END;

    Thank you very much

    Richard

    Richard,

    Perhaps this example can help you solve your problem.

    https://Apex.Oracle.com/pls/Apex/f?p=63838:2

    Jeff

  • ViewObject where Clause SET based on logged in user roles

    Hello Experts

    I have a view object based on a custom query to get distinct values from a table. My requirement is to display the results as a listview. The listview is is filled without any problem. But I need to add a where clause clause the object view based on the user roles.

    I have a method that generates the where clause and returns one string something like "COUNTRIES ('USA', 'UK').

    I created a class of the view object Impl and put WhereClause as below: but where clause is not applied when I run the page. I see everywhere instead of just USA & UK.

    Can you let me know at what time should I set the where the clause?

    SerializableAttribute public class CountriesVOImpl extends ViewObjectImpl {}

    /**

    * This is the default constructor (do not remove).

    */

    public CountriesVOImpl () {}

    this.setWhereClause (getCountries ());

    }

    public String getCountries() {}

    return '('USA', 'UK') COUNTRIES. "

    }

    }

    In class ViewImpl try to replace "executeQueryForCollection" and setWhereClause in this function as:

        protected void executeQueryForCollection(Object object, Object[] object2, int i)
        {
            setWhereClause("COUNTRY in ('USA','UK')");
            super.executeQueryForCollection(object, object2, i);
        }
    
  • Need help with dynamic where clause.

    Hello world.  I'm kind of a novice with PL/SQL, so please be patient with me.  I am building a web application using Weblogic Oracle 11 g and Oracle database.

    To make a long story short, I need to generate the complex dynamic WHERE clause.  I don't know what will be the name of the column or the operator of comparison or the value will be until the moment of execution.

    I'm not 100% certain, but I think I need to use dynamic SQL statements.  Unless there is a better way to do it.

    I'm sure that using dynamic SQL opens me up to SQL injection attacks if I use simple string concatenation.  I would like to use bind variable if possible.

    In any case, it seems like trying to build a dynamic where clause does not seem to work as I want it would be...

    bv1 := 'colA = 5 and colB >= 9';
    
    query_str := 'SELECT * FROM view WHERE :bv1';
    
    OPEN CUR FOR query_str USING bv1;
    

    The code above pours out when I try to run it.

    Is there a way to build dynamic where the provisions without the use of concatenation of simple string that leaves me open to attacks by SQL injection?

    Thank you

    Hello.  I have read briefly upward on things, you suggested, but it seems a bit abstract for me since I was a novice.

    Can you give us an explanation or an example of how to use it to accomplish what I need to do?

    Do ypu really plan create a query with a WHERE clause that contains a predicate for all possible columns?

    Variable bind offer performance when the same query is executed several times with different values for bind variables.

    Select * from emp where empno =: v_empno

    After the first run Oracle will always be this query in the library cache. The next running can use the version of the cache even if the bind value is different.

    Select * from emp where empno =: v_empno;

    Select * from emp where ename =: v_ename;

    Select * from emp where sal =: v_sal;

    Each one is a DIFFERENT query. Yes - each of them uses a variable binding, but queries are different.

    So, if your username select EMPNO, an '=', and a value from the first query can be executed. But the next time that the user can select the ENAME column so that 'stored' first request may not be used given that the query does not match.

    The third time your user selects SAL so none of the first two queries can be used in the library cache. The use of bind variables gives performance during the SAME QUERY is used multiple times with DIFFERENT values for the variable binding. Oracle is not to analyze the hard query everything simply because the VALUE is different.

    So bind variables do not help you if most of the queries were completely DIFFERENT sets of predicates. And SYS_CONTEXT will not help either since that simply provides a way to define binds the values of the variables.

    Just for the simple example above, there are at least SIX possible combinations of columns that could choose your user name: empno, ename, sal, empno ename, empno & sal, ename & sal

  • Small design on the points of view and a Where Clause Board...

    Hi all...  I just want to check Im doing things right, and he is not a better way to do this...

    Running APEX 4.2.5 and XE 11.2

    Ive built my application around a community of users who have access to certain groups of data...  Ive designed so that there are views and then transparent filter the data of a given user. for example, the view below seamlessly that users can see the filters depending on which application they use, they can see more specifically, what are the features and finally, what group they are actually in.

    Create view ENTITIES like)

    Select * from t_entities t

    where exists (select 1

    of application_groups ag

    where ag.object_name = 'ENTITIES '.

    and ag.object_id = t.entity_id

    and ag.group_name = 'CASH FLOW')

    and exists (select 1 from entity_users EU

    where eu.username = nvl (v ('APP_USER'), USER) / * APEX APPLICATION USER * /.

    and eu.entity_id = t.entity_id)

    and it exists (select 1 from entity_group_members for example

    where eg.entity_group = v('G_ENTITY_GRP_ID') / * ENTITY_GROUP * /.

    and eg.entity_id = t.entity_id)

    )

    The overall costs when I run the explain command is very low (23 or almost), so I think that its an effective way of filtering... However, out of 300 entities or greater, the vast majority of users (75%) can see 75% of data...  Also, I need to create another view to filter another set of data with 2000 records. one with the view in place, 95% of the staff will see 95% of the data and only 10% of the staff see the other 10%...

    I note that its faster when a member of a group brings back only a tiny part of the data compared to the other way around... This is why Im asking before implementing another view of the same type.

    So, on my question. Is there a better way to do this, or the query should be on there head with a WHERE clause does NOT EXIST (xxxxx! = yyyyy)) or soemthing else ther is quite that Ive missed...

    The only other comment is that Im using the upper table "APPLICATION_GROUPS" for more than one type of object (i.e. entities and entity accounts banking..) y at - it no merit in separaitng the two into two tables?

    Thank you very much

    Richard

    Hi Richard,

    Miss me a lot of information but:

    I think that your design could be allowed. It seems a little too mat, maybe, but I think this could work.

    It is important to have the good indexing and use compression of index:

    On application_groups (object_name, the GroupName, groupname) compresses

    IT compresses to entity_users (username, entity_id)

    On the entity_group_members (entity_group, entity_id) compress

    I think v as v ('G_ENTITY_GRP_ID') is a user-defined function? If so, if possible, set the deterministic and uses result_cache.

    Consider partitioning application_groups type (= object_name?)

  • dynamic logic in SQL WHERE clause based on the value of the ELEMENT

    Hello

    I have a report based on the following SQL query.
       select dept_no,
           dept_name,
           dept_loc
      from dept
     where dept_loc = :P1_DEPT_LOC
       // If P1_DEPT_LOC is not null, I want the WHERE clause and IF  P1_DEPT_LOC is null, then I don't need the WHERE clause.
       // how can I build this logic in same SQL
    Thank you
    Deepak

    Published by: Deepak_J on March 11, 2010 16:37

    where: P1_DEPT_LOC IS NULL or dept_loc =: P1_DEPT_LOC

    If dept_loc is not null better would be

    where dept_loc = coalesce(:P1_DEPT_LOC,dept_loc)

  • where clause to query the hierarchy in the tree Apex area does not

    Hi all

    I am building a tree Menu in Apex 5.0.3 (Oracle 11 g XE), when using when the clause, it does show all the data, but without him, showing all the data.

    I'm trying to populate Tree Menu with data specific to a user successfully logged on.

    (A) table created as HR2. TREE_MENU

    menu_name varchar2 (50).

    number of menu_parent

    number of menu_child

    menu_id varchar2 (12),

    menu_path varchar2 (100),

    number of user_no

    (B) SQL statement for the tree in the Apex region

    Select case when connect_by_isleaf = 1 then 0

    When level = 1 then 1

    else                           -1

    end the status,

    level,

    'Menu_name' as the title,

    NULL as an icon,

    "MENU_CHILD" as a value.

    NULL as ToolTip,

    NULL as link

    to HR2. "" TREE_MENU ".

    -WHERE USER_NO =: P_USERNO

    Start with 'MENU_CHILD' is null

    connect prior "MENU_PARENT" = "MENU_CHILD."

    brothers and sisters of order by 'MENU_ID '.

    Note: also used static value where clause but is not workd.

    that the mistake of me or something else? When using the wizard, she asks (possibly) where clause, this means that when the clause can be used in the SQL statement.

    Help, please.

    Kind regards.

    If you want to prune your tree to show only the elements of the No. 7 usermenu, copy the following code helps you

    select case when connect_by_isleaf = 1 then 0
                when level = 1             then 1
                else                           -1
           end as status,
           level,
           "MENU_NAME" as title,
           null as icon,
           "MENU_CHILD" as value,
           null as tooltip,
           null as link
    from HR2."TREE_MENU"
    start with "MENU_CHILD" is null
    connect by
        prior "MENU_PARENT" = "MENU_CHILD"
        and "USER_NO" = 7
    order siblings by "MENU_ID"
    

    Concerning

    Mahmoud

  • Setting of outsourcing work is not for a SQL Where clause

    Im trying to outsource the WHERE SQL clause of a snapshot data (connecting to Siebel DB) and specify where clause in the run profile that does not work.

    Snapshot of research: Select the name of siebel.s_org_ext

    Parameter of outsourcing: where_clause_sql

    Run the content of the profile:

    phase. Phase1.snapshot.clt.where_clause_sql = name = "ABC0009".

    #phase. Phase1.snapshot.clt.snapshot_sql = select name from siebel.s_org_ext where name = 'ABC0009 '.

    The above parameter retrieves all the records in the table. Below the profile execution retrieves just this record that seems to work fine.


    Run the content of the profile:

    phase. Phase1.snapshot.clt.snapshot_sql = select name from siebel.s_org_ext where name = 'ABC0009 '.


    I want to outsource only where clause as there are many SQL and they are huge to maintain in the run profile.

    I have attached a doco with screenshots that will help to understand more.

    Hello

    You must BE

    -Choose "Select table or view" in the table of the snapshot Wizard selection page

    &

    -Use outsourced where clause

    OR

    -Choose "SQL" in the snapshot table selection wizard page.

    &

    -Outsourced use SQL snapshot

    You can't mix and match options.

    Kind regards

    Nick

  • Where clause in the "default_where" of get_block_property is not cancelled...

    Hello

    I developed a form with two blocks.

    The first - block of non - database contains the criteria.

    Database of the other - block-displays the records according to the inserted.

    Also, there is a button that executes the query criteria.

    The code of the BUTTON WHEN PRESSED is as follows:

    declare

    v_where varchar2 (3000);

    Start

    v_where: = null;

    go_block ('EKKREMOTHTES_AIT_TSG');

    clear_block (no_validate);

    v_where: = get_block_property ('EKKREMOTHTES_AIT_TSG', default_where);

    If: blk_criteria.site_id is not null then

    v_where: = v_where |' and site_id = "'|: blk_criteria.site_id | ''';

    end if;

    If: blk_criteria.yphr_klimakio is not null then

    v_where: = v_where |' and yphr_klimakio = "'|: blk_criteria.yphr_klimakio | ''';

    end if;

    If: blk_criteria.send_date_from is not null and: blk_criteria.send_date_to is not null then

    v_where: = v_where |' and send_date between to_date('''|| to_char(:blk_criteria.send_date_from,'dd/mm/yyyy')||''',''dd/mm/yyyy'') and

    to_date('''|| to_char(:blk_criteria.send_date_to,'dd/mm/yyyy') | " (', "dd/mm/yyyy)";

    end if;

    If: blk_criteria.eq_group1 is not null then

    v_where: = v_where |' and eq_group1 = "' | : blk_criteria.eq_group1 | " ' ;

    end if;

    If: blk_criteria.eq_type1 is not null then

    v_where: = v_where |' and eq_type1 = "' | : blk_criteria.eq_type1 | " ' ;

    end if;

    If: blk_criteria.eq_group2 is not null then

    v_where: = v_where |' and eq_group2 = "' | : blk_criteria.eq_group2 | " ' ;

    end if;

    If: blk_criteria.eq_type2 is not null then

    v_where: = v_where |' and eq_type2 = "' | : blk_criteria.eq_type2 | " ' ;

    end if;

    blk_def_where ('EKKREMOTHTES_AIT_TSG', v_where);                                    / * a form routine that makes the set_block_property(<block>,default_where) * /.

    do_key ('execute_query');

    end;

    The above code works when the user inserts the criteria for the first time. Later when the user deletes certain criteria - clear criteria in the block of criteria-

    and he pushed the button of the query results are exactly the same...

    After have debugged the problem, clause v_where is not nullied (do not get the value zero) in order to get the new criteria.

    Can you identify the error?

    Note: I use Oracle Forms 10 g Db 11 g v.2

    Thank you very much

    SIM

    SIM,

    The procedure "blk_def_where" sets the block where clause by using the DEFAULT_WHERE or the ONETIME_WHERE constanct?  Gets it to the user that the same results as the DEFAULT_WHERE sets the property WHERE permanently so the second time through, the 'v_where' is NOT null.  Check your BLK_DEF_WHERE procedure and if it does not use the ONETIME_WHERE constanct, change isn't.  The alternative would be to put DEFAULT_WHERE = NULL after the call to the built-in EXECUTE_QUERY.

    Craig...

  • Materialized view does not quickly refresh with sysdate in where clause

    Hi all

    I am trying to create a view, materialized with sysdate in where clause. This makes the complex query, and so I can't create a quick refreshment mview.

    I tried to create with rowid too, but it does not create a quick refreshment.

    I was wondering if someone can advise me, how can I accomplish this task, which would be really appreciated.

    The query is:

    create a materialized view PS_MEETING

    build the DEFERRED payment

    Refresh quickly with rowid

    as

    SELECT *.

    MEETING M

    WHERE state_desc = 'VIC '.

    OR Meet_date < TRUNC (SYSDATE);

    the behavior is documented: http://docs.oracle.com/cd/E11882_01/server.112/e25554/basicmv.htm#DWHSG8201

    General restrictions on update quickly

    The definition of the materialized view query is limited as follows:

    • The materialized view must not contain references to non-repetitive phrases such as SYSDATE and ROWNUM .

    So I guess that you would need a more static than sysdate condition - or another strategy update.

  • Not able to add Where clause I last query

    Dear Metallica

    I created the report and last, I added where clause to find record use Serach point in the area of research, but it does not work

    My Code
    SELECT apex_item.checkbox (1, timesheet_id, 'UNCHECKED') tick, timesheet_id,
           pm.description project_description, pm.project_id, pm.NAME,
           tam.task_name, xxpria_vendor_name (resource_name) resource_name,
           submission_date "Timesheet Date", quantity hours,
           (planed_hour - tm.quantity) balance, tm.attribute2 remarks
      FROM timesheet_master tm, pa_task_mas tam, pa_projects_all pm
     WHERE tam.task_id = tm.task_number and 
           pm.project_id=tm.PROJECT_NUMBER      
    AND tm.submitted_flag = 'Y'
       AND xx_resource_id (resource_name) =
              (SELECT DISTINCT person_id
                          FROM pa_project_players
                         WHERE project_role_type LIKE 'TEAM MEMBER'
                           AND person_id = xx_resource_id (tm.resource_name)
                           AND project_id = pm.project_id
                           AND tm.submission_date BETWEEN start_date_active
                                                      AND NVL (end_date_active,
                                                               '01-APR-2040'
                                                              ))
       AND tm.approved_flag = 'N'
       AND status = 'INPROCESS'
       AND pm.project_id IN (
              SELECT project_id
                FROM pa_project_players
               WHERE project_role_type = 'PROJECT LEADER'
                 AND person_id = xx_resource_id (:app_user)
                 AND tm.submission_date BETWEEN start_date_active
                                            AND NVL (end_date_active,
                                                     '01-APR-2040'
                                                    ))
    UNION
    SELECT apex_item.checkbox (1, timesheet_id, 'UNCHECKED') tick, timesheet_id,
           pm.description project_description, pm.project_id, pm.NAME,
           tam.task_name,
           xxpria_vendor_name (resource_name) resource_name,
           submission_date "Timesheet Date", quantity hours,
           (planed_hour - tm.quantity) balance, tm.attribute2 remarks
      FROM timesheet_master tm, pa_task_mas tam, pa_projects_all pm
     WHERE tam.task_id = tm.task_number and 
           pm.project_id=tm.PROJECT_NUMBER
          AND tm.submitted_flag = 'Y'
       AND xx_resource_id (resource_name) =
              (SELECT DISTINCT person_id
                          FROM pa_project_players
                         WHERE project_role_type LIKE 'PROJECT LEADER'
                           AND person_id = xx_resource_id (tm.resource_name)
                           AND project_id = pm.project_id
                           AND tm.submission_date BETWEEN start_date_active
                                                      AND NVL (end_date_active,
                                                               '01-APR-2040'
                                                              ))
       AND tm.approved_flag = 'N'
       AND status = 'INPROCESS'
       AND pm.project_id IN (
              SELECT project_id
                FROM pa_project_players
               WHERE project_role_type = 'PROJECT MANAGER'
                 AND person_id = xx_resource_id (:app_user)
                 AND tm.submission_date BETWEEN start_date_active
                                            AND NVL (end_date_active,
                                                     '01-APR-2040'
                                                    ))
    UNION
    SELECT apex_item.checkbox (1, timesheet_id, 'UNCHECKED') tick, timesheet_id,
           pm.description project_description, pm.project_id, pm.NAME,
           tam.task_name,
           xxpria_vendor_name (resource_name) resource_name,
           submission_date "Timesheet Date", quantity hours,
           (planed_hour - tm.quantity) balance, tm.attribute2 remarks
      FROM timesheet_master tm, pa_task_mas tam, pa_projects_all pm
     WHERE tam.task_id = tm.task_number and 
           pm.project_id=tm.PROJECT_NUMBER
          AND tm.submitted_flag = 'Y'
       AND xx_resource_id (resource_name) =
              (SELECT DISTINCT person_id
                          FROM pa_project_players
                         WHERE project_role_type LIKE 'PROJECT MANAGER'
                           AND person_id = xx_resource_id (tm.resource_name)
                           AND project_id = pm.project_id
                           AND tm.submission_date BETWEEN start_date_active
                                                      AND NVL (end_date_active,
                                                               '01-APR-2040'
                                                              ))
       AND tm.approved_flag = 'N'
       AND status = 'INPROCESS'
       AND pm.project_id IN (
              SELECT project_id
                FROM pa_project_players
               WHERE project_role_type = 'PRACTICE HEAD'
                 AND person_id = xx_resource_id (:app_user)
                 AND tm.submission_date BETWEEN start_date_active
                                            AND NVL (end_date_active,
                                                     '01-APR-2040'
                                                    ))
    
    where (nvl(:P75_RESOURCE_NAME,'0') = '0' or tm.resource_name=:P75_RESOURCE_NAME)
    Below where conditon does not
    where (nvl(:P75_RESOURCE_NAME,'0') = '0' or tm.resource_name=:P75_RESOURCE_NAME)
    How to solve it.

    Thank you

    Try:

    select * from
    (
       <>
    )
    where nvl(:P75_RESOURCE_NAME,'0') = '0' or resource_name=:P75_RESOURCE_NAME
    

Maybe you are looking for

  • After Numbering tab stop

    When you use the numbers under the bullets of text & lists, how can I add a tab between the number and the text without going through the whole paragraph block tab as well. In other words, I want to add five spaces after each number before the first

  • Toshiba Portege R500 - can I download WinDVD?

    Hello I have install Vista on my R500, but not with the Vista DVD included for PC Toshiba.I have install Vista from original VISTA DVD, ultimate version and my problem is, I want an InterVideo WinDVD for TOSHIBA.Is possible download this program from

  • I have a HP mediasmart server LX195. I want to do a Factory reset on this server. I don't have the original software CD.

    I have a HP mediasmart server LX195.   I want to do a Factory reset on this server.   Factory reset, I mean completely wiping the drive clean and reinstalling the software, like the LX195 server was brand new.   I don't have the original software CD.

  • How can I remove RIKVM 38F51D56.sys

    Ive been for the past several weeks trying to get this virus 38F51D56.sys RIKVM out of my computers Someone at - it advice from successful delete?

  • Banner reactive in CC Animate

    Hey Adobe,Can you explain how to use the new "adaptable" feature in Adobe animate CC?We try to make a banner of anglo-saxon reagent (938 x 340) that can resize a rectangle (320 x 340) in width, but we do not know how.Our sensitive issues:1. How can p