Query filter using a converted CLOB field

Hi,
I need to filter a query by a CLOB field on the database. When I just select the filed, the query runs successfully. But, when I try to filter by this CLOB field, converting it to Date or Char, I got an error message. I detail it step by step below.
Please, can somebody help me to figure out what is happening with this filter?
DB Version: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
Step 1- The Query works fine
SELECT TO_CHAR( CLOB_FIELD ) FIELD_CLOB_TO_CHAR1,
TO_CHAR(TO_DATE(TO_CHAR( CLOB_FIELD ), 'mm/dd/yyyy', 'NLS_DATE_LANGUAGE=PORTUGUESE'), 'dd/mm/yyyy') FIELD_CLOB_TO_CHAR2,
TO_CHAR(sysdate, 'dd/mm/yyyy', 'NLS_DATE_LANGUAGE=PORTUGUESE') SYSDATE_DATE_TO_CHAR,
TO_DATE(TO_CHAR( CLOB_FIELD ), 'mm/dd/yyyy') FIELD_CLOB_TO_DATE1,
TO_DATE( CLOB_FIELD, 'mm/dd/yyyy') FIELD_CLOB_TO_DATE2
FROM MY_TABLE
FIELD_CLOB_TO_CHAR1: 08/10/2012     
FIELD_CLOB_TO_CHAR2: 10/08/2012
SYSDATE_DATE_TO_CHAR: 23/07/2012
FIELD_CLOB_TO_DATE1: 10/08/2012
FIELD_CLOB_TO_DATE2: 10/08/2012
Step 2- Adding one of the filters below. I got the same error message for them:
and TO_DATE( CLOB_FIELD, 'mm/dd/yyyy') = to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy');
and TO_CHAR(TO_DATE(TO_CHAR( CLOB_FIELD ), 'mm/dd/yyyy', 'NLS_DATE_LANGUAGE=PORTUGUESE'), 'dd/mm/yyyy') = to_char(sysdate,'mm/dd/yyyy');
Report Error:
SQL Error: ORA-01858: a non-numeric character was found where a numeric was expected
01858. 00000 - "a non-numeric character was found where a numeric was expected"
*Cause:    The input data to be converted using a date format model was
incorrect. The input data did not contain a number where a number was
required by the format model.
*Action:   Fix the input data or the date format model to make sure the
elements match in number and type. Then retry the operation.
Regards,

user634269 wrote:
Keith, thanks again.
It works fine. I just changed the exception return to show more clearly in which record the problem is. I did:
when others
then
v_returndate := SYSDATE+3000;
But, I still have some doubts and I believe they are related:
1- The dates on CLOB_FIELD are recorded in "mm/dd/yyyy" format. So, when something like 08/09/2011 is found, the things work fine. But, when something like 12/20/2011 is found, I got the problem. I always believed that formatting dates would solve this kind of situation.
2- The function you suggested only converts a varchar parameter into a date value. (simple and clever). I changed the filter from "= sysdate" to "<= sysdate" and got 5 records only. It worked fine. But, considering that the function only applies TO_DATE() on a varchar parameter, why can I do this:
MY_TO_DATE( CLOB_FIELD, 'mm/dd/yyyy') <= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy');
and cannot one of these?
TO_DATE( CLOB_FIELD, 'mm/dd/yyyy') <= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy');
TO_DATE( to_char(CLOB_FIELD), 'mm/dd/yyyy') <= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy')
3- The first function parameter is VARCHAR, but I'm sending the CLOB_FIELD without any conversion. Does Oracle perform an implicit data conversion?
I really would like to understand how Oracle is working with all these things.
Regards.
>Keith, thanks again.
It works fine. I just changed the exception return to show more clearly in which record the problem is. I did:
when others
then
v_returndate := SYSDATE+3000;
But, I still have some doubts and I believe they are related:
1- The dates on CLOB_FIELD are recorded in "mm/dd/yyyy" format. So, when something like 08/09/2011 is found, the things work fine. But, when something like 12/20/2011 is found, I got the problem. I always believed that formatting dates would solve this kind of situation.
You must use the format mask which matches the format of data. Your date data is in the format mm/dd/yyyy and so you need to provide that format mask.
to_date('12/20/2011','mm/dd/yyyy') will cause the data to be correctly converted to a date
2- The function you suggested only converts a varchar parameter into a date value. (simple and clever). I changed the filter from "= sysdate" to "<= sysdate" and got 5 records only. It worked fine. But, considering that the function only applies TO_DATE() on a varchar parameter, why can I do this:
MY_TO_DATE( CLOB_FIELD, 'mm/dd/yyyy') <= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy');
This works because although the implicit conversion fails,  my function suppresses any error that is raised using the following exception block
exception
when others
then
    null;
