How to use DATE in the where clause

I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and
select query used to get the list of records
CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),CREATION_DATE DATE,AVAILABLE_DATE DATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(1,'ITEM1',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(2,'ITEM2',SYSDATE,SYSDATE+10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(3,'ITEM3',SYSDATE,SYSDATE-10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(4,'ITEM4',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(5,'ITEM5',SYSDATE,SYSDATE+5);
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date > SYSDATE OR available_date LIKE SYSDATE;I am getting the expected records but i am not able to find a condition where i can use *>=* for date data type, a query like the below one is
not returning expected records
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date >= SYSDATE ;Edited by: Balaji on Mar 19, 2012 9:13 PM

Hi,
Balaji wrote:
I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and
select query used to get the list of records
CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),CREATION_DATE DATE,AVAILABLE_DATE DATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(1,'ITEM1',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(2,'ITEM2',SYSDATE,SYSDATE+10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(3,'ITEM3',SYSDATE,SYSDATE-10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(4,'ITEM4',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(5,'ITEM5',SYSDATE,SYSDATE+5);
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date > SYSDATE OR available_date LIKE SYSDATE;
Both operands to LIKE are supposed to be strings. Don't try to use a DATE, such as SYSDATE, with LIKE.
I am getting the expected records but i am not able to find a condition where i can use *>=* for date data type, a query like the below one is
not returning expected records
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date >= SYSDATE ;
It's returning the results I expect.
If you'd say what results you were expecting, someone could help you wite a query to get them.
Assuming 1 second elapses between the time 'ITEM4' is inserted and the time the 2nd query is run, then, at run-time, available_date will be 1 second less than SYSDATE, so it should not be included.
If you want to find rows that are on the same calendar day as SYSDATE, or later, then use
WHERE    available_date >= TRUNC (SYSDATE)

Similar Messages

  • Can I use SYSDATE in the WHERE clause to limit the date range of a query

    Hi,
    Basicaly the subject title(Can I use SYSDATE in the WHERE clause to limit the date range of a query) is my question.
    Is this possible and if it is how can I use it. Do I need to join the table to DUAL?
    Thanks in advance.
    Stelios

    As previous poster said, no data is null value, no value. If you want something, you have nvl function to replace null value by an other more significative value in your query.<br>
    <br>
    Nicolas.

  • How to use CASE stmt in Where clause

    Hi,
    How to use CASE stmt in WHERE clause?. I need the code. Please send me as early as possible..........

    Hi,
    1004977 wrote:
    Hi,
    How to use CASE stmt in WHERE clause?. There's no difference between how a CASE expression is used in a WHERE clause, and how it is used in any other clause. CASE ... END always returns a single scalar value, and it can be used almost anywere a single scalar expression (such as a column, a literal, a single-row function, a + operation, ...) can be used.
    CASE expressions aren't needed in WHERE clauses very much. The reason CASE expressions are so useful is that they allow you to do IF-THEN-ELSE logic anywhere in SQL. The WHERE clause already allows you to do IF-THEN-ELSE logic, usually in a more convenient way.
    I need the code.So do the peple who want t help you. Post a query where you'd like to use a CASE expression in the WHERE clause. Post CREATE TABLE and INSERT statements for any tables used unless they are commonly available, such as scott.emp). Also, post the results you want from that sample data, and explain how you get those resuts from that data.
    See the forum FAQ {message:id=9360002}
    Please send me as early as possible..........As mentioned bfore, that's rude. It's also self-defeating. Nobody will refuse to help you because you don't appear pushy enough, but some people will refuse to help you if you appear too pushy.

  • Performance with dates in the where clause

    Performance with dates in the where clause
    CREATE TABLE TEST_DATA
    FNUMBER NUMBER,
    FSTRING VARCHAR2(4000 BYTE),
    FDATE DATE
    create index t_indx on test_data(fdata);
    query 1: select count(*) from TEST_DATA where trunc(fdate) = trunc(sysdate);
    query 2: select count(*) from TEST_DATA where fdate between trunc(sysdate) and trunc(SYSDATE) + .99999;
    query 3: select count(*) from TEST_DATA where fdate between to_date('21-APR-10', 'dd-MON-yy') and to_date('21-APR-10 23:59:59', 'DD-MON-YY hh24:mi:ss');
    My questions:
    1) Why isn't the index t_indx used in Execution plan 1?
    2) From the execution plan, I see that query 2 & 3 is better than query 1. I do not see any difference between execution plan 2 & 3. Which one is better?
    3) I read somewhere - "Always check the Access Predicates and Filter Predicates of Explain Plan carefully to determine which columns are contributing to a Range Scan and which columns are merely filtering the returned rows. Be sceptical if the same clause is shown in both."
    Is that true for Execution plan 2 & 3?
    3) Could some one explain what the filter & access predicate mean here?
    Thanks in advance.
    Execution Plan 1:
    SQL> select count(*) from TEST_DATA where trunc(fdate) = trunc(sysdate);
    COUNT(*)
    283
    Execution Plan
    Plan hash value: 1486387033
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 9 | 517 (20)| 00:00:07 |
    | 1 | SORT AGGREGATE | | 1 | 9 | | |
    |* 2 | TABLE ACCESS FULL| TEST_DATA | 341 | 3069 | 517 (20)| 00:00:07 |
    Predicate Information (identified by operation id):
    2 - filter(TRUNC(INTERNAL_FUNCTION("FDATE"))=TRUNC(SYSDATE@!))
    Note
    - dynamic sampling used for this statement
    Statistics
    4 recursive calls
    0 db block gets
    1610 consistent gets
    0 physical reads
    0 redo size
    412 bytes sent via SQL*Net to client
    380 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    Execution Plan 2:
    SQL> select count(*) from TEST_DATA where fdate between trunc(sysdate) and trunc(SYSDATE) + .99999;
    COUNT(*)
    283
    Execution Plan
    Plan hash value: 1687886199
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 9 | 3 (0)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 9 | | |
    |* 2 | FILTER | | | | | |
    |* 3 | INDEX RANGE SCAN| T_INDX | 283 | 2547 | 3 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter(TRUNC(SYSDATE@!)<=TRUNC(SYSDATE@!)+.9999884259259259259259
    259259259259259259)
    3 - access("FDATE">=TRUNC(SYSDATE@!) AND
    "FDATE"<=TRUNC(SYSDATE@!)+.999988425925925925925925925925925925925
    9)
    Note
    - dynamic sampling used for this statement
    Statistics
    7 recursive calls
    0 db block gets
    76 consistent gets
    0 physical reads
    0 redo size
    412 bytes sent via SQL*Net to client
    380 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows
    Execution Plan 3:
    SQL> select count(*) from TEST_DATA where fdate between to_date('21-APR-10', 'dd-MON-yy') and to_dat
    e('21-APR-10 23:59:59', 'DD-MON-YY hh24:mi:ss');
    COUNT(*)
    283
    Execution Plan
    Plan hash value: 1687886199
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 9 | 3 (0)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 9 | | |
    |* 2 | FILTER | | | | | |
    |* 3 | INDEX RANGE SCAN| T_INDX | 283 | 2547 | 3 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter(TO_DATE('21-APR-10','dd-MON-yy')<=TO_DATE('21-APR-10
    23:59:59','DD-MON-YY hh24:mi:ss'))
    3 - access("FDATE">=TO_DATE('21-APR-10','dd-MON-yy') AND
    "FDATE"<=TO_DATE('21-APR-10 23:59:59','DD-MON-YY hh24:mi:ss'))
    Note
    - dynamic sampling used for this statement
    Statistics
    7 recursive calls
    0 db block gets
    76 consistent gets
    0 physical reads
    0 redo size
    412 bytes sent via SQL*Net to client
    380 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed

    Hi,
    user10541890 wrote:
    Performance with dates in the where clause
    CREATE TABLE TEST_DATA
    FNUMBER NUMBER,
    FSTRING VARCHAR2(4000 BYTE),
    FDATE DATE
    create index t_indx on test_data(fdata);Did you mean fdat<b>e</b> (ending in e)?
    Be careful; post the code you're actually running.
    query 1: select count(*) from TEST_DATA where trunc(fdate) = trunc(sysdate);
    query 2: select count(*) from TEST_DATA where fdate between trunc(sysdate) and trunc(SYSDATE) + .99999;
    query 3: select count(*) from TEST_DATA where fdate between to_date('21-APR-10', 'dd-MON-yy') and to_date('21-APR-10 23:59:59', 'DD-MON-YY hh24:mi:ss');
    My questions:
    1) Why isn't the index t_indx used in Execution plan 1?To use an index, the indexed column must stand alone as one of the operands. If you had a function-based index on TRUNC (fdate), then it might be used in Query 1, because the left operand of = is TRUNC (fdate).
    2) From the execution plan, I see that query 2 & 3 is better than query 1. I do not see any difference between execution plan 2 & 3. Which one is better?That depends on what you mean by "better".
    If "better" means faster, you've already shown that one is about as good as the other.
    Queries 2 and 3 are doing different things. Assuming the table stays the same, Query 2 may give different results every day, but the results of Query 3 will never change.
    For clarity, I prefer:
    WHERE     fdate >= TRUNC (SYSDATE)
    AND     fdate <  TRUNC (SYSDATE) + 1(or replace SYSDATE with a TO_DATE expression, depending on the requirements).
    3) I read somewhere - "Always check the Access Predicates and Filter Predicates of Explain Plan carefully to determine which columns are contributing to a Range Scan and which columns are merely filtering the returned rows. Be sceptical if the same clause is shown in both."
    Is that true for Execution plan 2 & 3?
    3) Could some one explain what the filter & access predicate mean here?Sorry, I can't.

  • How to use string operation in where clause of select query

    Hello All,
    I just want to know how can i write a restriction in select query saying retrive data only begins with name "DE*".
    Explaination: If my table has records and names starts with character then i want to write a query to fetch all the records in which names starts with DE*.
    Thanks in advance for your quick reply...
    Dev.

    Hi
    In the where clause you need to write like
    WHERE NAME LIKE 'DE%'
    Regards
    Sudheer

  • How to use between timestamp in where clause

    Hi All,
    i have a colum column2 of data type timestamp.now i wants to fatch record having between two date of column2.how to use between operator in where condition having column as timespamp'

    Hi,
    You can use a timestamp literal, or use a function that return a timestamp datatype, here is an example:
    (TIMESTAMP 'YYYY-MM-DD HH24:MI:SS.FF')
    select * from yourtable where column2 between TIMESTAMP '1997-01-31 09:26:50.12' and  systimestampHave a look to the documentation, for example http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch4datetime.htm

  • Query Builder won't apply chosen date to the where clause

    Does anybody know why when I chose a date field, in the where clause, when using Query Builder, it won't actually write the chosen date to the actual query?
    If I select the "View Query" tab, no date shows up. Also if I press the "Run Report" button in the "View Result" tab, I get this error:
    "An error was encountered performing requested operation: ORA-00936: missing expression"
    This is because actual date data is missing.
    After I hit the "Apply" button, I have to manually type the date data.
    I thought this was a bug of the previous version, but I just installed version 1.5.4 and I have no different result.
    Thanks.

    I just wanted to add my name to the list of people having this issue.
    Oracle Techies, please help.

  • How to use Alias Columns in WHERE CLAUSE

    Hi ,
    I have a query where in there are 2 alias columns, start_date and end_date where in i need to use them in my WHERE clause as start_date < end_date. Please let me know if this is possible. please see the bwlow query
    SELECT (GREATEST (MIN (a.start_date_active),
    MIN (b.start_date_active),
    MIN (c.start_date_active),
    d.start_date_active ) start_date ,
    LEAST (MAX (NVL (a.end_date_active, b.end_date_active)),
    MAX (c.end_date_active),
    MAX (b.end_date_active),
    NVL (d.end_date_active,'31-DEC-2099')) end_date,
    c.terr_id,
    a.source_number,
    e.resource_id mgr_resource_id,
    d.role_relate_id role_relate_id
    ,g.resource_id
    FROM table1 a,
    table5 e,
    table4 d,
    table6 f,
    table7 g,
    table8 h ,
    table2 b,
    table3 c,
    table9 i
    WHERE 1=1
    AND b.resource_id = g.resource_id
    AND c.terr_id = b.terr_id
    AND to_number (c.attribute3) = i.party_id
    AND a.source_number = UPPER (e.salesrep_number)
    AND d.role_resource_type = 'RS_INDIVIDUAL'
    AND e.resource_id = d.role_resource_id
    AND d.role_id = f.role_id
    AND (a.start_date_active <= b.end_date_active
    AND (NVL (a.end_date_active, b.end_date_active) >= b.start_date_active))
    AND h.resource_id = a.resource_id
    AND UPPER (g.salesrep_number) = h.source_number
    GROUP BY a.source_number, c.terr_id, e.resource_id,d.start_date_active,d.end_date_active,d.role_relate_id,g.resource_id
    Thanks,
    Lakshmi

    I did not understand your query but have you tried using the HAVING clause?
    HAVING clause allows you to use a "where" like condition for your groupings.
    See http://www.techonthenet.com/sql/having.php for some examples.
    Sandeep Gandhi

  • How to use alias name in where clause

    Hello,
    DECODE (item.inv_type,'OT', (DECODE (item.attribute2, 'STONE', 0, xfer.release_quantity1 * xfer.attribute10)
    'FG', (xfer.release_quantity1 * xfer.attribute10)
    ) matl_val
    In the above code matl_val is alias name i need to use that one in where clause as
    where matl_val > 0
    is this possible or anyother way can anyone help me.

    But the point is as you haven't read the documentation you may miss some valuable points about alias and will soon end with another problem.
    >
    Specify an alias for the column expression. Oracle Database will use this alias in the column heading of the result set. The AS keyword is optional. The alias effectively renames the select list item for the duration of the query. The alias can be used in the order_by_clause but not other clauses in the query.
    >
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702

  • How to use case function in where clause

    Hi,
    Suppose a table DEMO has columns
    DEMO TABLE
    user_id
    user_name
    location
    In this table i have 15 users. but out of 15 users i want to use only 5 users for passing as user_name.
    then how to achieve the result
    1. when i pass the particular 5 user_name in where clause then i should get all the user_name and for other 10 users it will show only the passing user_name.
    how to use case function

    Do you mean this ?
    SQL> var name varchar2(10)
    SQL> exec :name := 'ALLEN'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> exec :name := 'SMITH'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> exec :name := 'BLAKE'
    PL/SQL procedure successfully completed.
    SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
      2  else :name end = ename;
    ENAME
    BLAKERgds.

  • How to use division with a Where() clause

    I have to report four specific time periods dynamically so I made Date variables. I cannot use division of the metrics without applying the date codes to the individual metrics. There has to be a way I am not thinking of. This is a massive report so I need to keep variables to a minimum.
    Example:
    [Sales 1] / [Quota 1] = Percent to Quota
    I have a Date Variable for Quarter to Date: [Months in QTD] That returns multiple "Fiscal Periods" (months) per date formulas
    However, to get the right time period data using DIVISION, say for Quarter To Date I have to use:
    [Sales 1] Where( [Fiscal Period] = [Months In QTD]) / [Quota 1] Where( [Fiscal Period] = [Months In QTD])
    The above returns the correct value for the three months in the quarter.
    That would be OK except I need an IF..Then..ElseIf..Else statement to solve for zeros and nulls and it gets very long adding the “Where( [Fiscal Period] = [Months In QTD])” to every measure in the statement.
    I have tried nesting:  =(SUM(  [Sales 1] ) / Sum( [Quota 1) ) Where( [Fiscal Period] = [Months In QTD])
    And that does not work as with other attempts to nest.
    I tried an IF( [Fiscal Period] = [Months In QTD] … but it returns MULTI error I assume becaause the variable [Months in QTD] delivers more that one Fiscal Period.
    Come on brainac’s.  Division has its own rules but there should be a way.
    Thank you.

    Hi,
    Just to give you rough idea. I would suggest you to apply following logic at query level.
    Create a query with prompt and try to get Months in QTD there only a single object.
    Now apply filter on second query "where result from another query" that will filter data for perticular quarter.
    I hope you can understand.
    Thanks,
    Swapnil

  • Cursor did not return data if using variables in the where clause

    ENV: report builder 9.0.4.3.0, DB 10g, OS XP
    table and data ctvctyp:
    ctvctyp_code    ctvctyp_code_pred
       CO               Z1
       FE                   Z1
    FUNCTION get_case_type(case_type VARCHAR2) RETURN VARCHAR2 IS
      cursor  type_cur is
        select ctvctyp_code
        from ctvctyp
        where ctvctyp_code_pred = :P_case_type; -- if use 'Z1', it will return 'CO','FE'
                                                -- but if 'Z1' is passed in as case_type, it returns null.
      temp_type     VARCHAR2(4);
      return_type   VARCHAR2(200);
      counter       NUMBER;
    BEGIN
         return_type := '';
         counter := 0;
         srw.message(20,'in case_type is '||case_type);
         open type_cur;
         LOOP
              FETCH type_cur INTO temp_type;
              EXIT WHEN type_cur%NOTFOUND;
              counter := counter+1;
              if temp_type is NULL then
                   srw.message(20,'temp type is null');
              else
                srw.message(20,temp_type);
              end if;
              if counter = 1 then
                   return_type := ''''||temp_type||'''';
              else
                   return_type := return_type||','''||temp_type||'''';
              end if;     
         END LOOP;
         return return_type;
    END;
    In my p_casetype validation trigger:
    function P_CaseTypeValidTrigger return boolean is
         tempCaseType   VARCHAR2(200);
         return_type    VARCHAR2(200);
    begin
        :P_CASETYPE := 'Z1'
        return_type := get_case_type;   --- I got null returned.
      return (TRUE);
    end;
    But in sqlplus:
    declare a bind variable :P_casetype := 'Z1';
    select get_case_type from dual;
    returns:   'FE','MI'

    cursor type_cur is
    select ctvctyp_code
    from ctvctyp
    where ctvctyp_code_pred = _{color:#0000ff}*:P_case_type;*_{color}Shouldn't be this :p_casetype instead of :p_case_type?

  • Using ROWID in the WHERE clause of a SELECT statement

    hi all,
    my team is trying to select a value from a table using the rowid as the selection criterion
    e.g. select column_name from table_name where rowid > 'AAA112BBBCCC12A'
    this query does not appear to return accurate results e.g. it return rows instead of two. my questions are:
    1. is this a legitimate approach?
    2. should we convert the row id to varchar2? if so how should this be done?
    thanks!

    SQL> select rowid,ename
      2  from emp;
    ROWID              ENAME
    AAAs8KAA+AAAVXCAAA KING
    AAAs8KAA+AAAVXCAAB BLAKE
    AAAs8KAA+AAAVXCAAC CLARK
    AAAs8KAA+AAAVXCAAD JONES
    AAAs8KAA+AAAVXCAAE SCOTT
    AAAs8KAA+AAAVXCAAF FORD
    AAAs8KAA+AAAVXCAAG SMITH
    AAAs8KAA+AAAVXCAAH ALLEN
    AAAs8KAA+AAAVXCAAI WARD
    AAAs8KAA+AAAVXCAAJ MARTIN
    AAAs8KAA+AAAVXCAAK TURNER
    AAAs8KAA+AAAVXCAAL ADAMS
    AAAs8KAA+AAAVXCAAM JAMES
    AAAs8KAA+AAAVXCAAN MILLER
    AAAs8KAA+AAAVXCAAO erwer
    15 rows selected.
    SQL> select ename from emp where rowid = 'AAAs8KAA+AAAVXCAAH';
    ENAME
    ALLEN
    SQL> select ename from emp where rowid > 'AAAs8KAA+AAAVXCAAH';
    ENAME
    WARD
    MARTIN
    TURNER
    ADAMS
    JAMES
    MILLER
    erwer
    7 rows selected.1) using rowid to access a record is the quickest way so it is legitimate
    however using > has no real purpose as you point out you cannot get any meaningful results returned.
    2) No real need to convert however beware storing values in tables as Oracle does not guarantee to preserve the format in different versions so upgrading from 9i to 10g would invalidate your data.

  • Using CLOB datatypes in WHERE clause

    Hi All,
    I have a table with two columns as CLOB datatype. I'm using Oracle 8i Enterprise Edition. I can do a query, insert, update and even delete the data in the CLOB field using Oracle's SQL Plus.
    What I want is to do a search on those fields.. that is include that field in a WHERE clause. I'm using this datatype to store large number of data.
    I'd like to see this query working...
    SELECT * FROM MyTable WHERE CLOBFLD LIKE 'Something...';
    Now this query doesn't work. It returns: 'Inconsistent datatype' near the word CLOBFLD.
    Please Help me out.
    Regards,
    Gopi
    null

    I presume you want to query based on the contents of the CLOB, right ? If that is true, then you have to create a text index, using Oracle Context and then use "Contains" in the where clause to query. Hope this helps.

  • Use "ListContains' in a WHERE clause

    I believe I have a syntax problem and could you some help.
    First, I have a field in an Access DB called 'degree" that conatins
    a list of numbers. This list can be any combination of the numbers
    4 through 32. On my search page I have a selection box in a form to
    select a value of the degree to search for. The variable passed
    from the form is called "degreeValue". I have a component that lets
    me build my WHERE clause using several seach criteria. It functions
    perfectly prior to adding the search for "degree". I attempted to
    use "ListContains" in the WHERE clause using "degree" as the name
    of my list and "degreeValue" as my substring to search for. The
    error I get says that "variable degree is undefined". I am
    attaching the full code of the compoanent so you can see it. Again,
    it works if you take out the subclause build for "degree".

    I understand what you are saying and in other situations have
    done my tables that way. I didn't this time because this is one of
    those... "add it later" kind of things. Yes, the field does look
    like "1,2,3,4,etc.." The inventory a couple thousand items each
    with a number (catno). As you obviously noticed the inventory table
    houses most of the data for the items. The "degree" field in the
    past was only used to populate a series of checkboxes and was not
    searchable, thus a list was used.
    With a possibility of 29 values for "degree" and a
    possiblility of over 2,000 inventory items you can see a newly
    created table might become quite large. It would be nice if I could
    use the current structure.
    You are absolutely correct saying the design should be
    different. Thank you for your quick reply and good information.

Maybe you are looking for