what to use clob or varchar for more then 4000 char

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default what to use clob or varchar for more then 4000 char

    I have couple columns that require 40000 bytes.
    What is better approach?
    1. use Clob data type or
    2. create second table with one to many relationship and store information as
    varchar

    PROCEDURE sp_test(inPar in LONG)is
    str_1_var varchar(4000);
    str_2_var varchar(32000);
    no_of_cuts number(10);
    begin
    if inPar is not null then

    no_of_cuts := ROUND_UP(length(inPar)/3500);

    str_2_var := inPar;

    For loop_index in 1..no_of_cuts loop
    str_1_var := substr(str_2_var,tmp,3500);
    str_2_var := substr(str_2_var,3501);
    INSERT INTO TEST_INS(TEST_ID,FUND)VALUES(loop_index,str_1_var) ;
    End loop;
    End if;
    end sp_test;


    First approach is seems easy but it is not easy to work with in a future.
    CLOB working slow with searching (like '%some_search%')
    CLOB can store up to 2 GB - little bit overkill does it?
    Second is sound better to me because it has power of using all Oracle string
    function in search.
    Only one inconvenience that string has to be cut and then concatenated back
    together before displaying to user.


    I would appreciate any opinion on this.

    volk Guest

  2. Similar Questions and Discussions

    1. #25777 [Csd]: char and varchar fields are being rtrimmed (and also ltrimmed?) using freetds
      ID: 25777 Updated by: fmk@php.net Reported By: duh at dowebwedo dot com Status: Closed Bug Type: MSSQL...
    2. #25777 [Opn->Csd]: char and varchar fields are being rtrimmed (and also ltrimmed?) using freetds
      ID: 25777 Updated by: iliaa@php.net Reported By: duh at dowebwedo dot com -Status: Open +Status: ...
    3. #25777 [Fbk->Opn]: char and varchar fields are being rtrimmed (and also ltrimmed?) using freetds
      ID: 25777 User updated by: duh at dowebwedo dot com Reported By: duh at dowebwedo dot com -Status: Feedback...
    4. #25777 [Opn->Fbk]: char and varchar fields are being rtrimmed (and also ltrimmed?) using freetds
      ID: 25777 Updated by: sniper@php.net Reported By: duh at dowebwedo dot com -Status: Open +Status: ...
    5. #25777 [NEW]: char and varchar fields are being rtrimmed (and also ltrimmed?) using freetds
      From: duh at dowebwedo dot com Operating system: Debian GNU/Linux 3.0 PHP version: 4.3.4RC1 PHP Bug Type: MSSQL related Bug...
  3. #2

    Default Re: what to use clob or varchar for more then 4000 char

    If the biggest concern is searching, with both clob and varchar you
    can use Oracle's Text which will outperform '%searchstring%' in
    most cases.

    It's also very flexible in the way it can be configured (stop words, thesaurus,
    case sensitive/insensitive, near operator, ...

    I'm not aware of any Oracle string functions that don't work with clob.

    tconley Guest

  4. #3

    Default Re: what to use clob or varchar for more then 4000 char

    Thank you for reapply.
    Could you give some examples for ?Oracle's Text? I am not sure I understand
    completely.

    Please correct me if I am wrong but it looks like all of them does not work.
    For example:

    SQL> select length(tmp_column)from tbl_test;
    LENGTH(tmp_column)
    ------------
    3500

    SQL> select lenght(tmp_column_CLOB)from tbl_test;
    select lenght(tmp_column_CLOB)from test_ins
    *
    ERROR at line 1:
    ORA-00904: invalid column name

    So to do any operation with clob you have to use DBMS_LOB.


    Cold fusion acting very interesting.
    If you are queering the table with CLOB all Cold Fusion string functions will
    work until you need to work with CLOB that are more then 32000 bytes and you
    have to specified in Cold Fusion Administrator ? data sources option ?Enable
    long text retrieval (CLOB)? then all Cold Fusion string functions will stop
    work. Imaging if somebody uses a lot of string functions before enabling this.


    volk Guest

  5. #4

    Default Re: what to use clob or varchar for more then 4000 char

    I don't have the problem with length you're describing using Oracle 9.2,
    Coldfusion MX 6.1

    We do use DBMS_LOB.Substring but that was more for performance on the
    backed, if I remember correctly.

    On Oracle Text from the documentation:
    "Oracle Text provides indexing, word and theme searching, and viewing
    capabilities for text" it's like Verity but built into the database

    go here and search for "Text Application Developers Guide"
    [url]http://otn.oracle.com/pls/db10g/portal.portal_demo3?selected=5[/url]



    tconley Guest

  6. #5

    Default Re: what to use clob or varchar for more then 4000 char

    We are using Oracle 8i and we do have those restriction. It looks like oracle
    improving CLOB. Let me ask you design question: Will it be good idea to put
    CLOB columns into another table and connect to main table with one to one
    relationship so my main table will not have restriction? What do you think?
    For example :

    LOB Features Introduced in Oracle9i Release 2

    Parallel Execution Support for DML Operations on LOBs

    Support for parallel execution of the following DML operations on tables with
    LOB columns is introduced in this release. These operations run in parallel
    execution mode only when performed on a partitioned table. If the table is not
    partitioned, then these operations run in serial execution mode.
    _ INSERT AS SELECT
    _ CREATE TABLE AS SELECT
    _ DELETE
    _ UPDATE
    _ MERGE (conditional UPDATE and INSERT)
    _ Multitable INSERT


    volk Guest

  7. #6

    Default Re: what to use clob or varchar for more then 4000 char

    ..
    volk Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139