and cannot one of these?
TO_DATE( CLOB_FIELD, 'mm/dd/yyyy') <= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy');
TO_DATE( to_char(CLOB_FIELD), 'mm/dd/yyyy') <= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy')
These do not work , because you are using the inbuilt functions which are raising errors.
if you change
when others
then
null; to
when others
then
raise; my function will no longer work. You should read the FAQ on exception handling. When others then null is used to suppress any error that is raised. This is not normally good practice.
3- The first function parameter is VARCHAR, but I'm sending the CLOB_FIELD without any conversion. Does Oracle perform an implicit data conversion?
Yes, oracle will try to do an implicit conversion whenever no  explicit conversion is specified.  You should always try to use explicit conversions rather than rely on implicit conversions.
>
I really would like to understand how Oracle is working with all these things.
A good start would be to read and understand the frequently asked questions provided by Blueshadow.
This is also a bad construct:
<= to_date(to_char(sysdate,'mm/dd/yyyy'), 'mm/dd/yyyy')
all you need here is sysdate. If you want to remove the time element, you can just use trunc(sysdate)

Similar Messages

  • Using Oracle Text with CLOB field containing multiple languages

    I'm using Oracle 10g (NLS_CHARACTERSET is set to. AL32UTF8) and have a table with a CLOB field which is storing text written in either English and/or Simplified Chinese.
    The following index has been created on this field:
    CREATE INDEX text_index
    ON text_table(text_field)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('FILTER CTXSYS.INSO_FILTER');
    I'm having issues in returning text which matches the Chinese text using the CONTAINS operator. For some reason the following query is returning rows which do not contain any Chinese text:
    SELECT *
    FROM text_table
    WHERE contains(text_field,'炫%') > 1;
    A newsgroup user advised me to produce an explain plan using ctx_query.explain.
    I created 2 explain plans, one which was searching the index for 'A%' and the other searching for the Simplified Chinese character '炫%'. The results for the first test were as expected whereby the values contained within the OBJECT_NAME field all began with the letter 'A'.
    The second test however produced somewhat unexpected results. The OBJECT_NAME field this time contained various words, both English and Simplified Chinese. I could be wrong but it appeared to store every individual word in the CLOB field. Both tests produced different EQUIVALENCE rows, the first test was:
    OPTIONS = Null
    OBJECT_NAME = A%
    Whereas the second test produced:
    OPTIONS = (?)
    OBJECT_NAME = %
    Am I right in thinking the Simplified Chinese character is for some reason being converted to a '?' character?
    Any help on this will be much appreciated.

    As you're not specifying a lexer to use, it will use the BASIC_LEXER, designed for space-separated European-type languages. This won't work effectively with Chinese.
    If you know which documents are Chinese and which are English, you can write this into a LANGUAGE column and use the MULTI_LEXER - this will allow you to specify BASIC_LEXER for the English texts, and CHINESE_LEXER or CHINESE_VGRAM_LEXER for the Chinese texts.
    If you don't know the language, you must use either WORLD_LEXER (10g) or AUTO_LEXER (11g). These lexers will automatically determine the language of the documents and index them appropriately. In general. MULTI_LEXER will be faster and more accurate than either of the automatic alternatives.
    When querying for Chinese characters you need to be very careful with your NLS_LANG settings. You need to make sure that the character set defined in NLS_LANG is the same as the character set from which you've pasted (or typed) the chinese characters.
    The "?" in output usually just means "I don't know how to translate this character into your output character set". Sometimes it may appear as a reversed question mark.

  • How can I use a variable in webi query filter

    I created a webi report using the fiscal year/month(period) field as a filter to show a window of 18 periods.  The report works just as requested using a between filter on fiscal period with prompts for both the start and ending periods.  Now I'd like to calculate the start period based on what was entered in the prompt for the ending period (e.g. enter 201106 for the TO prompt on the between statement and have the FROM statement filled in as 201001.)  I can create variables in the report to display both the user response to the ending period prompt and the calculated starting period, but I cannot figure out how to incorporate that calculated starting date into the FROM side of the between query filter.
    Any suggestions? 
    Thanks,
    Doug
    Sorry I got my froms and to's mixed up in the first draft. Edited by: Doug Roswold on Mar 4, 2011 6:27 PM

    Let me understand what you want to do.  You don't want to use two prompts, just one, insn't it?
    I mean, instead of:
    Filter area:
    Date between "From prompt" to "To Prompt"
    You want something like:.
    Filter area:
    Date between Variable  to "To Prompt"
    if I'm not wrong that's not possible to achieve in Webi Query  Panel.
    Can you modify your universe? The only way to achieve it is modifying your universe, creating your formula in the universe and assigning it to an object, so you can use this new object in your filter area like this:
    Date between MyUniverseObject  to "To Prompt"
    Edited by: PadawanGirl on Mar 4, 2011 8:15 PM

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • Empty CLOB field value from Oracle database using JDBC Sender

    Hi All,
    I am selecting a CLOB field from Oracle database table using JDBC Sender adapter and getting error "NullPointerException"
    Seen SAP note 1283089 but its not applicable for my support pack PI 7.0 SP 12 and client dont want to upgrdate SP 17 right now.
    I tried rpad(1,0)Column_Name funciton in JDBC select query but it selcting blank value for every record even those having some value for this CLOB field so not useful
    Could anybody suggest possible way? client dont want to change anything at database side.
    Thanks,
    Dharamveer

    What is the Oracle driver version installed? You might need to install 10.x driver if not already using it.

  • How to retrieve and use an XSL file from CLOB field

    I am using Java to query my data and return XML formatted data. I am able to format this data using an XSLStylesheet file. But I want to instead use an XSL Stylesheet stored in a clob field.
    I have an XSL file stored in a clob field. How can I retrieve and use it to initialize an XMLDocument and then create an XSLStylesheet.
    Thanks for your help,
    Les Smith

    I think this question has been raised before. Try searching this forum.

  • How to parse/extract XML from clob field using ODI

    Hi,
    I am very new to ODI. I have an oracle table which has clob field. This clob field contains xml. I would like to parse this xml and convert it to oracle table. Means I would like to make all the tags of xml as oracle table columns.
    I have created a PL/SQL procedure and used XMLTABLE function and I have achieved my goal. The same this I am trying to do with ODI. Since I am new to ODI so any help is appreciated.
    Thanks

    In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.

  • Problems in using CLOB field

    I am trying to use a clob field in a select statment and I am getting "Ora-00932: inconsistent datatypes" error.
    I am using Oracle 817.
    Any idea or fix?

    The reason your statement throws an error is because
    of the DISTINCT, not because of joins. Oracle can
    only do distinct on basic data types (CHAR, VARCHAR2,
    NUMBER and DATE). It tries to do an implicit
    conversion from CLOB to VARCHAR to do the DISTINCT.
    CLOBS over 4000 characters cannot be converted to
    VARCHAR2. So, even without any joins ...Agreed ... but my DISTINCT wasn't on the CLOB. It was on a VARCHAR2. Let me restate (hopefully a little more clearly) what I was referring too to see if you can think of any ways to do what I'm trying to do. The first example I know will work provided the CLOB doesn't contain over 4000 characters. The 2nd example (the same as the example originally mentioned) will not work. I'm wanting to do something like the 2nd example but with the same results as the first.
    EX #1: (will work)
    SELECT
    DISTINCT table1.varcharField1,
    table1.varcharField2,
    table2.varcharField3,
    DBMS_LOB.SUBSTR(table1.CLOBField4,DBMS_LOB.GETLENGTH(table1.CLOBField4)),
    table3.varcharField5
    FROM
    table1,
    table2,
    table3
    WHERE
    table1.varcharField1 = table2.varcharField1
    AND table1.varcharField1 = table3.varcharField1
    AND table1.varcharField2 = 'XYZ'
    EX #2: (will not work)
    SELECT
    DISTINCT table1.varcharField1,
    table1.varcharField2,
    table2.varcharField3,
    table1.CLOBField4,
    table3.varcharField5
    FROM
    table1,
    table2,
    table3
    WHERE
    table1.varcharField1 = table2.varcharField1
    AND table1.varcharField1 = table3.varcharField1
    AND table1.varcharField2 = 'XYZ'
    This is SQL for a report so the entire contents of the CLOB field are required. (In actuality, the dbase column should have originally been defined as a VARCHAR2. Since we already have other programs in place that hit these table fields, we can't arbitrarily go back and change it.) If we leave the first SQL example in place, it'll work but it'll cause the SQL to crash if the data in that field ever exceeds 4000 characters. That's why we're trying to do away with the DBMS_LOB.SUBSTR() method. BUT if we don't interpret the CLOB in some other fashion, it'll throw the ORA-00932 error because of a data inconsistencies.
    Any advice you could offer would certainly be appreciated.
    BJ

  • Error when using "inlist operator" in the query filter of Webi 3.1

    Hi,
    We are currently in the process of migrating Deski to webi (BOXI 3.1).
    The problem is, Deski is using the "inlist" operator which is working fine but after migrating to webi the inlist operator in the query filter is throwing the below error,
    *Error Message :*
    A database error occured. The database error text is: ORA-00907: missing right parenthesis. (WIS 10901)
    Appreciate your assistance on this.
    Thanks !
    Regards,
    Perialt

    Karthik ,
    Yes I am seeing an additional paranthesis in Webi SQL query.
    For example plz consider the product table below,
    SELECT
    Product.ID,
    Product.Name
    FROM Product
    WHERE
    Product.Name IN ( @Prompt('4) Name:','C','Product\Name-M',multi,free)  )
    As a work around in Custom SQL, If I remove the paranthesis the below query is running fine in webi
    SELECT
    Product.ID,
    Product.Name
    FROM Product
    WHERE
      Product.Name IN  @Prompt('4) Name:','C','Product\Name-M',multi,free) 
    But I want a permanent solution.

  • Export XML data from a CLOB field using sql developer

    I have a table that contains a CLOB field, each record is a complete XML in itself. After running the select query i am exporting this data by right clicking on the answer set, while the export completes the data for each record gets truncated.
    When i chose to save the export in loader format i get the complete records but now there are n files created for n records exported.
    Is there a way i can get alll the records in a single file wirthout any truncation.
    Thanks in advance!

    You might try delimited format or csv, with no enclosures if desired.

  • Getting table script using dbms_metadata.get_ddl, but with clob field

    So, Oracle 11g R2..
    I'm using dbms_metadata.get_ddl to get table scripts and it's working fine..
    now, I have a table with clob field, and it's not working... I got an 'missing right parenthesis (ora-0907)' error...
    I could paste a script that I got, but I don't think it makes any sense..
    does anybody have some experience on using this package on clob tables?
    tnx

    this is script that I got... it's long, and it looks like it's not good
    CREATE TABLE "COMMON"."TEST_AAA2"
       (    "ID" NUMBER(10,0),
        "TEKST" VARCHAR2(200 CHAR),
        "UPDATESTAMP" DATE,
        "OBJEKAT" CLOB,
         CONSTRAINT "TEST_PART_PK2" PRIMARY KEY ("ID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USERS"
      ALTER INDEX "COMMON"."TEST_PART_PK2"  UNUSABLE ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS  LOGGING
      STORAGE(
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT))
      PARTITION BY RANGE ("UPDATESTAMP")
    (PARTITION "P_201012"  VALUES LESS THAN (TO_DATE(' 2011-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201101"  VALUES LESS THAN (TO_DATE(' 2011-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201102"  VALUES LESS THAN (TO_DATE(' 2011-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_ARCHIVE"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201103"  VALUES LESS THAN (TO_DATE(' 2011-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201104"  VALUES LESS THAN (TO_DATE(' 2011-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_ARCHIVE"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201105"  VALUES LESS THAN (TO_DATE(' 2011-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201106"  VALUES LESS THAN (TO_DATE(' 2011-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_ARCHIVE"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201107"  VALUES LESS THAN (TO_DATE(' 2011-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_MAXVALUE"  VALUES LESS THAN (MAXVALUE)
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS )

  • SQL Query -How2bring multiple results into one field using Formatted Search

    Hi Everyone
    i am trying to bring in the results of the field dbo.Lot_ITEM.LOT using a formatted search into a row level using the following query:
    SELECT     dbo.LOT_ITEM.LOT
    FROM       dbo.DLN1 INNER JOIN dbo.LOT_ITEM ON dbo.DLN1.ItemCode = dbo.LOT_ITEM.ITEM
    WHERE     dbo.LOT_ITEM.ITEM=$[DLN1.ItemCode]
    however the result of the dbo.Lot_ITEM.LOT field could be more then one value depending on how many lots are assigned for that item
    (for example this query would be similar to assigning batch/serial numbers to an item being despatched - as you can choose multiple batches/serials depending on the quantities available and required and then move from the left to the right side of the selection window) if that makes sense!
    is it possible to bring in the multiple results into one field? and how can i amend the above query to include this?
    Thankyou in advance :o)
    Edited by: Asma Bi on Apr 23, 2008 7:22 PM
    Edited by: Asma Bi on Apr 23, 2008 7:24 PM

    Hi Suda
    Thanks for replying :o) but im not sure about the query?
    just to simplify it (as the query im working with is to do with 3rd party addons) i have used the serial/batchs field instead and used standard demo database fields from SBO 2005 sp01:
    SELECT     dbo.ixvSerialNoFact.SRI1_IntrSerial
    FROM       dbo.DLN1 INNER JOIN
                    dbo.ixvSerialNoFact ON dbo.DLN1.DocEntry = dbo.ixvSerialNoFact.SRI1_BaseEntry
    WHERE     dbo.ixvSerialNoFact.ItemCode='g1000' and dbo.ixvSerialNoFact.SRI1_BaseEntry = '193'
    The above brings me the relevant results but when i change it to be used in a formatted search:
    SELECT     dbo.ixvSerialNoFact.SRI1_IntrSerial
    FROM       dbo.DLN1 INNER JOIN
                    dbo.ixvSerialNoFact ON dbo.DLN1.DocEntry = dbo.ixvSerialNoFact.SRI1_BaseEntry
    WHERE     dbo.ixvSerialNoFact.ItemCode=$[dln1.itemcode] and dbo.ixvSerialNoFact.SRI1_BaseEntry = $[dln1.DocEntry]
    i cant seem to get it to work - now this may be because the serial number is not allocated until teh record is added to the system, however when this happens i am unable to go back in and manually trigger the query as the delivery note rows cannot be selected!
    i  think as what im originally wanting an answer for is same as this example, im wanting to know if this is even possible?
    Thanks
    Edited by: Asma Bi on Apr 24, 2008 3:53 PM
    Edited by: Asma Bi on Apr 24, 2008 3:55 PM

  • Use Yesterday as variable for Query Filter

    Post Author: rrburton
    CA Forum: WebIntelligence Reporting
    I want to have a query filter that refers to the previous day.  In regular SQL I would use something like "= trunc(sysdate)-1".  I don't see any option for doing it this way in web intelligence, the closest it comes is selecting object and then assigning the Beginning of Last Week item from the System Date table.  What am I missing?

    Post Author: rrburton
    CA Forum: WebIntelligence Reporting
    Nevermind - I figured it out just now.  It isn't very intuitive.  In the Objects and Variables dialog in the SystemDate table there are a bunch of items like 1 day, 2 days, etc. and you select one of those and then in the code it looks like:
    WHERE   PKG_NTD_CONV.TO_ORCL_DATE(TROUBLE_TICKET_ARCHIVE.CREATE_DATE)  =  ( sysdate )-1
    It should say something like 1 day ago, 2 days ago, etc.

  • Is it possible to write a result of query to a CLOB field in another table

    Hi all,
    I have a table with 50 columns which will ideally have around 250,000 rows. I want to select all the rows from this table and insert the result in to another
    table's CLOB or BLOB column. ( I think CLOB is preferred for strings !!)
    f.i
    Table1 : SELECT ID, COL1||','||COL2||','||COL3||','||COL4||','||COL5 FROM TF_TEMPREP
    ORDER BY COL1
    will have the output
    A001, 1,ABN LAYOUT,01-APR-11,30-APR-11,REMARK1
    A001, 2,CTS ,01-APR-11,10-APR-11,REMARK2
    A001, 3,BTS,01-APR-11,20-APR-11,REMARK3
    A001, 4,CWWS,01-JAN-11,31-JAN-11,REMARK4
    A001, 5,ZYNC,01-MAR-11,31-MAR-11,REMARK5
    I would like to store these rows into another table (TF_TEMPREP_OUTPUT) CLOB/BLOB column ,
    so the table TF_TEMPREP_OUTPUT will have one row with all the rows from TF_TEMPREP in the CLOB/BLOB column.
    TF_TEMPREP_OUTPUT will have column OUTPUTID (VARCHAR2) , OUTPUTDATA (CLOB DATATYPE)
    Will this be possible !!.
    Thanks in advance
    Regards
    Murali

    Hi all
    Thanks for your reply,
    The reason we would like to store the data in a CLOB file is that,
    Currently we are fetching the data from the table TF_TEMPREP and the recordset is passed into a function and writing the ouput to a CSV file in the local drive using the VB (front end application). once the process is completed, the temporary table will be deleted. this is used only for printing purpose.
    we are using the VB function
    Public Function RecordsetToCSV(rsData As ADODB.Recordset, pFileSeparator As String, Optional ShowColumnNames As Boolean = True, Optional NULLStr As String = "") As String
    Dim k As Long
    Dim RetStr As String
    On Error GoTo Errh
    If ShowColumnNames Then
    For k = 0 To rsData.Fields.Count - 1
    RetStr = RetStr & pFileSeparator & """" & rsData.Fields(k).Name & """"
    Next k
    RetStr = Mid(RetStr, 2) & vbNewLine
    End If
    rsData.MoveFirst
    RetStr = RetStr & """" & rsData.GetString(adClipString, -1, """" & pFileSeparator & """", """" & vbNewLine & """", NULLStr)
    RetStr = Left(RetStr, Len(RetStr) - 3)
    RecordsetToCSV = RetStr
    Exit Function
    Errh:
    RecordsetToCSV = ""
    Exit Function
    End Function
    But in this operation, as the number of records is more the system often throws out with the message "Not enough storage is available to complete this operation.". The Local HD is having around 50GB of free space. when we have less number of records (say around 30-40K), the above process works perfectly.
    Storing the File in the database server will be an issue, as the database server will be in a different location and it will not be possible/advisable to access the
    local directory thru mapped directory in the database server.
    our plan was if the data is available in a clob field, then we could try to read the clob and write to a file in the local directory thru our VB application itself. Not sure, will this also gives a same error as it was giving when reading from the table?.
    Hope I have clarified what we are aiming at.
    Regards
    Murali

  • Convert a field to_number and use formatmask

    I like to convert a field into a number SRW.Set_field(0, to_number(:fieldname));
    as well create this mask 'N.NNN.NNN.NNN.NNN.NNN'
    SRW.SET_FORMAT_MASK('N.NNN.NNN.NNN.NNN.NNN'); or SRW.ATTR.FORMATMASK := 'N.NNN.NNN.NNN.NNN.NNN';
    All this srw doesn't work, why?

    The field doesn't have a datatype. The field's datatype is picked up from the column that is its source. Therefore, the datatype of a field is fixed at runtime and can't be changed.
    The srw.set_field_number() built-in only sets the value of a field, it doesn't change the field's type. If the datatype of the source column for a field was not "number" then the above call would have no effect.
    Likewise, the srw.set_format_mask() built-in only effects fields whose datatype is number.
    It sounds like what you're doing is trying to display both Character and Number values in a single field. The only way to do this with a single field is to base the field on a character column and do the formatting either in the SQL or PL/SQL that is the source of the column. This will limit you to the format masks available in both SQL or PL/SQL.
    Another way of doing it is to create 2 fields. One for the number value and one for the character value. Place the fields on top of each other and use format triggers to display one or the other. You can then use the srw.set_format_mask() against the number field if required.

Maybe you are looking for