Dictionary of data values in column view (s)

The following query is the list of the most fragmented tables.

My question is that I do not understand why the value of the blocks is multiplied by 8. Is because the value of column of blocks show a kilo byte? so convert us kilo bits?

My second question is, what is the value of these columns represent in general? In other words, when I look at the data of avg_row_len how can I understand the which type of data it represent?

For example: avg_row_len, the number in this column represents byte? or kilobye?

select table_name,round((blocks*8),2) "size (kb)" ,
                  round((num_rows*avg_row_len/1024),2) "actual_data (kb)",
                 (round((blocks*8),2) - round((num_rows*avg_row_len/1024),2)) "wasted_space (kb)"
from dba_tables
where (round((blocks*8),2) > round((num_rows*avg_row_len/1024),2))
order by 4 desc

Thanks in advance.

So what you don't understand? Num_Rows * avg_row_len gives "average you" number of bytes occupied by the data in the table. Num_Rows * avg_row_len/1024 is same in KB. And round ((num_rows*avg_row_len/1024), 2) round it to two decimal places. blocks * 8 (as I said, code you posted assume table block size is 8K) is the space allocated to the table in KB. And I have no idea why code is rounded, something that is whole number to start.

SY.

Tags: Database

Similar Questions

  • convert the date value in column 1 help

    Am on 10g.

    I have a column: STAMP_DATE with these values:

    I leave the INHERITANCE, as it is, but everything else, I need to convert to the: MMYYYY as in: 092010 for example.

    9 sep means so seven-2009. The number is the year, I am trying to solve this problem.

    Any SQL help would be appreciated, thanks!

    STAMP_DATE
    "LEGACY".
    "9-sep.
    '9 - Oct'
    '9 - Nov'
    "" 9-may
    '9 - Mar'
    "9 - Jun"
    "9 July".
    '9 - Dec'
    "9-Aug.
    "April 9.
    '10-May '.
    '10 - Mar'
    '10-jan.
    '10 Feb.
    "" 10 Apr

    These values were imported from Excel using SQLLDR, so he made them a bit like that.

    with s as
    (select 9 - Sep' double jnk)
    Union
    Select ' 9 - APR ' double jnk
    )
    Select to_char (to_date(jnk||) (("e - 01 ', ' AA-MON-DD '), 'DD-MM-YYYY') s
    /

    Seems to be working at home time tonight.

    -------------
    Sybrand Bakker
    Senior Oracle DBA

  • Edit/view (data or Table column) value - cannot change the data, but it can be updated

    Hello

    According to the help of Oracle SQL Developer Center, the dialog ' Change/see value (data or Table column)' should "change the value of data" if we "are allowed to change the data." We strive to use this dialog box to modify/update data without having to write an Update statement, but is not to leave us. Us are not allowed to update the data, we can update via update statements. Even as the owner of the schema.table, it don't will change us the value in the dialog box "Edit/see value (data or Table column).

    Any ideas?

    We are on SQL Developer Version 3.0.0.4 build HAND - 04.34 and Oracle 11 GR 1 material (11.1.0.7) database.

    Thank you

    Alex Larzabal.

    You can still vote on the existing demand for this developer SQL to add Exchange of weight for implementation as soon as possible:
    https://Apex.Oracle.com/pls/Apex/f?p=43135:7:3974986722753169:no:RP, 7:P7_ID:4902

    Kind regards
    K.

  • How to assign the text value when the data in the column is null or empty

    Hello guys

    I have a small question

    I have a column A that half of its value is empty, now the condition is that whenever the column is empty, assign "N/a" in the column... So I wrote a code which is:

    <? If: not (column A)? > column a = 'n/a' <? end if? >

    However, when I preview the RTF model, the data in the column still has not changed at all, many lines are still empty and did not show 'n/a '... The column is of type text

    Please advice

    Thank you
    N/A
    
  • Select the lines with the maximum value for a date where another column is different from 0

    Hello

    I need to write a query on a table (called DEPRECIATION) that returns only the rows whose date maximum (PERENDDAT_0 column) for a specific record (identified by AASREF_0), and where the other column in the table called DPRBAS_0 is different from 0.

    If DPRBAS_0 is equal to 0 in all the lines of a specific record, then return the line with date maximum (PERENDDAT_0 column).

    To be clearer, I give the following example:

    Suppose we have the following data in the table of DEPRECIATION:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001074331/12/20140
    I2011001074331/12/20130
    I2011001085612/31/20160
    I2011001085631/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445
    I2014001223831/12/2015445
    I2014001223831/12/20140

    The query must return only the following lines:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445

    Thanks a lot for your help!

    This message was edited by: egk

    Hello Egk,

    The following query works for you.

    SELECT AASREF_0, PERENDDAT_0, DPRBAS_0

    FROM (SELECT AASREF_0,

    PERENDDAT_0,

    DPRBAS_0,

    ROW_NUMBER)

    DURING)

    AASREF_0 PARTITION

    ORDER BY

    CASE WHEN DPRBAS_0 <> 0 THEN 1 OTHER 0 END DESC,.

    PERENDDAT_0 DESC)

    RN

    DEPRECIATIONS)

    WHERE rn = 1

  • How to validate the Date value in the text column

    Hi all

    I entered DATE value in the element of text field (Char Data Type), now how do I validate, the entered date is valid or not.

    Thanks in advance.

    Well, the easiest would be to make the part of DATE data type.

    Another possibility is to try to convert the value to a date in the WHEN-VALIDATE-POINT-trigger, as

    DECLARE
      dt DATE;
    BEGIN
      dt:=TO_DATE(:BLOCK.ITEM);
      -- if code comes here, the date is valid
    EXCEPTION
      WHEN OTHERS THEN
        -- seems to be no valid date
        MESSAGE('Error');
        RAISE FORM_TRIGGER_FAILURE;
    END;
    

    Published by: Andreas Weiden on 19.12.2010 12:23

  • How to display rows of data in different columns?

    I'm new to SQL and currently, that's what I try to do:

    Display multiple lines of data in different columns in the same row

    I have a table like this:

    CREATE TABLE TRIPLEG)

    T # NUMBER (10) NOT NULL,

    STEP # NUMBER (2) NOT NULL,

    DEPARTURE VARCHAR (30) NOT NULL,

    VARCHAR (30) DESTINATION NOT NULL,.

    CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T #, LEG #).

    TRIPLEG_UNIQUE UNIQUE CONSTRAINT (T #, DEPARTURE, DESTINATION).

    CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T #) REFERENCES TRIP(T#));

    INSERT INTO TRIPLEG VALUES (1, 1, 'Sydney', 'Melbourne');

    INSERT INTO TRIPLEG VALUES (1, 2, 'Melbourne', 'Adélaïde');

    The result should be something like this:

    > T # | ORIGIN | DESTINATION1 |  DESTINATION2

    > 1 | SYDNEY | MELBORUNE | ADELAIDE

    The request must include the ' COUNT(T#) < 3' since I only need to display the records of less than 3. How can I get the results I want to use relational views?

    Thank you!!!

    I replaced the syntax "where" with the syntax 'account '. The reason why I do this is because I want to only display records with a number of travel of less than 3. By defining where the legs #.<=3, the="" result="" will="" be="" all="" the="" records="" of="" the="" tripleg="" table="" since="" each="" record="" could="" also="" have="" leg#="" is="">

    The answer is:

    with t as (SELECT t #,)

    REGEXP_REPLACE)

    LISTAGG (start |) '->' || destination, ' ')

    THE Group (ORDER BY t #, leg #).

    '([^ ]+) \1+',

    "\1") str

    OF tripleg

    HAVING COUNT (T #)<>

    GROUP BY t #)

    Select T #, regexp_substr (str, ' [^->] +', 1, 1) departure

    , regexp_substr (str, ' [^->] +', 1, 2) destination_1

    , regexp_substr (str, ' [^->] +' 1, 3) destination_2

    , regexp_substr (str, ' [^->] +' 1, 4) destination_3

    Thanks to Marty and knani!

  • How to divide the data in the column based identifier

    Hello

    I use the oracle database.
    I have data in this format in my column 1234 ~ 2345 ~ 3456 ~ 4567.

    I need a motion to split the data in the column based on the identifier ' ~', so that I can choose the value after the second occurrence of the identifier.


    Do I know who can do this.

    Published by: 962987 on October 3, 2012 12:11

    Hello

    Welcome to the forum!

    Whenever you have any questions, please post CREATE TABLE and INSERT statements for some examples of data and the results desired from these data. For example, in view of these data

    CREATE TABLE     table_x
    (       my_column     VARCHAR2 (40)
    );
    
    INSERT INTO table_x (my_column) VALUES ('1234~2345~3456~4567');
    INSERT INTO table_x (my_column) VALUES ('just~2 parts');
    

    I think you're asking for these results

    PART_3     MY_COLUMN
    ---------- ----------------------------------------
    3456       1234~2345~3456~4567
               just~2 parts
    

    I suppose that, if the string does not contain at least 2 ' ~ s, you want to return null. It's a good idea to explain what you want like that for special cases and include examples in your sample data and results.

    Not all versions of Oracle are exactly the same. In fact, they are all different. If you want the best solution that works with your version, then say what version it is.
    The following query will work in Oracle 10.1 and higher:

    SELECT  REGEXP_SUBSTR ( my_column
                    , '[^~]+'
                    , 1
                    , 3     -- 3rd occurrence (after 2nd delimiter)
                    )     AS part_3
    ,     my_column          -- if wanted
    FROM    table_x
    ;
    

    See the FAQ forum {message identifier: = 9360002}

    Published by: Frank Kulash, October 3, 2012 15:24
    Adding sample data and results.

  • SQL queries for reports help: need to reverse the data in the column in columns [O

    Hi all

    I'm looking for help in writing SQL, where I need to reverse the data in the columns column.

    My data in DB is as below.

    VALUE OF NAME OF MONTH
    Jan-10 M1 5
    Jan-10 M2 8
    Jan-10 M3 9
    Feb-10 M1 4
    Feb-10 M2 6
    Feb-10 M3 2
    M4 10 Feb 10
    M1 10 Mar 21
    Mar-10 M2 6

    Power required for the declaration will be like:


    MONTHS M1 M2 M3 M4
    Jan-10 5 8 9
    Feb-10 4 6 2 10
    21 Mar-10 6

    How can I do this using SQL. [ORACLE 10g]?

    I can make use of server Oracle BI also.

    Please help me on this...

    I think this is wrong forum to ask this question. You want to do it in OBIEE or at the DB level. In oBIEE you can do in a table privot view.

    Thnaks,
    Knani

  • Number of days since 31/12/1979 converting a date value?

    Hi all

    I'm not an expert in oracle sql and I hope that someone could help me.  A column of a table is titled BHS_KDTE_SEQU.  This column has 111616 lines and the values stored in these areas are the number of days since 31/12/1979.

    When I write a select statement, how can I convert to get the date value since 31/12/1979 instead of the number of days?

    Thank you in advance!

    Hello

    f429ff94-4133-48E0-AE1C-afcb148d3c2f wrote:

    Hi all

    I'm not an expert in oracle sql and I hope that someone could help me.  A column in a table is called BHS_KDTE_SEQU.  This column has 111616 lines and the values stored in these areas are the number of days since 31/12/1979.

    When I write a select statement, how can I convert to get the date value since 31/12/1979 instead of the number of days?

    Thank you in advance!

    Then

    1 means January 1, 1980,

    2 means January 2, 1980,

    ...

    31 January 31, 1980, means

    32 means February 1, 1980.

    ...

    366 means December 1, 1980,

    367 means January 1, 1981,

    and so on?

    Here's one way:

    SELECT DATE ' 1979-12-31' + bhs_kdte_sequ AS dt

    TABLE;

    When you add a DATE d and a NUMBER n in Oracle, the result is the DATE n days after days.

    I hope that answers your question.

    If not, post a small example of data (CREATE TABLE and INSERT statements) and the exact results you want from these data.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

  • How can I set a time stamp for the setCreationDate(Date value)?

    Hi all

    My underlying database column has a DATE data type that needs of the data and the time stamp. When you use the following code to set a date for setCreationDate(Date value) the date is set, but there is no timestamp.

    Here is the code:

    protected void create (AttributeList attributeList) {}

    Super.Create (AttributeList);

    Begin

    Date currentDate = new Date();

    DATE creationDate = currentDate.getCurrentDate ();

    setCreationDate ((Date) creationDate);

    End

    }

    Can't wait to hear.

    James

    java.sql.Timestamp timeStamp = new java.sql.Timestamp (System.currentTimeMillis ());

    dateTime oracle.jbo.domain.Date = new oracle.jbo.domain.Date (timeStamp);

  • Date in varchar column

    Hi all

    my need is to check the validity of the date in the column of type varchar.

    Yes, the architecture of this table is poor, but unfortunately I have no impact here.

    Then, the user can easily insert something like ' 31.04.2013' and I get the error during the conversion from date:

    ORA-01830: date format picture ends before converting all of the input string

    Here is my code:

    Select

    TO_DATE (REGEXP_SUBSTR ('31.04.2013','(0?))) [0-9] | [1-2] [0-9] | 30. 31) [\. / \\\-\,] (0 ? [0-9]|1[0-2])[\./\\\-\,](2[0-9])? (([0-2] [0-9]'), 'jj') arcdate

    of the double

    Please help me understand how do i:

    (1) avoid the error

    (2) returns the text "invalid date" instead of ORA-01830...

    Thanks in advance.

    Issue is the fact that the varchar column values follow a date format? If so, the easiest way is to write a function. Something like:

    create or replace

    function date_check)

    p_date_string varchar2,

    p_format_mask varchar2

    )

    Return number

    is

    date of v_dt;

    Start

    v_dt: = to_date (p_date_string, p_format_mask);

    Return 1;

    exception

    while others then return 0;

    end;

    /

    Now, for example, if the date string format exact follows, you could:

    Select the date_check (your_column, 'dd.mm.yyyy')

    When 1 then your_column | "is a valid date in the exact format.

    of other your_column | 'is not a valid date in the exact format.

    end

    from your_table

    /

    SY.

  • DESC, showing the different type of data value via dblink

    Hi friends,

    We have two databases and for two of them, the configuration is as below

    Version of the operating system: Solaris 5.10

    DB version: 10.1.0.4

    For security reasons, I'm going by names of junk. Assume the names of database DB1 and DB2.

    We have a table T1 S1 schema of database DB1. to extract data from this table in DB2 in schema S2, we created a database DB1 and DB2 (lets say the name of dblink is XYZ)

    In DB1, in table T1, we have a column by name SYS_CREATED and its data type is varchar2(40 char).

    After you create the database link, below we have the table as desc

    DESC S1. T1@XYZ

    When we describe this statement, instead of showing the value of data type of column SYS_CREATED as varchar2(40 char), it's showing as varchar2(160 Char).

    Then, we created a table in DB2 under schema S2 as below

    SQL > create table S2. T2 in select * from S1. T1@XYZ;

    and now, when we describe the table T2, its original display value is varchar2 (40 Char).

    Then just when we described, it shows a higher value for the data type and when we create the table, his watch even than the original. In addition, what is happening to only varchar2 datatype. other data types such as number or tank remain same even when we describe.

    one thing is, when he demonstrated a different value using describe, sound exactly multiplying by 4 times. for example, if we have varchar2 (1000 char), the varchar2 (4000 tank) showing

    I would like to know if anyone in this strange situation earlier, if so, what is the reason?

    Thank you very much in advance

    > Unlike when you access a local object, the SELECT privilege is required to access a remote object because the database has no distance describe ability. The database must be a SELECT * on the remote object to determine its structure.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28310/ds_concepts002.htm

    What happens if you give the right to select on the remote object.

    Concerning

    Girish Sharma

  • When I extract data from a column that contains and it gets converted to &amp; amp;

    I have data in a column say countries with the following value New Zealand & Australia
    It gets converted into New Zealand & am p;  Australia ... in the text element...
    The value is taken from the column
    How to avoid that this amp; being added.
    Is it a bug how do we get around that.


    Select off_country of contact where contact_No = mnontactno;
    I use this in a dynamic action when I load the page.
    I have a question in the hope of data one can help with this

    Version 4.2 db 11g apex

    Edited by: zycoz100 January 6, 2013 18:59

    Please, don't post duplicate discussions: + {: identifier of the thread = 2482368} +.

    As you can see, doing so does not get answers just more quickly.

    Close this message and stick to the original.

  • Select the records from the first n distinct values of column

    I need to write a query in plsql to select records for the first 3 values distinct from a single column (example below, ID) and all lines for the next 3 distinct values of column and so on until the end of the number of distinct values in a column.
    for example:
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10
    7 lmn 10
    .
    .
    .
    so now... (up to a few County)
    Result must be
    1 the application should result->
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr

    Query 2 should lead to->
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10

    Query 3 should lead to->
    7 lmn 10
    .
    .
    9... ..
    so now...
    How to write a query for this inside a loop.

    Hello

    Thus, a panel will consist of the lowest id value, the 2nd lowest and the 3rd lower, reggardless of how many lines is involved. The next group will include the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you must assign the numbers 1, 2, 3, 4, 5, 6,... for the rows in order by id, with all lines with the same id, getting the same number and without jumping all the numbers.
    This sounds like a job for the analytical DENSE_RANK function:

    WITH     got_grp_id     AS
    (
         SELECT     id, name, age
         ,     CEIL ( DENSE_RANK () OVER (ORDER BY id)
                   / 3
                   )          AS grp_id
         FROM     table_x
    )
    SELECT     id, name, age
    FROM     got_grp_id
    WHERE     id     = 1     -- or whatever number you want
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
    See the FAQ forum {message identifier: = 9360002}

Maybe you are looking for

  • Problems with three fingers looking for preview

    Hi all So I've upgraded to Mac OS Sierra the other night and it was absolutely great so far. However, there is a feature I noticed is either absent, either turned somewhere off the coast, and it is three fingers look upward in the preview. I'm at sch

  • Photo thumbnails take up 11 GB. How to decrease

    I use iphoto to store my photos... My understanding is that only the photos are stored on my iPhone. It is said of 11 GB of photos are on the iPhone. Is the way to choose the albums show on my iPhone? Or another way to reduce the amount of space phot

  • iPod touch 5th generation needs "update."

    Hi, I recently replaced my iPod touch 5th generation (32 GB) because my only previous has been damaged. I tried to sync it with my itunes on my laptop (Windows 7), but was greeted with a message saying I can't, because the iPod needs the latest versi

  • DAQ in Veristand readings do not match the MAX readings

    I have three accelerometers attached to a block of SCB-68 connection that is connected to an NI PXI-6221 data acquisition on a RT system. I have created a task for each accelerometer in MAX and have tested each one to see that it works and gives appr

  • Not enabled on the computer USb port

    Original title: salvationthen the port usb are enabled but they do not appear on my computer