Statement in clause where

Hi, I'm a little confused I have this sentence, msi.inventory_item_status_code | |''! = 'OPM' in a query, I want to know if it affects the performance of the database (Oracle Database 10g Enterprise Edition Release 10.2.0.2. 0 - 64bit Production).
SELECT mic.category_id,
msi.organization_id,
msi.description - aridsat msi.attribute1
XXCMX_MTL_APLICACIONES_INT_PKG.
get_conc_segm_aplicaciones_int (
msi.organization_id,
msi.inventory_item_id)
aridsat,
msi.inventory_item_status_code,
msi.weight_uom_code,
msi.unit_weight,
msi.volume_uom_code aruvm1,
msi.primary_unit_of_measure,
msi.unit_volume,
msi.tax_code,
msi.segment1 arlitm,
msi.inventory_item_id artid,
msi.attribute4,
mcb.segment1,
mcb.segment2,
mcb.segment4
FROM inv.mtl_system_items_b msi
inv.mtl_item_categories mic,
mcb inv.mtl_categories_b
WHERE 1 = 1
AND msi.organization_id = 108
Msi.segment1 AND LIKE '19A% '
AND msi.inventory_item_status_code | |''! =
*'OPM'* AND msi.organization_id =
mic.organization_id (+)
AND msi.inventory_item_id =
mic.inventory_item_id (+)
Mic.category_set_id AND (+) = 1100000046
Mcb.category_id mic.category_id = AND (+)
Or is it wrong to use it? Why?
Best regards.

