DROP column from constarints
Hi,
I need to know the command to drop columns from primary key constraints.(some columns)
Please help on this,
Thanks,
826854 wrote:
is there any other way to drop only some columns without recreating it.
just i want to know alternate , if iam wrong please ignore.
Thanks for the answer.Its there any issue you face to just drop and add new primary key in your setup i.e. you fear that volum is high and dropping and adding back would take time?
Similar Messages
-
Drop column from compressed table
NLSRTL
11.2.0.3.0
Production
Oracle Database 11g Enterprise Edition
11.2.0.3.0
64bit Production
PL/SQL
11.2.0.3.0
Production
TNS for Linux:
11.2.0.3.0
Production
Hello,
I read about how to drop column from a compressed table - first set it unused and then drop the unused columns. However, in the example below on the database I ran it, it does not work. Please, can you tell me WHEN this approach does not work. What it is dependent on - parameters or something else. Why I cannot drop the unused columns?
And the example along with the errors:
create table tcompressed compress as select * from all_users;
> table TCOMPRESSED created.
alter table tcompressed add x number;
> table TCOMPRESSED altered.
alter table tcompressed drop column x;
>
Error report:
SQL Error: ORA-39726: unsupported add/drop column operation on compressed tables
39726. 00000 - "unsupported add/drop column operation on compressed tables"
*Cause: An unsupported add/drop column operation for compressed table
was attemped.
*Action: When adding a column, do not specify a default value.
DROP column is only supported in the form of SET UNUSED column
(meta-data drop column).
alter table tcompressed set unused column x;
> table TCOMPRESSED altered.
alter table tcompressed drop unused columns;
>
Error report:
SQL Error: ORA-39726: unsupported add/drop column operation on compressed tables
39726. 00000 - "unsupported add/drop column operation on compressed tables"
*Cause: An unsupported add/drop column operation for compressed table
was attemped.
*Action: When adding a column, do not specify a default value.
DROP column is only supported in the form of SET UNUSED column
(meta-data drop column).
As you can see even after altering the table by setting the column X as unused I still cannot drop it by using DROP UNUSED COLUMNS.
Thank you.check this link it might help. At the end it has also mentioned of a bug check the same.
http://sharpcomments.com/2008/10/ora-39726-unsupported-adddrop-column-operation-on-compressed-tables.html -
Cannot drop column from table owned by SYS
Hello everybody,
How can I drop a column of table which is owned by sys? thanks!
Result as follows:
SQL> ALTER TABLE HELLO_TB DROP COLUMN NUM;
ALTER TABLE HELLO_TB DROP COLUMN NUM
ERROR at line 1:
ORA-12988: cannot drop column from table owned by SYS
newbie vYou can not 'change' the ownership.
You can, however, 'move' or 'clone' most objects by exporting and importing. As follows:
I create a table under SYS (shudder).
I then export it
- using userid SYS in this case,
- under normal circumstances I'd either use a DBA account or the owner's userid
- since I want a table, I use the TABLES option - a list is comma separated and in quotes
I then import it using a 'userid' switch - fromuser & touser options
- in this case from SYS to HR
Finally, I verify it was transported.
Actual console session in Linux follows:
pop2@fuzzy:~> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 10 19:58:01 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> create table test1 ( x1 number );
Table created.
SQL> insert into test1 values (2);
1 row created.
SQL> select * from test1;
X1
2
SQL> Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
pop2@fuzzy:~> exp file=exp.dmp tables='TEST1'
Export: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:07 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: sys/????? as sysdba
Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table TEST1 1 rows exported
Export terminated successfully without warnings.
pop2@fuzzy:~> imp file=exp.dmp fromuser=sys touser=hr
Import: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:44 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: sys/????? as sysdba
Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Export file created by EXPORT:V10.02.01 via conventional path
import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
. importing SYS's objects into HR
. . importing table "TEST1" 1 rows imported
Import terminated successfully without warnings.
pop2@fuzzy:~> sqlplus hr/hr
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:57 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select * from test1;
X1
2
SQL>The export/import pair are incredibly powerful - and few people understand them well. If you are interested in digging into their capability, check out their chapters in the Utilities manual (under the Books tab) at http://www.oracle.com/pls/db102/portal.portal_db?selected=1 -
Error in Dropping columns from Subject Area to selected Columns section
While Dropping columns from Subject Area to selected Columns section in Analytics nothing is happening.There is no error in the RPD.I am using OBIEE 11g and windows7.I am also getting page error like below:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Tue, 4 Sep 2012 08:31:07 UTC
Message: 'kmsgPickerUIJSCantAddColumns' is undefined
Line: 1
Char: 1781
Code: 0
URI: http://localhost:7001/analytics/res/b_mozilla/picker.js
Message: 'kmsgPickerUIJSCantAddColumns' is undefined
Line: 1
Char: 1781
Code: 0
URI: http://localhost:7001/analytics/res/b_mozilla/picker.js
Can you guys please help?That error usually means it is still mapped, maybe it is used in another interface if you say the mapping has definitely been removed.
You can expand the datastore > Used In > "As a Target" or "As a Source" or "In a Package" - that should tell you if it being used anywhere else.
Cheers
John
http://john-goodwin.blogspot.com/ -
HOWTO drop column from Designer instead of warning
Hi,
is there possibility to tell designer to generate scripts for dropping columns that are no longer in repository? I'm using Designer 6i.
Thank you,
RadekThis functionality is not available in Designer at this point. The decision not to drop the column was in order to try to preserve data integrity.
However, as the database now allows you to do this, we have decided to add this functionality to Designer. In the short term you will need to
update your DDL scripts manually, but we hope to bring you this functionality automatically from Designer by the end
of this calendar year or early next year in a maintenance release.
Regards
Sue Harper -
Drop column from compressed partitioned table
Hi,
DB version is 11.2.02.
We have table which is range partitioned and sub-partitioned by list.
Table is also compressed.
When I try to drop a column, I get error.
CREATE TABLE DWH_REP.P_RATING (
id_source$ NUMBER(38,0) NULL,
time_insert$ DATE ,
time_update$ DATE ,
FLG_CURRENT$ NUMBER(38,0) ,
FLG_CHANGED$ NUMBER(38,0) ,
id_audit$ NUMBER(38,0) ,
ID_DATE_PSTING NUMBER(38,0) ,
partner_rating_id VARCHAR2(256) ,
partner_id VARCHAR2(256) ,
id_partner NUMBER(38,0) ,
rating_system_id VARCHAR2(256) ,
rating_id VARCHAR2(256) ,
date_rating DATE ,
date_follow_up DATE ,
risk_team_id VARCHAR2(256) ,
risk_team_descr VARCHAR2(256) ,
risk_team_changed_id VARCHAR2(256) ,
risk_team_changed_descr VARCHAR2(256) ,
date_risk_team_changed DATE ,
assignment_id VARCHAR2(256) ,
date_assignment DATE ,
date_assignment_confirmed DATE ,
date_assignment_expiration DATE ,
flg_exception VARCHAR2(256) ,
exception_id VARCHAR2(256) ,
date_exception DATE
-- TABLESPACE DWH_REP_DATA
PARTITION BY RANGE (FLG_CURRENT$, ID_DATE_PSTING)
SUBPARTITION BY LIST (ID_SOURCE$)
(PARTITION P_RATING_2010
VALUES LESS THAN (0, 20110101)
SUBPARTITION P_RATING_2010_UCS VALUES (10) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_UCM VALUES (11) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI30 VALUES (30) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI31 VALUES (31) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_CETELEM VALUES (40) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_MILES VALUES (60) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_BHI VALUES (80) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_DF VALUES (DEFAULT) TABLESPACE DWH_O_2010_TBS),
PARTITION P_RATING_2011
VALUES LESS THAN (0, 20120101)
SUBPARTITION P_RATING_2011_UCS VALUES (10) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_UCM VALUES (11) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI30 VALUES (30) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI31 VALUES (31) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_CETELEM VALUES (40) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_MILES VALUES (60) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_BHI VALUES (80) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_DF VALUES (DEFAULT) TABLESPACE DWH_O_2011_TBS),
PARTITION P_RATING_current
VALUES LESS THAN (maxvalue, maxvalue)
SUBPARTITION P_RATING_CUR_UCS VALUES (10) TABLESPACE DWH_O_CRT_UCS_TBS,
SUBPARTITION P_RATING_CUR_UCM VALUES (11) TABLESPACE DWH_O_CRT_UPM_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI30 VALUES (30) TABLESPACE DWH_O_CRT_ORBI30_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI31 VALUES (31) TABLESPACE DWH_O_CRT_ORBI31_TBS,
SUBPARTITION P_RATING_CUR_CETELEM VALUES (40) TABLESPACE DWH_O_CRT_CETELEM_TBS,
-- SUBPARTITION P_RATING_CUR_MILES VALUES (60) TABLESPACE DWH_O_CRT_MILES_TBS,
-- SUBPARTITION P_RATING_CUR_BHI VALUES (80) TABLESPACE DWH_O_CRT_BHI_TBS,
SUBPARTITION P_RATING_CUR_DF VALUES (DEFAULT) TABLESPACE DWH_O_CRT_DF_TBS))
ENABLE ROW MOVEMENT
NOLOGGING
COMPRESS
NOCACHE
NOPARALLEL
MONITORING;
ALTER TABLE DWH_REP.P_RATING DROP COLUMN ID_PARTNER;
ORA-39726: unsupported add/drop column operation on compressed tableslittleboy wrote:
Hi,
DB version is 11.2.02.
We have table which is range partitioned and sub-partitioned by list.
Table is also compressed.
When I try to drop a column, I get error.
CREATE TABLE DWH_REP.P_RATING (
id_source$ NUMBER(38,0) NULL,
time_insert$ DATE ,
time_update$ DATE ,
FLG_CURRENT$ NUMBER(38,0) ,
FLG_CHANGED$ NUMBER(38,0) ,
id_audit$ NUMBER(38,0) ,
ID_DATE_PSTING NUMBER(38,0) ,
partner_rating_id VARCHAR2(256) ,
partner_id VARCHAR2(256) ,
id_partner NUMBER(38,0) ,
rating_system_id VARCHAR2(256) ,
rating_id VARCHAR2(256) ,
date_rating DATE ,
date_follow_up DATE ,
risk_team_id VARCHAR2(256) ,
risk_team_descr VARCHAR2(256) ,
risk_team_changed_id VARCHAR2(256) ,
risk_team_changed_descr VARCHAR2(256) ,
date_risk_team_changed DATE ,
assignment_id VARCHAR2(256) ,
date_assignment DATE ,
date_assignment_confirmed DATE ,
date_assignment_expiration DATE ,
flg_exception VARCHAR2(256) ,
exception_id VARCHAR2(256) ,
date_exception DATE
-- TABLESPACE DWH_REP_DATA
PARTITION BY RANGE (FLG_CURRENT$, ID_DATE_PSTING)
SUBPARTITION BY LIST (ID_SOURCE$)
(PARTITION P_RATING_2010
VALUES LESS THAN (0, 20110101)
SUBPARTITION P_RATING_2010_UCS VALUES (10) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_UCM VALUES (11) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI30 VALUES (30) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_ORBI31 VALUES (31) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_CETELEM VALUES (40) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_MILES VALUES (60) TABLESPACE DWH_O_2010_TBS,
-- SUBPARTITION P_RATING_2010_BHI VALUES (80) TABLESPACE DWH_O_2010_TBS,
SUBPARTITION P_RATING_2010_DF VALUES (DEFAULT) TABLESPACE DWH_O_2010_TBS),
PARTITION P_RATING_2011
VALUES LESS THAN (0, 20120101)
SUBPARTITION P_RATING_2011_UCS VALUES (10) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_UCM VALUES (11) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI30 VALUES (30) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_ORBI31 VALUES (31) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_CETELEM VALUES (40) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_MILES VALUES (60) TABLESPACE DWH_O_2011_TBS,
-- SUBPARTITION P_RATING_2011_BHI VALUES (80) TABLESPACE DWH_O_2011_TBS,
SUBPARTITION P_RATING_2011_DF VALUES (DEFAULT) TABLESPACE DWH_O_2011_TBS),
PARTITION P_RATING_current
VALUES LESS THAN (maxvalue, maxvalue)
SUBPARTITION P_RATING_CUR_UCS VALUES (10) TABLESPACE DWH_O_CRT_UCS_TBS,
SUBPARTITION P_RATING_CUR_UCM VALUES (11) TABLESPACE DWH_O_CRT_UPM_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI30 VALUES (30) TABLESPACE DWH_O_CRT_ORBI30_TBS,
-- SUBPARTITION P_RATING_CUR_ORBI31 VALUES (31) TABLESPACE DWH_O_CRT_ORBI31_TBS,
SUBPARTITION P_RATING_CUR_CETELEM VALUES (40) TABLESPACE DWH_O_CRT_CETELEM_TBS,
-- SUBPARTITION P_RATING_CUR_MILES VALUES (60) TABLESPACE DWH_O_CRT_MILES_TBS,
-- SUBPARTITION P_RATING_CUR_BHI VALUES (80) TABLESPACE DWH_O_CRT_BHI_TBS,
SUBPARTITION P_RATING_CUR_DF VALUES (DEFAULT) TABLESPACE DWH_O_CRT_DF_TBS))
ENABLE ROW MOVEMENT
NOLOGGING
COMPRESS
NOCACHE
NOPARALLEL
MONITORING;
ALTER TABLE DWH_REP.P_RATING DROP COLUMN ID_PARTNER;
ORA-39726: unsupported add/drop column operation on compressed tables
can you checkwith following?
SQL>alter table t set unused column x;
SQL>alter table t drop unused columns;Tom explains it ->http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:69076630635645 -
Alter table tablename drop column col
I tried to drop a column from a table created by sys user. Being a sys user I am unable to drop the column. Please explain.
SQL> alter table test move tablespace users;
Table altered.
SQL> alter table test drop column two;
alter table test drop column two
ERROR at line 1:
ORA-12988: cannot drop column from table owned by SYS
Here two is the column name.
Regards
Vijay KumarHello Gasparotto
It is amazing to me. Being a sys user I created a table and then I tried to alter the table by dropping a column but it is giving me error as I have already stated. Please explain over this issue.
Regards
Vijay Kumar -
I have an Oracle table with 60million records in it. I have about 35 columns in it and it takes about 40GB of tablespace in the database. I would like to drop some columns to reduce the table size (& also to reduce tablespace usage). Am using Oracle 9i and tried the drop column command. I get the ORA-30036 unable to extend the segment by 8192 in undo tablespace 'UNDOTBS1'. How to I overcome this issue? Is there any effecient way to drop columns from such a large table? Please advise
>>Actually after we 've made column UNUSED, we lost it.
Right.
>>Because if there is no resource consumption we also can just DROP when the database is less use. So there is no much logic to make it UNUSED and then DROP.
I maybe not very well explained.
Yes there is logic, if you don't want anymore a column, but the application is in used, it can be interesting to set the column as "unused" - that doesn't consumme too much resource, and really drop the column later. Because drop a column implies a reading a every block of the table, which can slow down the database, and all the system.
Create a new table may be better for performance, if you're allowed to do this, that implies the tale is no more accessible during the operation. And constraints, indexes should be rebuild as well.
Nicolas. -
What happens if column from idex is dropped and recreated
I have question. I need to drop one column from a table. That column is part of unique index.
If i drop a column and recreate it would it drop index also. Do i need to re-create the index also.
ThanksIs it not possible for you run a quick test on a small table to find out?
-
Dropping unused columns from database table
I have an existing table called TUSER. I have mapped some fields, but not
all fields, as some are inserted by other applications and for reporting
purposes.
I am using JDK 1.3.1_02, Windows 2000, SQL Server 2000 database, Kodo
JDOEE 2.2.6 and JBoss 3.0.0.
When I refresh the datastore it drops all columns that are not mapped
(note that these colums can contain null values):
[java] [ connection: 2961925; statement: 2766626; time: Thu Jul 04
15:33:22 JST 2002 ] ALTER TABLE TUSER ADD Job_Title_ID VARCHAR(255)
[java] [ connection: 2961925; statement: 1582473; time: Thu Jul 04
15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MAILUSERID
[java] [ connection: 2961925; statement: 5237832; time: Thu Jul 04
15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PHONENUMBERS
[java] [ connection: 2961925; statement: 2191491; time: Thu Jul 04
15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMPLOYEENO
[java] [ connection: 2961925; statement: 894443; time: Thu Jul 04
15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MDATE
[java] [ connection: 2961925; statement: 531758; time: Thu Jul 04
15:33:22 JST 2002 ] ALTER TABLE TUSER DROP COLUMN STATUSCHANGETIME
[java] [ connection: 2961925; statement: 5899013; time: Thu Jul 04
15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN FINISHDATE
[java] [ connection: 2961925; statement: 8146001; time: Thu Jul 04
15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDMBOARD
[java] [ connection: 2961925; statement: 7756310; time: Thu Jul 04
15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN DEL_FLG
[java] [ connection: 2961925; statement: 6817858; time: Thu Jul 04
15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_CD
[java] [ connection: 2961925; statement: 7754670; time: Thu Jul 04
15:33:23 JST 2002 ] ALTER TABLE TUSER DROP COLUMN LASTLOGGEDREQUESTER
[java] [ connection: 2961925; statement: 7332084; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MSG_SERVER
[java] [ connection: 2961925; statement: 1691809; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN AUTORUN
[java] [ connection: 2961925; statement: 5253969; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN REG_DATE
[java] [ connection: 2961925; statement: 4977422; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN PERMIT_LST
[java] [ connection: 2961925; statement: 4343712; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN ALLOWREPL
[java] [ connection: 2961925; statement: 7104150; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN EMAIL
[java] [ connection: 2961925; statement: 4395840; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MANAGERSTATUS
[java] [ connection: 2961925; statement: 2417379; time: Thu Jul 04
15:33:24 JST 2002 ] ALTER TABLE TUSER DROP COLUMN MD5_DIGEST
[java] [ connection: 2961925; statement: 2865120; time: Thu Jul 04
15:33:25 JST 2002 ] ALTER TABLE TUSER DROP COLUMN SMTPADDRESS
15:33:25 JST 2002 ] INSERT INTO JDO_SCHEMA_METADATAX(CLASSNAMEX) VALUES
('com.gulfnet.g
roupcast.data.User')
Is this meant to happen? I am guessing not. Is there a way to tell the
schematool to not remove existing columns?
Thanks in advance.
KamYou can in fact tell the schematool not to drop columns it doesn't know about. When you run the schematool, use the "add" action rather than "refresh". Then it will only add columns, never drop them. See the documentation for details:
http://www.solarmetric.com/Software/Documentation/2.2.5/manual.html#schema_manipulation -
Hello. When I right click a cube in the solution explorer and click browse, I am presented with a Details field area which doesn't have "Drop Row Fields" area like in BIDS 2008, and doesn't have "Drop Column Fields" area like in BIDS. It just has one details
area with the message "Drag levels or measures here to add to the query".
How do I include the "Drop Row Fields" area and the "Drop Column Fields" area in this Details area so it can be like 2008?I am using MDX query to build SSRS report.
How do i get MDX query from Excel ?
Hi Vishal,
We can use "OLAP PivotTable Extension" to get MDX query in Excel, please download it from:
http://olappivottableextend.codeplex.com/
In addition, I would suggest you open a new case if you have any more questiosn.
Regards,
Elvis Long
TechNet Community Support -
How to delete columns from process form table
hi,
I have a process form UD_FN_USR. I created one column userid with type long and later the requirement got changed and I need to change the type to string.I am able to delete the column from design console but in the table the column exits so that I coulnt create the column with same name as type string , its tellling same column name exits with different datatype in current version or previous versions.can anybody please tell me how to solve this issueSorry for late response. Got stuck in work.
This time it will answered ;-)
ALTER TABLE UD_ABCD DROP COLUMN UD_ABCD_UID
DELETE FROM SDC WHERE SDC_NAME='UD_ABCD_UID';
COMMIT;
Thanks
Rajiv Dewan -
Shutdown hangs after drop column
Hi,
We were trying to drop column on a very big table, after that we cancelled that operation, and given shutdown immediate command.
Now shutdown is taking too much time, going on from last 9 hours.....
We want to start the database, what can be the best possible solution.
Shutdown abort and startup will help ?
Thanks
Dilipkumar Patel.We were trying to drop column on a very big table, after that we cancelled that operation, and given shutdown immediate command.I guess SMON was doing rollback the transaction when you cancelled the operation. Since it was a big table, it was taking lot of time.
Can you check the alter log is there any error or info msg in it?
I am afraid if you give shutdown abort, may cause serious issues.
Before you execute 'shutdown abort', make sure you have good backup, in case of recovery.
Jaffar -
How to remove some columns from an existing table?
Let's say my table's structure is as follows:
Table name: EMPLOYEE
Columns: Name, Birthdate, Gender, Salary, Hometown, Language and so on.
There are data in the table. Now I want to remove columns Hometown and Language, and I don't care the data loss. Also, there is no constraint.
What's the sql command to do this? Thanks!I think you need to be a bit more specific than stating that something is not correct.
It is perfectly correct and proper to drop a column from a table even when there is data. The problem comes when you need to drop a column and the window you have to perform the expensive operation of actually reclaiming the disk space is insufficient. If that is the case (and there is no indication from the original poster that is the case, but it's certainly conceivable), it may make sense to mark the column as unused, which is a quick update to the data dictionary and then drop the unused columns at a later date when you have a larger window. This is incredibly useful in a handful of larger systems, but not particularly necessary in most systems most of the time. It wouldn't make sense to mark a column unused and then immediately drop the column.
If you are going to go the SET UNUSED route, your syntax is incorrect. Once you mark the column unused, you can't drop the column by name any longer (since you can add a column with the unused column's old name, it's also potentially rather dangerous). You have to use the DROP UNUSED COLUMNS clause
SQL> desc x;
Name Null? Type
COL1 NOT NULL NUMBER
COL2 NUMBER
SQL> alter table x set unused column col2;
Table altered.
SQL> alter table x drop column col2;
alter table x drop column col2
ERROR at line 1:
ORA-00904: "COL2": invalid identifier
SQL> alter table x drop unused columns;
Table altered.Justin -
Dealing with errors due to newly added/dropped columns
DB version:11g
I am not sure if i have created an unnecessarily large post to explain a simple issue. Anway, here it is.
I have been asked to code a package for Archiving .
We'll have two schemas;The original schema and an Archive schema (connected via a DB Link)
ORIGINAL Schema -------------------------> ARCHIVE Schema
via DB Link When records of certain tables in the ORIGINAL schema meet the archiving criteria (based on Number of Days Old, Status Code etc), it will be moved ('archived') to the ARCHIVE schema using the INSERT syntax
insert into arch_original@dblink
col1,
col2,
col3,
select col1,
col2,
col3,
from original_tableThe original table and its archive table has the same structure, except that the Archive table has an additional column called archived_date which just records when a record got archived.
create table original
col1 varchar2(33),
col2 varchar2(35),
empid number
create table arch_original
col1 varchar2(33),
col2 varchar2(35),
empid number,
archived_date date default sysdate not null
);We have tables with lots of columns(there are lots of tables with more than 100 columns) and when all column names are explicitly listed like the above syntax, the code becomes huge.
Alternative Syntax:
So i thougt of using the syntax
insert into arch_original select original.*,sysdate from original; -- sysdate will populate archived_date columnEventhough the code looks simple and short, i've noticed a drawback to this approach.
Drawback:
For the next release, if developers decide to add/drop a column in the ORIGINAL table in the Original Schema, that change should be reflected in the archive_table's (ARCHIVE schema) DDL script as well. It is practically impossible to keep track of all these changes during the development phase.
If i use
insert into arch_original select original.*,sysdate from original; syntax, you will realise that there is change in the table structure only when you encounter an error(due to missing/new column) in the Runtime. But, if you have all the column names listed explicitly like
insert into arch_original@dblink
(col1,
col2,
col3,
select col1,
col2,
col3,
from original_tablethen you'll encounter this error during the Compilation itself. I prefer the error due to a missing/new column during the Compilation itself rather than in Runtime.
So what do you guys think? I shouldn't go for
insert into arch_original select original.*,sysdate from original; syntax because of the above Drawback. Right?What advantage would it bring if i make ARCHIVED_DATE as the first column in the ARCHIVE tables?The advantage is that if you'll add a column in the future on both original and archived tables the insert statement will work anyway...
SQL> create table x (a number, b number);
Table created.
SQL> create table y (arc_date date, a number, b number);
Table created.
SQL> insert into x values (1,1);
1 row created.
SQL> insert into x values (2,2);
1 row created.
SQL> select * from x;
A B
1 1
2 2
SQL> insert into y select sysdate, x.* from x;
2 rows created.
SQL> alter table x add (c number);
Table altered.
SQL> alter table y add (c number);
Table altered.
SQL> alter table x drop column b;
Table altered.
SQL> alter table y drop column b;
Table altered.
SQL> insert into x values (3,3);
1 row created.
SQL> insert into y select sysdate, x.* from x
2 where a=3;
1 row created.
SQL> select * from x;
A C
1
2
3 3
SQL> select * from y;
ARC_DATE A C
25-JAN-10 1
25-JAN-10 2
25-JAN-10 3 3Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/23/la-forza-del-foglio-di-calcolo-in-una-query-la-clausola-model/]
Edited by: Massimo Ruocchio on Jan 25, 2010 12:44 PM
Added more explicative example
Maybe you are looking for
-
Problem on degital sign the PDF document i.e ROC forms
For additional help, reach us at http://helpx.adobe.com/contact.html General Info Chat start time Jan 6, 2015 10:06:03 PM PST Chat end time Jan 6, 2015 10:14:00 PM PST Duration (actual chatting time) 00:07:57 Operator Imran Chat Transcript info: Than
-
How to use a function in OWB 11.2
Hello all, I need help running an Oracle function in OWB 11.2 I have created and defined the parameters of the function within the design center by right clicking on function, new from the Projects Explorer window. I have also validated the Function
-
Transfering files from PC to Mac via ethernet cable
I have been unable to connect my Mac for file transfer. I followed the directions on the following sites: http://docs.info.apple.com/article.html?artnum=304721 http://docs.info.apple.com/article.html?artnum=106471 I connected both computer via an eth
-
Keeping songs in the original album order?
I tried to play a few "Album"s on my iPod mini, but the songs don't stay in the order they are in on the CD. I wouldn't care so much but some of them are Broadway Soundtracks and I don't like hearing them out of order nessisarily. I tried changing th
-
Set default PDF extension for Downloaded Forms - Collaborator
Is there a way of making .PDF the deafult file extension for downloaded forms? I'm trying to dteremine if this feature is controlled by the actual subscription type pr the access type. I have a Basic User Account setup as a Collaborator on a form whi