Remove the column from the table compress

I try drop column from table DPRUEBA, with compression option:
SQL>select * from v$version
  2  /

BANNER                                                                
----------------------------------------------------------------      
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi      
PL/SQL Release 10.2.0.4.0 - Production                                
CORE     10.2.0.4.0     Production                                            
TNS for Linux: Version 10.2.0.4.0 - Production                        
NLSRTL Version 10.2.0.4.0 - Production                                

5 filas seleccionadas.

Transcurrido: 00:00:00.09
SQL>
SQL>CREATE TABLE DPRUEBA
  2    (COL1 NUMBER,
  3    COL2 NUMBER) COMPRESS
  4  /

Tabla creada.

Transcurrido: 00:00:00.06
SQL>
SQL>ALTER TABLE DPRUEBA DROP COLUMN COL2
  2  /
ALTER TABLE DPRUEBA DROP COLUMN COL2
*
ERROR en línea 1:
ORA-39726: operación de agregación/borrado de columnas no soportada 
en tablas comprimidas 


Transcurrido: 00:00:00.06
Any idea?

You can always do something like this

SQL> CREATE TABLE DPRUEBA
  2   (COL1 NUMBER,
  3    COL2 NUMBER) COMPRESS
  4  / 

Table created.

SQL>
SQL> ALTER TABLE DPRUEBA DROP COLUMN COL2
  2  /
ALTER TABLE DPRUEBA DROP COLUMN COL2
                                *
ERROR at line 1:
ORA-12996: cannot drop system-generated virtual column

SQL>
SQL> create table new_DPRUEBA
  2  as
  3  select col1
  4    from DPRUEBA
  5  /

Table created.

SQL>
SQL> drop table DPRUEBA
  2  /

Table dropped.

SQL>
SQL> rename new_DPRUEBA to DPRUEBA
  2  /

Table renamed.

SQL>
SQL> desc DPRUEBA
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------
 COL1                                               NUMBER

SQL>
SQL>
SQL> drop table DPRUEBA
  2  /

Table dropped.

SQL>
SQL> 

Note: you must take care of the constraints and triggers, and others

Tags: Database