It affects the performance.
You concatenating a string to the value of your column, so the optimizer will not be able to use any existing index in this column to search for its value.
If it is wrong or not it depends. If you don't want to use the index it is correct otherwise it isn't.
There are hints you could use instead of that though, to avoid the use of indexes and let the code more legible (so other people won't have the same doubt you are having now).
Some people do that to avoid the use of indexes, you may also see where clauses with column + 0 = value to avoid the use of an index in a numeric column.

Similar Messages

  • Query Tuning - using CASE statement in the WHERE clause

    Hi All,
    My query has been modified to use a CASE statement in the WHERE clause to consider data from certain columns based on a parameter value. This modified query is doing a full table scan and running endlessly. Please suggest what may be done to improve its performance:
    Query:
    SELECT LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS summary_date,
    os.acctnum,
    os.avieworigin_refid,
    COUNT(1) cnt_articleview,
    SUM(NVL(autocompletedterm,0)) cnt_autocompletedterm
    FROM TABLE1 os
    WHERE os.acctnum IS NOT NULL
    AND os.avieworigin_refid IS NOT NULL
    AND os.requestdatetime IS NOT NULL
    AND UPPER(os.success_ind) = 'S'
    AND CASE WHEN
    Param_ValueToCheck  = 'FULL' AND get_date_timestamp(os.requestdatetime)  BETWEEN
    TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND
    TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    THEN 1
    WHEN
    Param_ValueToCheck  = 'INCR' AND os.entry_createddate  BETWEEN
    TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND
    TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    THEN 1
    END = 1
    AND CASE WHEN
    Param_ValueToCheck  = 'FULL' AND os.entry_CreatedDate BETWEEN
    TO_DATE('01-APR-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND
    TO_DATE('07-JUN-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    THEN 1
    WHEN
    Param_ValueToCheck  = 'INCR' THEN 1
    END = 1
    GROUP BY LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))), os.acctnum,os.avieworigin_refid;Table Description:
    (Number of rows : approx > 600,000,000)
    Name                           Null     Type      
    ARTICLEID                      NOT NULL NUMBER(20)
    USERKEY                                 NUMBER(10)
    AVIEWORIGIN_REFID                       VARCHAR2(10)
    SUCCESS_IND                             VARCHAR2(2)
    ENTRY_CREATEDDATE                       DATE      
    CREATED_BY                              VARCHAR2(10)
    FILENUMBER                              NUMBER(10)
    LINENUMBER                              NUMBER(10)
    ACCTNUM                                 VARCHAR2(10)
    AUTOCOMPLETEDTERM                       NUMBER(2) 
    REQUESTDATETIME                         VARCHAR2(19)Explain Plan
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2224314832
    | Id  | Operation            | Name              | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT     |                   |   590 | 33040 |  2501K  (1)| 08:20:15 |       |       |
    |   1 |  HASH GROUP BY       |                   |   590 | 33040 |  2501K  (1)| 08:20:15 |       |       |
    |   2 |   PARTITION RANGE ALL|                   |   590 | 33040 |  2501K  (1)| 08:20:15 |     1 |1048575|
    |*  3 |    TABLE ACCESS FULL | TABLE1 |   590 | 33040 |  2501K  (1)| 08:20:15 |     1 |1048575|
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       3 - filter(UPPER("OS"."SUCCESS_IND")='S' AND CASE  WHEN ('FULL'='FULL' AND
                  "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' 2011-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN
                  'FULL'='INCR' THEN 1 END =1 AND "OS"."REQUESTDATETIME" IS NOT NULL AND CASE  WHEN ('FULL'='FULL'
                  AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")>=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")<=TO_DATE(' 2011-05-31 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN ('FULL'='INCR' AND "OS"."ENTRY_CREATEDDATE">=TO_DATE('
                  2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE('
    PLAN_TABLE_OUTPUT
                  2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 END =1 AND "OS"."ACCTNUM" IS NOT NULL AND
                  "OS"."AVIEWORIGIN_REFID" IS NOT NULL)Edited by: Chaitanya on Jun 9, 2011 2:44 AM
    Edited by: Chaitanya on Jun 9, 2011 2:47 AM

    Hi Dom,
    Modified Query:
    SELECT LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS summary_date,
    os.acctnum,
    os.avieworigin_refid,
    COUNT(1) cnt_articleview,
    SUM(NVL(autocompletedterm,0)) cnt_autocompletedterm
    FROM TABLE1 os
    WHERE os.acctnum IS NOT NULL
    AND os.avieworigin_refid IS NOT NULL
    AND os.requestdatetime IS NOT NULL
    AND UPPER(os.success_ind) = 'S'
    AND (('FULL'  = 'FULL'
    AND  (get_date_timestamp(os.requestdatetime)  BETWEEN TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
                   AND TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    AND   os.entry_CreatedDate BETWEEN TO_DATE('01-APR-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
                   AND TO_DATE('07-JUN-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
    OR ('FULL'  = 'INCR'
    AND os.entry_createddate  BETWEEN TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS')
                   AND TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') ))
    GROUP BY LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))), os.acctnum,os.avieworigin_refid;Execute Plan:
    PLAN_TABLE_OUTPUT
    Plan hash value: 3615447714
    | Id  | Operation                 | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT          |                   | 25125 |  1374K|       |   407K  (1)| 01:21:36 |       |       |
    |   1 |  HASH GROUP BY            |                   | 25125 |  1374K|  3768K|   407K  (1)| 01:21:36 |       |       |
    |   2 |   PARTITION RANGE ITERATOR|                   | 25125 |  1374K|       |   407K  (1)| 01:21:32 |    29 |    31 |
    |*  3 |    TABLE ACCESS FULL      | TABLE1 | 25125 |  1374K|       |   407K  (1)| 01:21:32 |    29 |    31 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       3 - filter("OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  UPPER("OS"."SUCCESS_IND")='S' AND "OS"."REQUESTDATETIME" IS NOT NULL AND
                  "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")>=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")<=TO_DATE(' 2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "OS"."ACCTNUM" IS NOT NULL AND "OS"."AVIEWORIGIN_REFID" IS NOT NULL AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE('
                  2011-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))Edited by: Chaitanya on Jun 9, 2011 4:51 AM

  • Query Tuning - using CASE statement in the WHERE clause - Duplicate Post

    Duplicate Post by mistake.
    Please check
    Query Tuning - using CASE statement in the WHERE clause
    Edited by: Chaitanya on Jun 9, 2011 2:45 AM
    Edited by: Chaitanya on Jun 9, 2011 2:46 AM

    Duplicate Post by mistake.
    Please check
    Query Tuning - using CASE statement in the WHERE clause
    Edited by: Chaitanya on Jun 9, 2011 2:45 AM
    Edited by: Chaitanya on Jun 9, 2011 2:46 AM

  • Edit the clause where in a datablock

    i want to edit the clause where in a datablock in forms 10g
    je veux que to_date(champdb,'dd/mm/yyyy') = :champforms
    je fais
    set_block_property('plombage',DEFAULT_WHERE ,'to_date(dateplomb,'dd/mm/yyyy')= decode(:dateplombage,null,DATEPLOMB,'||:dateplombage||')');

    Ok, but if you want to compare the data without time-part, don't use to_char, user TRUNC(DATEPLOMB), and instead of your code
    to_date(to_char(sysdate,'dd/mm/yy hh24:mi'),'dd/mm/yy hh24:mi')its simpler to use
    trunc(sysdate, 'MI')

  • Add clause WHERE in Renderer

    Hi all:
    Anybody knows how can i add a clause WHERE in HTML Renderer?. For example, if a want to do a JOIN or make a row restrict?. In the "real world" is very necessary and Oracle Forms gives that functionality.
    Regards.
    Marco H.

    If you are using the BC4J JSP tags you can do this in the <jbo:datasource /> tag, there are "whereclause" and "orderby" attributes
    e.g. to bring back just the folks in Department 10 using a default BC4J VO and Entity based on EMP:
    <jbo:ApplicationModule id="am"  configname="mypackage1.am.amLocal"  releasemode="Stateful"  />
    <jbo:DataSource id="EmpView"  appid="am"  viewobject="EmpView" whereclause="deptno=10" />
    <jbo:RowsetIterate datasource="EmpView"  changecurrentrow="true" >
    <jbo:ShowValue datasource="EmpView"  dataitem="Ename" ></jbo:ShowValue><BR>
    </jbo:RowsetIterate>

  • Case Statement in a Where clause help

    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE     11.2.0.1.0     Production"
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    Hello,
    I have an APEX application that I need to build a SQL statement for a LOV (List of Values). I have a hidden filed that contains the customer type which can be an 'R' or 'B'. The query needs to be able to display two different result sets based on the customer type of 'R' or 'B'.
    If the customer type is 'R' then:
    SELECT drg_descr d, drg_code r
    FROM distance_ranges
    WHERE  drg_min_miles IN (0,5)
    ORDER BY drg_min_milesIf the customer type is 'B' then:
    SELECT drg_descr d, drg_code r
    FROM distance_ranges
    WHERE  drg_min_miles IN (0,5,10,15,20)
    ORDER BY drg_min_milesCan someone help me with what I think needs to be a case statement?
    Thanks,
    Joe

    Hi,
    You can try CASE statement with WHERE clause
    SELECT drg_descr d, drg_code r
    FROM distance_ranges
    WHERE (CASE param_cust_type
    WHEN(param_cust_type='R') THEN (drg_min_miles IN (0, 5)
    WHEN (param_cust_type='B') THEN (drg_min_miles IN (0,5,10,15,20)
    END;
    Please try and let me know if anything wrong.
    Anyone from the forum comment my code if there is any wrong.
    Thanks!
    Naresh

  • How do I use the CASE statement  in the where clause?

    Hello Everyone,
    I have 2 queries that do what I need to do but I am trying to learn how to use the CASE statement.
    I have tried to combine these 2 into one query using a case statement but don't get the results I need.
    Could use some help on how to use the case syntax to get the results needed.
    thanks a lot
    select segment_name,
    product_type,
    count (distinct account_id)
    FROM NL_ACCT
    where
    ind = 'N'
    and
    EM_ind = 'N'
    and product_type in ('TAX','PAY')
    and acct_open_dt between (cast('2006-01-17' as date)) and (cast('2006-01-17' as date) + 60)
    GROUP BY 1,2
    order by product_type
    select segment_name,
    product_type,
    count (distinct account_id)
    FROM NL_ACCT
    where
    ind = 'N'
    and
    EM_ind = 'N'
    and product_type not in ('TAX','PAY')
    and acct_open_dt between (cast('2006-01-17' as date)) and (cast('2006-01-17' as date) + 30)
    group by 1,2
    order by product_type

    Something like:
    SELECT segment_name, product_type,
           SUM(CASE WHEN account_id IN ('TAX','PAY') and
                         acct_open_dt BETWEEN TO_DATE('2006-01-17', 'yyyy-mm-dd') and
                               TO_DATE('2006-01-17', 'yyyy-mm-dd') + 60 THEN 1
                    ELSE 0 END) tax_pay,
           SUM(CASE WHEN account_id NOT IN ('TAX','PAY') and
                         acct_open_dt BETWEEN TO_DATE('2006-01-17', 'yyyy-mm-dd') and
                               TO_DATE('2006-01-17', 'yyyy-mm-dd') + 30 THEN 1
                    ELSE 0 END) not_tax_pay
    FROM NL_ACCT
    WHERE ind = 'N' and
          em_ind = 'N' and
          acct_open_dt BETWEEN TO_DATE('2006-01-17', 'yyyy-mm-dd') and
                               TO_DATE('2006-01-17', 'yyyy-mm-dd') + 60
    GROUP BY segment_name, product_type
    ORDER BY product_typeNote: You cannor GROUP BY 1,2, you need to explicitly name the columns to group by.
    HTH
    John

  • Newbie Can I have an "IF Statement" in a WHERE clause?

    Example
    Select T.name,T.District,T.Dept
    from table T
    where IF myUnit=9998 THEN
    T.District='OZ'
    ELSIF myUnit=9997 THEN
    T.District='DE'
    ELSE
    T.Dept=myUnit
    END IF;
    ( myUnit is a variable selected by the user)
    TIA
    Steve

    test@ora>
    test@ora> --
    test@ora> with t as (
      2    select 'a0' name, '0Z' district, 9990 dept, 9998 myunit from dual union all
      3    select 'a1', 'XX', 9999, 9998 myunit from dual union all
      4    select 'a2', 'DE', 9998, 9997 myunit from dual union all
      5    select 'a3', 'YY', 9997, 9997 myunit from dual union all
      6    select 'a4', 'YY', 9999, 9999 myunit from dual union all
      7    select 'a5', 'YY', 9992, 9999 myunit from dual)
      8  --
      9  Select
    10    T.name,
    11    T.District,
    12    T.Dept,
    13    t.myunit
    14  from T
    15  where
    16    case myUnit
    17      when 9998 then T.District
    18      when 9997 then T.District
    19      else to_char(myUnit)
    20    end =
    21    case myUnit
    22      when 9998 then '0Z'
    23      when 9997 then 'DE'
    24      else to_char(T.Dept)
    25    end
    26  ;
    NAME                           DI       DEPT     MYUNIT
    a0                             0Z       9990       9998
    a2                             DE       9998       9997
    a4                             YY       9999       9999
    test@ora>
    test@ora>isotope

  • Filter Question - compound statement "OR" clause

    Hi
    I am trying to filter records which contain multiple conditional statements; (all comparisons are on DATE values)
    Example:
    If column_A is NULL OR ( columnA=ColumnB )
    I tried this: which worked for the first condition
    FILTER (1=(@COLTEST(COLUMN_A,NULL)) ;
    And then tried to add the second clause
    FILTER (1=(@COLTEST(COLUMN_A,NULL)) OR 0=@STRCMP(@IF(@COLTEST(COLUMN_A,NULL),0,COLUMN_A), @IF(@COLTEST(COLUMN_B,NULL),0,COLUMN_B))) );
    I've tried CASE, EVAL and just a straight OR as well with no success. Unfortunately the 'where' clause has multiple compound statements.
    Does anyone have any tips for this?
    Thanks

    I think there is an extra closing bracket at the end. Also, give spaces after the @ functions. Could you try the below?
    FILTER ( 1 = (@COLTEST(COLUMN_A,NULL)) OR 0 = @STRCMP ( @IF (@COLTEST (COLUMN_A,NULL),0,COLUMN_A), @IF (@COLTEST (COLUMN_B,NULL),0,COLUMN_B) ));

  • What does || do in a SQL statement after a where with a like?

    We have a packaged application that outputs a SQL statement with the || operator in a where clause along with a LIKE. I have never seen it before and expected it to be a syntax error. I do not see any examples of this syntax in sources such as Morgan's Library.
    For example purposes, observe in the 10g Express Edition currently up for download. Observe that the SQL statement "compiles" when the || operator is used before a like statement, but does not "compile" when used on its own - it gives the error I expected that || is not a relational operator. What does this syntax do?
    For orignal context, the relevant portion of the where clause is:
    T1.QUOTE_NUM || :3 || T1.REV_NUM LIKE :4but the below does so just off of what is available in any instance - much easier to reproduce.
      1  select * from v$sqltext
      2* where (hash_value || 3657695316 || sql_text like 'L%')
    SQL> /
    no rows selected
    SQL> edit
    Wrote file afiedt.buf
      1  select * from v$sqltext
      2* where (hash_value || 3657695316)
    SQL> /
    where (hash_value || 3657695316)
    ERROR at line 2:
    ORA-00920: invalid relational operator
    [pre]
    Thanks for your attention and advice.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I may have answered my own question. It appears that you can use the || to concatenate strings for comparison with a relational operator as in the example below. I've just never seen this before. Can anyone confirm this is what it really does?
    SQL> select count(*) from dual;
      COUNT(*)
             1
    SQL> select count(*) from dual
      2  where '123' = '123';
      COUNT(*)
             1
    SQL> edit
    Wrote file afiedt.buf
      1  select count(*) from dual
      2* where '123' = '124'
    SQL> /
      COUNT(*)
             0
    SQL> edit
    Wrote file afiedt.buf
      1  select count(*) from dual
      2* where '1' || '23' = '123'
    SQL> /
      COUNT(*)
             1
    SQL> edit
    Wrote file afiedt.buf
      1  select count(*) from dual
      2* where '1' || '23' = '124'
    SQL> /
      COUNT(*)
             0

  • Where clause "where 1=1" help with SQL tuning

    Hello Tuning experts,
    Is it helpful to use "where 1=1" and then put all the joins and conditions in the "AND" statements of the SQL when writing SQL queries. I would like to know if it helps with query performance to write SQL queirs that way.
    Thanks in advance.
    Edited by: oracle_developer on Oct 8, 2012 10:41 AM

    You can see here that "where 1 = 1" is gone from the predicate info in the explain plan.
    The optimizer simply discarded it.
    SQL> explain plan for
      2  select *
      3  from emp
      4  where 1 = 1
      5  and job = 'SALESMAN';
    Explained.
    PLAN_TABLE_OUTPUT
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     3 |   114 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     3 |   114 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("JOB"='SALESMAN')
    13 rows selected.

  • I have a MacBookPro 5.5 and an iPad 2 32GB 3G; both items are pretty recent. Today I tried connecting them via blootooth. MBP state "pairing success" whereas the iPad seems to be still searching and indicates the MBP as "not connected". That over and over

    I have a MacBookPro 5.5 and an iPad 2 32GB 3G; both items are pretty recent.
    Today I tried connecting them via blootooth. MBP states "pairing success" (only after NUMEROUS attempts!!!) whereas the iPad seems to be still searching and indicates the MBP as "not connected". That over and over.
    Also, the iPad does not seem to recognize ANY bluetooth device in the house (they ARE discoverable since my MBP DOES "see" them) like, for instance, my mini-Mac.
    Any help would be appreciated; (I hope the problem lies NOT in the bluetooth antenna, in other words not in hardware.)
    P.S. The MBP seems fine since it DID connect to Mac-mini.

    Hello:
    Was the iPad paired with another device?  If so, you need to "unpair" it from the previous device.  Bluetooth devices may be connected with only one thing at a time.
    Barry

  • COMPARE DATES IN A CLAUSE 'WHERE'

    CREATE TABLE POS.PRODUCTS
    PRODUCT_ID NUMBER(9,0),
    PRODUCT_NAME VARCHAR2(50),
    PRODUCTO_DATE DATE
    PRIMARY KEY ( PRODUCTO_ID )
    ENABLE NOVALIDATE
    I HAVE THIS TABLE, IN WHICH I HAVE A CALL FIELD +(PRODUCT_DATE)+
    HERE I AM TRYING TO MAKE A +(SELECT)+, WHERE I WANT TO FILTER A RANGE OF DATES FOR THE FIELD +(CAMPO PRODUCT_DATE)+
    I DO IT FOR YOU AS FOLLOWS:
    WHERE PRODUCT_DATE> = '28 / 06/2010 'AND PRODUCT_DATE <= '28 / 11/2010'
    AND HE TRIED TO FUNCTION TO_DTAE, TO_CHAR
    WHAT YOU HAVE RECORDS IN THE TABLE ARE IN THE FIELD PRODUCT_DATE: *28/06/2010, 28/11/2010*
    BETWEEN USE IS NOT THE WAY TO BE INSERTING THE REGISTRATION IN THE FIELD OR THE FORMAT, AND HOPE SOMEONE LIKE SEPA CORRECT COMPARISON BETWEEN DATES OF FORM
    THANKS FOR YOUR TIME, GREETING

    try dis,
    where to_date(product_date,'dd-mon-yy')>=to_date('28/06/2010','dd/mm/yy') and to_date(product_date,'dd-mon-yy')<=to_date('28/11/2010','dd/mm/yy');
    or
    where to_date(product_date,'dd-mon-yy') between to_date('28/06/2010','dd/mm/yy') and to_date('28/11/2010','dd/mm/yy');Regards,
    Santosh.Minupurey

  • Problem with Clause Where and %

    when i put a '%' the query doesen't work :
    Set_Block_Property(it_where,DEFAULT_WHERE,'nom_contact LIKE :CONTROL.TXT_SEARCH_CONTACT%');
    But
    Set_Block_Property(it_where,DEFAULT_WHERE,'nom_contact LIKE :CONTROL.TXT_SEARCH_CONTACT');
    IT Work,
    why the % doesen't work with FORMS6i ?

    Because form is searching for a name with % and not a name with any other letter
    - instead of writing this:
    Set_Block_Property(it_where,DEFAULT_WHERE,'nom_contact LIKE :CONTROL.TXT_SEARCH_CONTACT%');
    You should try with this :
    Set_Block_Property(it_where,DEFAULT_WHERE,'nom_contact LIKE :CONTROL.TXT_SEARCH_CONTACT' &#0124; &#0124; '%');
    null

  • Using if logic in the where clause of a select statement

    I have a select clause. And in the select clause there is a variable all_off_trt that can be 'Y' or 'N'.
    In the where clause I want to make it so that if a form variable is checked and all_off_trt is 'Y' then
    exclude it else if the form variable isn't checked then select it no matter what all_off_trt is.
    Is there any way to include either and if statement or a case statement within the where clause to acheive this? If not is there another way of doing it?
    Basically I am looking for a case statement like this
    case
    when all_off_trt = 'Y' and mail_para.code = 'Y' then false
    else true
    end
    Message was edited by:
    Tugnutt7

    Ok, so that really doesn't solve my problem. I have 3 different fields that I need to do that with. Each combining in a select statement to print an email list, as well as other thing limiting the where clause.
    This is currently what I have, tested and working 100%.
    cursor email_cur is
         select unique p.email,s.all_off_trt,s.all_deceased,s.no_enroll
    from participant p, trialcom t, ethics s
    where p.status='A'
    and p.surname=t.surname
    and p.initials=t.initials
    and s.trial_cd = t.tricom
    and s.centre = t.centre
    and p.email is not null
    and (t.centre in (select code from mail_parameters where user_name=user and mail_para='CENTRE')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='CENTRE'))
    and (t.tricom in (select code from mail_parameters where user_name=user and mail_para='TRIAL')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='TRIAL'))
    and (t.role in (select code from mail_parameters where user_name=user and mail_para='ROLE')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='ROLE'))
    and (p.country in (select code from mail_parameters where user_name=user and mail_para='COUNTRY')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='COUNTRY'))
    and (t.represent in (select code from mail_parameters where user_name=user and mail_para='REPRESENT')
    or 'XX' in (select code from mail_parameters where user_name=user and mail_para='REPRESENT'));
    This is in a program unit that runs when a button is clicked. At the end of that I need to add on the 3 case statements that help further narrow down the selection of emails to be printed. Then it prints the emails selected from this statement into a file. So it has to be done right in the select statement. The three table variables are the all_off_trt, all_deceased, and no_enroll. The form has 3 checkboxes. One for each, that when checked (giving the variable associated with the checkboxes a value of 'Y') excludes all emails that have a 'Y' in the coresponding table variable.

Maybe you are looking for

  • Boot Camp 3.0 and Windows 7 64-bit - My experiences/notes

    I just installed Boot Camp 3.0 from the Snow Leopard DVD onto my MacBook Pro 17 (Mid 09) which is running Windows 7 64bit RTM and had Boot Camp 2.1 previously installed on it. My experiences/notes: 1. The Boot Camp 3.0 installation automatically remo

  • Print the Long text in Smartform

    Hi all, I designed a Work order document using Smartform for the T-Code 'IW32'. I am able to print the Operation short text, but there is one more provision for the user to enter long text also. I am not getting where this text gets stored in the dat

  • Secure Map Rendering - Javascript API

    Hello All I need to apply secure mapping functionality using Mapviewer's JavaScript based API.Is it possible using cookie ?.Can you please give an example for this? Thank you

  • How to recover pictures

    I forgot my password to unlock my phone (4-ATT).  While attempting different passwords, the phone locked me out.  When I connected the phone to my MAC book Pro, it reset the phone.  Is there any way to recover the pics that I took previously?

  • How to Remove totals on few columns from SEM BPS layout

    On SEM BPS layout it has 10 5 charatestics columns and 10 key figure columns. out of these key figures I want see totals on some coulmns and for few columns I do not want to see totals. for wxample it does not make sense of seeing total under the sal