Calculate total size of clob column in a table

how to Calculate total size of clob column in a table.
Thanks ,
Sakthivel

SAKTHIVEL wrote:
I would like to calculate table size and particular clob column size inside that table. The size of the table and the size of the LOB are two totally different things.
Barring cases where the LOB is less than 4k and stored inline, the LOB data is stored outside the table in a separate segment.
If you want to get the combined size of the table and of its LOB segments, you could do something like
SELECT SUM(bytes)/1024/1024 gb
  FROM dba_segments
WHERE (owner = <<table owner>> and
       segment_name = <<table name>>)
    OR (owner, segment_name) IN (
        SELECT owner, segment_name
          FROM dba_lobs
         WHERE owner = <<table owner>>
            AND table_name = <<table name>> )Justin

Similar Messages

  • How to increase text size of a Column header of table in webdypro

    Hi All,
    Can anybody suggest me how to increase the text size of a column header of table in webdyrpo. I didnt find any option anywhere. can anybody help me out to solve this issue?
    Regards
    Ravikumar

    Hi Ravikumar,
    As Sukanta has suggested create a Simpletype of String Type and Length 40.
    Then create a context for the column header and for its type, instead of choosing
    from the drop down, choose the 3 dots.
    In the window that appears, select Local Dictionary, and Select the Simpletype
    that you have created, from the respective package name. And click OK.
    This will make the text of ColumnHeader of type String and Length 40.
    Hope it helps.
    Regards,
    Alka.

  • Total size of all columns

    Hi ,
    I created a table as below
    create table my_tab(no number(10), name varchar2(20));
    Now i need to get the total no of size of this table
    i.e no size is 10
    name size is 20
    total is 30
    pls give me a query to get the total size as 30.
    Thanks,
    Oracle

    It's not the way to find the size of table or any object in database, you can't get by assuming or by calculating datatype size.The below is the query to get object size in database.
    select segment_name
    ,      bytes "SIZE_BYTES"
    ,      ceil(bytes / 1024 / 1024) "SIZE_MB"
    from   dba_segments
    where  segment_name like '&obj_name'
    /Edited by: darkStargate on Jan 5, 2012 5:03 PM

  • To check whether there is any size mismatch between columns of two tables

    Hi,
    Here i got two tables T and M where i am going to migrate data from T to M. But before migrating i need to check whether all the data in source table fits into destination table columns. The datatypes of all columns in source table T is of Varchar2 only as it is a temp table.
    Ex :- Table 'T' (Source table) with columns
    T_Lat Varchar2(50);
    T_Amt Varchar2(50);
    T_Cat Varchar2(50);
    T_Vat Varchar2(50);
    Now I have another table 'M'(Destination Table) with columns
    M_Lat Varchar2(50);
    M_Amt varchar2(25);
    M_Cat date;
    M_Vat number;
    Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns respectively (to check whether there is any size mismatch). This check should be done dynamically.
    For suppose, in T_Amt(source column of T table) if text is abt 50 characters, it cant fit M_Amt(destination column of M table). In this case it should throw an error indicating that destination column size is less for the source column.
    Note:- There is no unique mapping column for these two tables and there are about 400 columns in the source table to be validate
    I think it can be done using arrays or plsql tables.
    Can any one help in this regard.

    >
    Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns respectively (to check whether there is any size mismatch). This check should be done dynamically.
    >
    Just because the source table T_Amt column is defined as 50 doesn't mean any of the data is really that long. So the data itself needs to be checked. That is just what a simple query can do.
    See my answer in this thread Posted: Jul 25, 2012 1:14 PM
    Re: Help in Execute Immediate - Invalid relational Operator
    Here is the modified sample query and results for a query of a clone of the EMP table with some modified data
    select count(*) cnt,
           -- job column
           sum(case when job is null then 1 else 0 end) job_nul,
           sum(case when job = 'SALESMAN' then 1 else 0 end) job_salesman,
           min(length(job)) job_minlength, max(length(job)) job_maxlength,
           min(job) job_min, max(job) job_max,
           -- hiredate colulmn
           sum(case when hiredate is null then 1 else 0 end) hiredate_nul,
           min(hiredate) hiredate_min,
           max(hiredate) hiredate_max
            from emp1
    CNT JOB_NUL JOB_SALESMAN JOB_MINLENGTH JOB_MAXLENGTH JOB_MIN JOB_MAX  HIREDATE_NUL HIREDATE_MIN HIREDATE_MAX
    14    2       4            5             9             ANALYST SALESMAN 0            9/28/0001    12/3/9999With one query and ONE pass thru the table I was able to get the COUNTs, the MIN and MAX values for each column and the MIN and MAX lengths of the VARCHAR2 columns.
    There are 14 total records, 2 where JOB is null, 4 where the JOB is SALESMAN. The MIN length of the JOB data is 5 and the MAX is 9.
    Look at the date values. The results tell me I have some problem data.
    The length data tells me if I try to put the JOB data into another table I need to define the length as at least 9 or it won't fit.
    For your use case you might find that all of the data in the T_Lat column is shorter than 26 and will actually fit into the M_Lat target table column.

  • How to read/write .CSV file into CLOB column in a table of Oracle 10g

    I have a requirement which is nothing but a table has two column
    create table emp_data (empid number, report clob)
    Here REPORT column is CLOB data type which used to load the data from the .csv file.
    The requirement here is
    1) How to load data from .CSV file into CLOB column along with empid using DBMS_lob utility
    2) How to read report columns which should return all the columns present in the .CSV file (dynamically because every csv file may have different number of columns) along with the primariy key empid).
    eg: empid report_field1 report_field2
    1 x y
    Any help would be appreciated.

    If I understand you right, you want each row in your table to contain an emp_id and the complete text of a multi-record .csv file.
    It's not clear how you relate emp_id to the appropriate file to be read. Is the emp_id stored in the csv file?
    To read the file, you can use functions from [UTL_FILE|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#BABGGEDF] (as long as the file is in a directory accessible to the Oracle server):
    declare
        lt_report_clob CLOB;
        l_max_line_length integer := 1024;   -- set as high as the longest line in your file
        l_infile UTL_FILE.file_type;
        l_buffer varchar2(1024);
        l_emp_id report_table.emp_id%type := 123; -- not clear where emp_id comes from
        l_filename varchar2(200) := 'my_file_name.csv';   -- get this from somewhere
    begin
       -- open the file; we assume an Oracle directory has already been created
        l_infile := utl_file.fopen('CSV_DIRECTORY', l_filename, 'r', l_max_line_length);
        -- initialise the empty clob
        dbms_lob.createtemporary(lt_report_clob, TRUE, DBMS_LOB.session);
        loop
          begin
             utl_file.get_line(l_infile, l_buffer);
             dbms_lob.append(lt_report_clob, l_buffer);
          exception
             when no_data_found then
                 exit;
          end;
        end loop;
        insert into report_table (emp_id, report)
        values (l_emp_id, lt_report_clob);
        -- free the temporary lob
        dbms_lob.freetemporary(lt_report_clob);
       -- close the file
       UTL_FILE.fclose(l_infile);
    end;This simple line-by-line approach is easy to understand, and gives you an opportunity (if you want) to take each line in the file and transform it (for example, you could transform it into a nested table, or into XML). However it can be rather slow if there are many records in the csv file - the lob_append operation is not particularly efficient. I was able to improve the efficiency by caching the lines in a VARCHAR2 up to a maximum cache size, and only then appending to the LOB - see [three posts on my blog|http://preferisco.blogspot.com/search/label/lob].
    There is at least one other possibility:
    - you could use [DBMS_LOB.loadclobfromfile|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i998978]. I've not tried this before myself, but I think the procedure is described [here in the 9i docs|http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl12bfl.htm#879711]. This is likely to be faster than UTL_FILE (because it is all happening in the underlying DBMS_LOB package, possibly in a native way).
    That's all for now. I haven't yet answered your question on how to report data back out of the CLOB. I would like to know how you associate employees with files; what happens if there is > 1 file per employee, etc.
    HTH
    Regards Nigel
    Edited by: nthomas on Mar 2, 2009 11:22 AM - don't forget to fclose the file...

  • How to retreive soap xml data from clob column in a table

    Hi,
    I am trying to retrieve the XML tag value from clob column.
    Table name = xyz and column= abc (clob datatype)
    data stored in abc column is as below
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:head="http://www.abc.com/gcgi/shared/system/header" xmlns:v6="http://www.abc.com/gcgi/services/v6_0_0_0" xmlns:sys="http://www.abc.com/gcgi/shared/system/systemtypes">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <RqHeader soapenv:mustUnderstand="0" xmlns="http://www.abc.com/gcgi/shared/system/header">
    <DateAndTimeStamp>2011-12-20T16:02:36.677+08:00</DateAndTimeStamp>
    <UUID>1000002932</UUID>
    <Version>6_0_0_0</Version>
    <ClientDetails>
    <Org>ABC</Org>
    <OrgUnit>ABC</OrgUnit>
    <ChannelID>HBK</ChannelID>
    <TerminalID>0000</TerminalID>
    <SrcCountryCode>SG</SrcCountryCode>
    <DestCountryCode>SG</DestCountryCode>
    <UserGroup>HBK</UserGroup>
    </ClientDetails>
    </RqHeader>
    <wsa:Action>/SvcImpl/bank/
    SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq</wsa:Action></soapenv:Header>
    <soapenv:Body>
    <v6:AlertDeleteInqRq>
    <v6:Base>
    <v6:VID>20071209013112</v6:VID>
    <!--Optional:-->
    <v6:Ref>CTAA00000002644</v6:Ref>
    </v6:Base>
    </v6:AlertDeleteInqRq>
    </soapenv:Body>
    </soapenv:Envelope>
    And i want to retrieve the values of tag
    <ChannelID> and <v6:VID>
    can somebody help, i have tried with extractvalue but not able to get the values

    I have used the below two queries but not able to get the expected results. Both queries result into no values.
    select xmltype(MED_REQ_PAYLOAD).extract('//ClientDetails/Org','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" || xmlns="http://www.abc.com/gcgi/shared/system/header"').getStringValue() from ESB_OUTPUT_TEMP where SOAPACTION = '/SvcImpl/bank/alerts/v6_0_0_0/SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq'
    select EXTRACTVALUE(xmltype(MED_REQ_PAYLOAD),'/RqHeader/) from ESB_OUTPUT_TEMP where SOAPACTION = '/SvcImpl/bank/SOAPEndpoint/AlertsService.serviceagent/OpEndpointHTTP/AlertDeleteInq'
    Well, for starters, both queries are syntactically wrong :
    - non terminated string
    - incorrect namespace mapping declaration
    - unknown XMLType method "getStringValue()"
    Secondly, all those functions are deprecated now.
    Here's an up-to-date example using XMLTable. It will retrieve the two tag values you mentioned :
    SQL> select x.*
      2  from esb_output_temp t
      3     , xmltable(
      4         xmlnamespaces(
      5           'http://schemas.xmlsoap.org/soap/envelope/' as "soap"
      6         , 'http://www.abc.com/gcgi/shared/system/header' as "head"
      7         , 'http://www.abc.com/gcgi/services/v6_0_0_0' as "v6"
      8         )
      9       , '/soap:Envelope'
    10         passing xmlparse(document t.med_req_payload)
    11         columns ChannelID  varchar2(10) path 'soap:Header/head:RqHeader/head:ClientDetails/head:ChannelID'
    12               , VID        varchar2(30) path 'soap:Body/v6:AlertDeleteInqRq/v6:Base/v6:VID'
    13       ) x
    14  ;
    CHANNELID  VID
    HBK        20071209013112
    You may also want to store XML in XMLType columns for both performance and storage optimizations.

  • Change the size of a Column in a Table

    I have a JTable with two columns but I don't know how to change the size of the columns
    Thanks.

    Hi,
    You have to use TableColumn and use JTable.setPreferredSize() method to size ur Columns.
    Hope this helps.
    Cheers
    SS

  • Comparing clob columns in two tables

    I need to copy the clob data from one table to another. However, I need to remove duplicates while doing so. When I run the following query, it loads all of the rows, whether they are duplicates or not.
    INSERT INTO L_COMMENTS
    SELECT comments_key.NEXTVAL, 'ASSOCIATECOMMENTS', ASSOCIATECOMMENTS
    FROM TABLE1 A
    WHERE ASSOCIATECOMMENTS IS NOT NULL
    AND NOT EXISTS
    (select 1
    from L_COMMENTS C
    where COMMENT_TYPE = 'ASSOCIATECOMMENTS'
    AND dbms_lob.compare(C.COMMENTS, A.ASSOCIATECOMMENTS) = 0)
    Any idea on how to do this load? I have several similar loads to do.

    If I did that, for any column that has a duplicate, neither one would be included.

  • To display Total sum of a column in a table view control ?

    Hi,
      I am unable to display the sum of a column in a table view control ( using HTMLB ). How should one display the sum of a column in a table view control ?
    Thanks in advance.
    Vara.

    Hi there, do a search in this forum for TableView Iterator. Then check out these weblogs:
    /people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators
    /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
    An Iterator is the way to go for you

  • Report totals with dimension hierarchy column on pivot table incorrect

    Hi,
    I have a pivot table based report that has one dimension column, a dimension hierarchy column and various measures.
    The row totals do not match, detail to total, and I have tried both complex server based aggregate and report based aggregation, but neither are giving me the correct answer.
    I have also tried adding the column that is the same as the top level as the hierarchy, but hidden, but this does not help.
    I have also tried adding the lowest level of detail column, but hidden, but this does not give me the solution I need as all of the figures then appear at detail not aggregated level.
    Any ideas please?
    thanks,
    Robert.

    Can you validate the query hitting to the database and compare the results?
    Mark if helps.
    Thanks,

  • How to fix the size of the column in a table of ALV table  type?

    Hi all,
    I want o fix the size of the ALV column.
    Can any one help me out regarding this.
    Regards,
    Yugesh

    * Data declarations for instantiation
      DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table   ,
            l_ref_cmp_usage   TYPE REF TO if_wd_component_usage,
            l_value   TYPE REF TO cl_salv_wd_config_table   ,
    * Instantiate the ALV
      l_ref_cmp_usage =   wd_this->wd_cpuse_usg_alv_feclm( ) ."usg_alv_feclm is the name of your usage
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL .
        l_ref_cmp_usage->create_component( )                 .
      ENDIF                                                  .
    * Get model
      l_ref_interfacecontroller = wd_this->wd_cpifc_usg_alv_feclm( ).
      l_value = l_ref_interfacecontroller->get_model( )             .

  • Format the total value in the column of the graph table

    Hello all,
    I have a graph table and I need to format the total value in the column of the table.
    I am trying to find my table bean with the code below but it's not working in the processRequest. Is there anything else that should be done?
    // Get the graph
    OAGraphTableBean graphBean = (OAGraphTableBean)webBean.findChildRecursive("MyGraph");
    // Get the table
    OATableBean tblBean = (OATableBean)graphBean.findChildRecursive("MyTable");
    The tblBean is null in the processRequest. In the processFormRequest the tblBean is not null.
    Thanks and Regards,
    Andrea

    Hi,
    The code OAGraphTableBean graphBean = (OAGraphTableBean)webBean.findChildRecursive("MyTable"); does not work because in this case I am getting the table but casting to a graph.
    The MyTable bean is a child of MyGraph.
    When creating a graph bean we have the option to create a table as a child (select your graphTable region in the Structure pane, and choose New > tabularFormat - to create the table).
    The table bean child I can get just in the processFormRequest, but the graph I can get in both processRequest and processFormRequest.
    I need to get the table bean in the processRequest to format the total value column.
    Do you know if is there anything else that should be done to format the total column?
    Thanks and Regards,
    Andrea

  • How to Update a clob column..it gives error string literal too long

    I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
    ORA-01704: string literal too long

    Peeyush wrote:
    I am trying to update a clob column of a table but it gives error string literal too long plz tell me what's the issue
    ORA-01704: string literal too longThere's a problem with my car. It won't start. Why won't it start? Please tell me!
    Oh wait, you can't, because I haven't given you nearly enough information...
    In other words, if you would like help in trying to work out where you've gone wrong, you should provide a small enough example of your code that demonstrates the error. We might then actually stand a chance of being able to help you!

  • Setting Line Terminator for a CLOB column by script

    Hello Everyone,
    I have a CLOB column in my table that receives external data (more than 400 sources).
    The GUI application displays it in different ways because of the multiple incoming Line Terminators.
    Here is the weird thing:
    In SQL developper 3.1.06. In the Preferences->Environment I selected as Line Terminator: Carriage Return and Line Fe(Windows)
    Once I committed the changes the data was properly displayed in the application (apparently was also re-coded).
    My Question is:
    How can I setup this property on the column or table to fix the issue??
    (I'm looking for a DDL script or something alike).
    Thanks in advance.
    Mijail O. T.

    914451 wrote:
    If that's the case, What is the SQL DEveloper doing then??
    I tested and looks like is a global parameter, not sure if works only for the table. (That what I need).
    If is possible to setup this feature from the GUI it should be a way to do it running a Script.
    Right????No.
    Tables don't have any concept of "lines".
    CLOB's don't have any concept of "lines".
    "lines" only exist in the context of the data you are providing, but that's not of concern to the database.
    So it looks like, what SQL Developer is doing (I assume as I don't use it), is to have a setting such that when it comes to display character data from VARCHAR2's or CLOB's it determines if there are CR/LF or just LF characters (as per the setting) and then uses those as line terminators for displaying the data in it's own interface. Thus it sounds like an interface specific setting, or to put it bluntly, it's something that is a part of SQL Developer to control how it displays things.
    Have you tried querying back the raw version of the data from the database to see that it still has the CR/LF characters in it? It should.
    I think you'll find the setting is a "display" setting, not a "alter my data" setting.

  • Problem on inserting text from file to a clob column

    Hi! I'm having problem in inserting text read from a text file to a clob column in my table.
    Here's my code
    public void addSyllabusOutline(int syllid)
              CLOB objclob1 = null;
              CLOB objclob2 = null;
              String query = "SELECT outline, projoutline FROM Syllabus WHERE syllabusid = '"+ syllid +"' FOR UPDATE";
              try
                   System.out.print("Getting syllabus outline and projoutline clob locator...");
                   DBConnection dbconnbean = new DBConnection();
                   dbconnbean.openConnection();
                   ResultSet rst = dbconnbean.executeQuery(query);
                   if(rst.next())
                        objclob1 = (oracle.sql.CLOB)rst.getClob("outline");
                        objclob2 = (oracle.sql.CLOB)rst.getClob("projoutline");
                        Writer clobwriter1 = ((oracle.sql.CLOB)objclob1).getCharacterOutputStream();
                        String filename1 = "c:\\o1u2t3l4i5n6e7.txt";
                        File outlinefile1 = new File(filename1);
                        FileReader outlineFileReader1 = new FileReader(outlinefile1);
                        char[] cbuffer1 = new char[10 * 1024];
                        int nread1 = 0;
                        while((nread1 = outlineFileReader1.read(cbuffer1)) != -1)
                             clobwriter1.write(cbuffer1, 0, nread1);
                        //clobwriter1.flush();
                        clobwriter1.close();
                        Writer clobwriter2 = ((oracle.sql.CLOB)objclob2).getCharacterOutputStream();
                        String filename2 = "c:\\p1r2o3j4o5u6t7l8i9n0e.txt";
                        File outlinefile2 = new File(filename2);
                        FileReader outlineFileReader2 = new FileReader(outlinefile2);
                        char[] cbuffer2 = new char[10 * 1024];
                        int nread2 = 0;
                        while((nread2 = outlineFileReader2.read(cbuffer2)) != -1)
                             clobwriter2.write(cbuffer2, 0, nread2);
                        //clobwriter2.flush();
                        clobwriter2.close();
                   System.out.println("done");
                   dbconnbean.closeConnection();
              catch(Exception e)
                   System.out.println("Error: " + e);
    My error is java.sql.SQLException fetch out of sequence. I don't have an Idea on what seems to be the problem. Please help.. Thank you very much. ^_^

    Hi,
    Print the whole stack trace. It will tell you the line which causes the error. How you use clob and blob in oracle is also version dependent. Try to google for
    oracle "your version" java clob example.
    /Kaj

Maybe you are looking for

  • How to find out who released an encrypted email in ironport? C160 Appliance

    Hello, We have quite a few users who can release emails. We need to find out who released an encrypted email. When we track the encrypted message through message tracking it shows it was manually released but no credentials are provided. I checked th

  • AnyConnect disconnect issue

    Hello, Any help or insight is appreciated. Running ASA 5505 (8.4.6) with AnyConnect 3.1.03103 for Windows. VPN sometimes connects and sometimes do not. When the connection does not work, get the following message: "Connection attempt has timed out. P

  • What are all Built-in-Templets available in ODI?

    What is the use of Built-in-Templets? What are all Built-in-Templets available in ODI?

  • Database Adapter Polling problem

    Hi All, The polling option is processing all the rows in a table at a time instead of using polling frequency. I have used an option of update a field (logical delete) where I have initialized unread value='N' and read value='Y'. Now ,the problem is

  • Bank account number is not displaying in Payslip.

    Hi Please advice for the below mentioned issue:  Bank account number is not getting displayed in payslip. What i have observed is there are two entries coming in BT one is correct entry of wagetype /559 and another entry generating is of wagetype /47