Similar Questions

  • How to remove a column from a table in a dell identtiymananger 7.0

    How to remove a column from a table in a dell identtiymananger 7.0

    Hello

    In Version 7 of the removal of a single custom column can be accomplished by a stored procedure, available in the database called: QBM_PColumnDrop

    Hope that helps.

    Cordially Fatih

  • Remove the Table created in the forms - IOM Designer

    Dear all,
    Is it possible to remove the Table created in the form designer?

    The Recycle Bin icon is disabled in the console of the design.

    Thank you for your help

    Restore the database.

    This is an instance of dev is for. :)

    Best regards
    / Martin

  • Update multiple columns from multiple tables in a single UPDATE request

    Hello

    I'm trying to figure if I'm heading in the right direction.

    I want to update multiple columns from multiple tables in a single UPDATE request. Also, I would like to update multiple columns in a table from the tables.

    Scenario 1

    UPDATE Table2, Table 3
    SET T2.Column1 = T1.Column1 
    ,T2.Column2 = T1.Column2
    ,T3.Column2 = T1.Column2
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T1.id = T2.id
    and T1.id = T3.id
    
    

    Scenario 2

    UPDATE Table3
    SET T3.Column1 = T1.Column1 
    T3.Column2 = T1.Column2
    ,T3.Column3 = T2.Column3
    ,T3.Column4 = T2.Column4
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T3.id = T1.id
    and T3.id = T2.id
    
    

    Hello

    For scenario 1, you must write separate instructions UPDATE table2 and table3.

    To guard against someone else change one of these tables while you act so you can copy all relevant data in a global temporary table and update this global temporary table table3.

    ENGAGE only when two tables have been changed.

    You can write a procedure or an INSTEAD OF trigger to do all this.

    For scenario 2, you can reference many tables that you need when new table3.  It might be more efficient and simpler to use the MERGER rather than UPDATED.  For example:

    MERGE INTO table3 dst

    WITH THE HELP OF)

    SELECT t1.id

    t1.column1

    t1.column2

    t2.column3

    t2.column4

    FROM table1 t1

    JOIN table2 t2 ON t1.id = t2.id

    )             src

    WE (dst.id = src_id

    WHEN MATCHED THEN UPDATE

    SET dst.column1 = src.column1

    dst.column2 = src.column2,

    dst.column3 = src.column3,

    dst.column4 = src.column4,

    ;

  • Explicit cursor, column from several tables in a variable

    Here's the situation. This DB has tables of metadata. An example of table name would be g3e_attribute. Once you insert a record in a metadata table a trigger of executions insert and insert records in the g3e_attribute_0009 table (table of language, this is what I call it). It would insert in g3e_attribute_000C is the default language is the French. There is also a delete trigger so that if you delete a record in a table of metadata it deletes the corresponding language table. Well, somehow we have entered the language tables that are not in the metadata table. A problem with the system.

    There are 139 tables of language so I prefer not to do it manually.


    So I'm keen to make this code

    delete < table language > where < primary > not in (select < primary > in < metadata table >).

    So I need to loop through the table and and the corresponding primary keys.

    I have this code to get the table names
    Select table_name, substr (table_name, 0, (length (table_name)-5)) in all_tables where table_name like 'G3E_ % _000% ';

    This will display both the language metadata tale table names and.
    The table of language with either _0009 or _000C as a suffix, I take everything but the last 5 characters to get the table metadata.

    And I have the code to find the primary key of the table.
    SELECT column_name FROM ALL_CONS_COLUMNS A JOIN ALL_CONSTRAINTS C ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME WHERE 'G3E_LEGENDENTRY' AND C.CONSTRAINT_TYPE = C.TABLE_NAME = 'P ';


    So I just need to loop through all the tables. Put these pieces together, that's where I encountered a problem. I started to do a procedure, but I ran into a problem.

    When you loop, you move the record being the explicit cursor in a variable. Well, you can set the variable as a vertain column type (%), or type (%ROWTYPE) of the line. Although the sql I use to create the cursor takes columns from multiple tables and returns three columns. So I'm not sure how ot define the variable. The only work around I found was to make a table column_name that contains the table table,. Define the variable as rowType.

    Is there an easier way to do this?


    Thank you

    A couple of points.

    You should not really mix ansi joins and joins in the place where clause. Choose a style and stick to it.

    You can't do the DDL directly in pl/sql. You need to do this, use dynamic sql. something like:

    create or replace
    PROCEDURE SYNC_LANGMETATABLES AS
    
    CURSOR c_TABLE_PRIMARY IS
       select D.table_name, substr(D.table_name,0,(length(D.table_name)-5)),
              column_name
       from all_tables D,
          JOIN ALL_CONSTRAINTS C
             on C.TABLE_NAME = D.TABLE_NAME
          join ALL_CONS_COLUMNS A
             ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME
       where D.table_name like 'G3E_%_000%' AND
             C.CONSTRAINT_TYPE = 'P';
    
       v_LANGTABLE ALL_TABLES.TABLE_NAME%TYPE;
       v_METATABLE ALL_TABLES.TABLE_NAME%TYPE;
       v_PRIMKEY ALL_CONS_COLUMNS.COLUMN_NAME%TYPE;
    
    BEGIN
       OPEN c_TABLE_PRIMARY;
       LOOP
          FETCH c_TABLE_PRIMARY INTO v_LANGTABLE,v_METATABLE,v_PRIMKEY;
          EXIT WHEN c_TABLE_PRIMARY%NOTFOUND;
          execute immediate 'delete from '||v_langtable||' where '||v_PRIMKEY||
                            ' NOT IN(SELECT '||v_PRIMKEY||' FROM v_METATABLE)';
       END LOOP;
       CLOSE C_TABLE_PRIMARY;
    END;
    

    John

  • histogram with just a few columns from a table

    I want to get a histogram of a few columns from a table (4 - 6-... 22)


  • Need help to build the query/pl-sql block to get the query result and the name of column from DB table in the form of key-value pairs.

    Hi Experts,

    I have a DB table has columns of more than 50.

    I question this table, it should only return one line at any time. as sqldeveloper below image.

    here, I need to build block pl/sql-query, Discover the column in the table as a key and query result as values.

    Eg:     Key                         -  Value

    TASK_EVENT_ID - 1765

    EVENT_TYPE - ASR_UPDATE

    ... etc until all of the columns in my table.

    Experts please comment on that point, appreciate your help on this.

    Thank you

    -Vincent.

    Here is an approach using DBMS_SQL to iterate over the columns of key / value to assign... (Little code snipped for brevity)

    create or replace procedure (task_expired)

    v_store_id in full,

    v_task_action_id in full,

    v_job_id in full

    )

    as

    -[SNIP code...]

    v_sql VARCHAR2 (4000): = ' select * from my_table where PK = 123';  -Your SQL here!

    v_v_val VARCHAR2 (4000);

    v_n_val NUMBER;

    v_d_val DATE;

    v_ret NUMBER;

    c NUMBER;

    d NUMBER;

    col_cnt INTEGER.

    f BOOLEAN;

    rec_tab DBMS_SQL. DESC_TAB;

    col_num NUMBER;

    vAsString VARCHAR2 (4000);

    BEGIN

    -[SNIP code...]

    Message_properties. CORRELATION: = "EDF_EVENT";

    MSG: = SYS. AQ$ _JMS_BYTES_MESSAGE. Construct();

    Msg.set_string_property ('queueName', ' shipping/csi_cth');

    Msg.set_string_property ('MODE', 'CR8');

    c: = DBMS_SQL. OPEN_CURSOR;

    DBMS_SQL. PARSE (c, v_sql, DBMS_SQL. NATIVE);

    d: = DBMS_SQL. Execute (c);

    DBMS_SQL. DESCRIBE_COLUMNS (c, col_cnt, rec_tab);

    1.col_cnt J

    LOOP

    CASE rec_tab (j) .col_type

    WHEN 2 THEN

    DBMS_SQL. DEFINE_COLUMN (c, j, v_n_val);      -Number

    WHEN 12 CAN

    DBMS_SQL. DEFINE_COLUMN (c, j, v_d_val);      -Date

    ON THE OTHER

    DBMS_SQL. DEFINE_COLUMN (c, j, v_v_val, 2000);   -Else treat as varchar2

    END CASE;

    END LOOP;

    LOOP

    v_ret: = DBMS_SQL. FETCH_ROWS (c);

    WHEN OUTPUT v_ret = 0;

    1.col_cnt J

    LOOP

    -Fetch each column to the correct data type based on coltype

    CASE rec_tab (j) .col_type

    WHEN 2 THEN

    DBMS_SQL. COLUMN_VALUE (c, j, v_n_val);

    vAsString: = to_char (v_n_val);

    WHEN 12 CAN

    DBMS_SQL. COLUMN_VALUE (c, j, v_d_val);

    vAsString: = to_char (v_d_val, ' DD/MM/YYYY HH24:MI:SS');

    ON THE OTHER

    DBMS_SQL. COLUMN_VALUE (c, j, v_v_val);

    vAsString: = v_v_val;

    END CASE;

    Msg.set_string_property (rec_tab (j) .col_name, vAsString);

    END LOOP;

    END LOOP;

    DBMS_SQL. CLOSE_CURSOR (c);

    DBMS_AQ. ENQUEUE (queue_name-online 'cbus.aqjms_common',

    Enqueue_options => Enqueue_options,

    Message_properties => Message_properties,

    Payload-online msg,

    Msgid => Message_handle);

    dbms_output.put_line ('00 Msgid =' |) Message_handle);

    dbms_output.put_line('===Done=');

    -[SNIP code...]

    END;

    /

  • Delete rows in a table when the columns from two tables match

    Hello

    I have following two tables.

    ===========================================

    create the table empbooth as

    (

    Select 1 empid, 1 double cabin Union all the

    Select option 2, Union 1 double all the

    Select 3, Union 1 double all the

    Select option 4, Union 2 double all the

    Select option 5, 2 double

    );

    create the table attsht as

    (

    Select 1 empid, 240 reg, 0 unpaid all double union

    Select option 2, reg 200, 0 unpaid of all the double union

    Select 3, 240 reg, 0 unpaid all double them union

    Select 4 480 reg, 0 unpaid all double union

    Select 5 240 reg, unpaid double 0

    );

    =================================================

    I want to remove rows from attsht where corresponding booth (which is stored in the empbooth table) is 1.

    The condition is 'where attsht.empid = empbooth.empid and empbooth.booth = 1 '.

    I use oracle 10g.

    Help, please

    delete from attsht where a.empid in (select b.empid from empbooth b where b.booth = 1)

    or

    remove from attsht a

    where exists (select null

    of empbooth b

    where b.booth = 1

    and b.empid = a.empid)

  • Copy columns from one Table to the other with PL/SQL in Apex

    So my goal long-term is to throw this PL/SQL statement in a trial DMBS_SCHEDULER Apex 4.1 to create historical snapshots of the data a week but I'm hooked on this code:

    declare
    V_DEKIT_ID varchar (255);
    V_NT varchar (255);
    Number to resume;
    Date of V_DDATE;

    Start
    for DEKIT_ID in (select * from DKT_HIST)

    loop

    Select DEKIT. DEKIT_ID in V_DEKIT_ID of DEKIT;
    Select DEKIT. NT in DEKIT V_NT;
    Select DEKIT. QUANTITY back of DEKIT;
    Select CURRENT_DATE in double V_DDATE;

    insert into DKT_HIST (DEKIT_ID, NT, QUANTITY, DDATE)
    values (V_DEKIT_ID, V_NT, V_QUANTITY, V_DDATE);
    end loop;

    end;

    I enter this code in the SQL prompt in the SQL workshop and it is said that she is treated, but when I look at the destination table (DKT_HIST), there is no data. Any help would be appreciated.  In this code I want to copy the three columns of the DEKIT table as well as the current date and copy them to DKT_HIST for each row in the table DEKIT.

    Thank you

    -Steve

    The reason why your code did nothing is probably because your loop, using the history table. And since there no data in the historical table first, there is nothing to loop.

    BUT!

    Good code is the task with the least possible effort. Which in your case should result in a code similar to this:

    begin
       insert into DKT_HIST (DEKIT_ID,NT,QUANTITY,DDATE)
       select DEKIT_ID,NT,QUANTITY, trunc(sysdate)
       from DEKIT;
    end;
    
  • Correspondence of the columns from one table to another

    I have a database column that contains the name of a person. I have another table that has a column that contains the names separated by a comma.

    I want to match records where all records of two columns have a corresponding name. I tried this:

    < cfquery name = "MyQuery" datasource = "myds" >

    SELECT *.

    OF TBL_A

    WHERE TBL_A.customername IN (#DifferentQuery.ListOfNames #)

    < / cfquery >

    Everything that I try results in only get a recording. Basically, I want to get all records from a table where one of its columns contains the name of a column in another table.

    It's a many-to-many relationship. That is to say an editorial can be linked to many ads, and vice versa.  He is best represented with three tables. Such as:

    Table: [Editorial] column: [EditorialID (PK), EditorialText,...]

    Table: Columns of the [advertiser]: [AdvertiserID (PK), AdvertiserName]

    Table:   [Editorial_Advertisers] columns: [EditorialID, AdvertiserID]

    The name of the advertiser throw himself into a column...

    my client can decide which ads get related to which editorials

    The third table stores the relationship between ads and editorials.  So instead of storing a list of advertisers, you need to insert record for each EditorialID + AdvertiserID combination. You can then use joins to retrieve all the advertisements for EditorialID 123.

    SELECT  a.AdvertiserName
    FROM     Editorial_Advertiser ea INNER JOIN Advertiser a ON ea.AdvertiserID = a.AdvertiserID
    WHERE   ea.EditorialID = 123
    
  • remove the table filter criteria

    I used af:table to display data and used the data in the column filter to filter. After you have specified any search criteria, that he must remove it manually, and then press ENTER. I want to remove the search by program criteria and display the data in the table without any search criteria.
    How to remove table filter criteria in backing bean and update the table?
    Thanks in advance.

    Use google and search for "programmatically manipulate filter a table QBE fields" (from steve muench) ;)

  • Removes the table causing a lot of disk reads

    Until recently that we hadn't made many deletions on one of our large tables in the comic book. After a recent project has been implemented, system performance has gone downhill a bit. Research in one of the top offenders through v$ sql, we find this:

    REMOVE IRQ INSPECTION_REQUEST WHERE WORK_ORDER_SEQ =: B1 AND SEQUENCE_ID IN (SELECT SEQUENCE_ID FROM (SELECT SEQUENCE_ID, CHAR_VALUE FROM INSPECTION_REQUEST_CHAR WHERE WORK_ORDER_SEQ =: B1) X WHERE THE CHAR_VALUE IS NULL).

    Here are some stats I see in table v$ sql:

    Performances: 4
    Analyze the calls: 4
    Disk reads: 565457
    Gets the buffer: 634626
    Time CPU: 69280000
    Elapsed time: 290015297

    If I read this correctly 100 000 disk reads are performed on average whenever this statement is executed. The situation that I am is that the table we are trying to remove from has not been analyzed in almost 2 years and many of the indexes on the table have not been analysed in more than a year. Is my problem here something to do with the fact that this analysis has not been done or is there something else, I'm missing?

    We checked the SQL to use the correct index and it is set to perform at its best. We have also tried to run this in our dev environment, and we have the same problem with the slow delete. We even watched the rowid for a row we try to delete and tried to delete by the rowid and the DB is still thousands of readings of the disk to perform this deletion. Our dev table and all the clues have been analyzed recently (last month or almost).

    So maybe it takes away the possibility that the absence of analysis of the tables and indices of production contributing to the issue. At this point, I am at a loss. Here is the statistical information for this table in the production.

    Parameter, value
    Size in MB, 20464.00
    Numbers Extents, 1279
    Size in bytes, 21458059264

    TABLE_NAME, INSPECTION_REQUEST
    NOM_TABLESPACE, DATA_LARGE_2
    CLUSTER_NAME,
    IOT_NAME,
    PCT_FREE, 10
    PCT_USED,
    INI_TRANS, 1
    MAX_TRANS, 255
    INITIAL_EXTENT, 1048576000
    NEXT_EXTENT, 16777216
    MIN_EXTENTS, 1
    MAX_EXTENTS, 2147483645
    PCT_INCREASE, 0
    FREELISTS,
    FREELIST_GROUPS,
    LOGGING, YES
    BACKED_UP, N
    NUM_ROWS, 18095357
    BLOCKS, 1196456
    EMPTY_BLOCKS, 0
    AVG_SPACE, 0
    CHAIN_CNT, 0
    AVG_ROW_LEN, 485
    AVG_SPACE_FREELIST_BLOCKS, 0
    NUM_FREELIST_BLOCKS, 0
    DEGREE, 1
    CASE 1
    MEMORY CACHE, N
    TABLE_LOCK, ENABLED
    SAMPLE_SIZE, 18095357
    LAST_ANALYZED, 2007-04-01 06:41:24
    PARTITIONED, NO.
    IOT_TYPE,
    TEMPORARY, N
    SECONDARY, N
    NESTED, DON'T
    USER_TABLES, DEFAULT
    ROW_MOVEMENT, DISABLED
    GLOBAL_STATS, YES
    USER_STATS, NO.
    DURATION,
    SKIP_CORRUPT, DISABLED
    SURVEILLANCE, NO.
    CLUSTER_OWNER,
    ADDICTIONS, DISABILITIES
    COMPRESSION DISABLED

    user9539428 wrote:

    delete from inspection_request where sequence_id = 9911147198;

    SEQUENCE_ID is the primary key on the table INSPECTION_REQUEST. This only delete statement performs 7 000 disk reads. Is this normal? We have this problem even if it is disable triggers that would fire following this statement.

    To everyone who looks at the thread, the version of db, on that we are is 9.2.0.8.

    If you have verified that all triggers are actually disabled on the table, there are a few potential candidates that could cause this large amount of activity during the removal of a single line:

    * Enabled foreign keys referencing this table
    * Maintenance of Index, your index finger on the table could be degenerate and could benefit from an operation of "merge".
    * Bugs in SAMS if you use a tablespace locally managed with automatic management of the space for indexes

    You can follow this thread that might have similar problems:

    Ellapsed time too tkprof output

    Try to run the simple removal using SQL trace enabled (Event 10046) scopes as described in the above thread. After the release of "tkprof" of the trace file generated here, as described in the following thread: [when your query takes too long | http://forums.oracle.com/forums/thread.jspa?threadID=501834]

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • Remove the table for a photo table control framework

    Hello

    I need to create an array of 2D images. Due to the large amount of elements in the array, the width of the image is reduced to a minimum. However there are still a considerable gap between the 2 adjacent elements in the table (see the attached example), which is caused by the picture in the image control.

    I tried to affect the color of transparent photo frame, but even if it is invisible, it is still there. I tried to customize the control too, but I couldn't find a way to remove the framework (for classic and modern styles).

    (BTW, for the control of classical style, there is an option without color box control framework, but no option for 2D image control.) I need model/photos inside the element of control 2D image, so simple color 1 color box is not enough)

    Could someone help to suggest a way to remove the frame and optimize the density of space in the table? Thank you much in advance.

    PJI

    Hello, PJI,.

    You should be able to define the lower field in the area of the image of the control.

    -Right click Control and choose "Advanced Properties"-> "Customize.."

    -To the editor change order to 'Edit Mode'

    -from the menu, click on 'Window'-> 'display the parts.

    -In the part window, select the frame

    -set new values for top, left, height, and width, so that the image is behind the area of the photo

    I hope this helps.

    UliB

  • Remove the table if the value not in APEX_APPLICATION. G_f01?

    Hello again!

    I have an apex_application.g_f01 that contains the values in the boxes, now I want apex to remove rows from the table that contains values that are not present in the G_f01 (what are disabled) on submit.

    I can't understand the sql code to do this, could someone give an example?

    This can be a simple thing, but I'm getting confused a lot with sql, maybe because I just php and java.

    EgaSega wrote:

    I have an apex_application.g_f01 that contains the values in the boxes, now I want apex to remove rows from the table that contains values that are not present in the G_f01 (what are disabled) on submit.

    I can't understand the sql code to do this, could someone give an example?

    This can be a simple thing, but I'm getting confused a lot with sql, maybe because I just php and java.

    One possibility would be to create a collection of APEX containing key checked values and use that as the source of the lines to be kept in the SQL delete. Something like:

    begin
    
      apex_collection.create_or_truncate_collection('CHECKED_VALUES');
    
      for i in 1..apex_application.g_f01.count
      loop
        apex_collection.add_member(
            p_collection_name => 'CHECKED_VALUES'
          , p_c001 => apex_application.g_f01(i));
      end loop;
    
      delete from t
      where not exists (select
                           null
                       from
                            apex_collections c
                       where
                           collection_name = 'CHECKED_VALUES'
                       and c.c001 = t.id);
    
    end;
    
  • How to remove the table border

    Dear Kings.

    I was trying to remove the borders of tables (my coding below).

    This encoding does not "result: undefined"? How to remove all borders from the table. Please suggest friends.

    var mTables = app.activeDocument.stories.everyItem().tables.everyItem();  
    with (mTables) {  
      topBorderStrokeWeight = 0;
      bottomBorderStrokeWeight = 0;
      leftBorderStrokeWeight = 0;
      rightBorderStrokeWeight = 0;
      }
    alert("Done")
    

    Thank you in advance to all

    Try this,

    if(app.activeDocument.stories.everyItem().tables.length>0)
    {
    app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = 0;
    app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = 0;
    app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = 0;
    app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = 0;
    }
    

Maybe you are looking for