Can we rename a column in Oracle 8.1.7.4 version?
Can we rename a column in Oracle 8.1.7.4 version?
Hi,
There is no direct way of doing it but if you have DBA access then try this: (these 2 tables are in SYS user)
SELECT obj#
FROM obj$
WHERE name = 'your table name';
SELECT col#
FROM col$
WHERE obj# = obj# from above query
AND name = 'your column name';
UPDATE col$
SET name = 'new column name'
WHERE obj# = obj# from first query
AND col# = col# from above query;
And this change might not be immediately visible.
So once you are done with above, run the following:
ALTER SYSTEM FLUSH SHARED_POOL;
Then go to the respective user and describe the table and you will see new name. There might be some mistake in the above queries as I could not test it because I don't have ORACLE on my current system.
Hope this helps.
Regards
-Rajeev
Similar Messages
-
Can we rename a column in a table ?
I am faced with a situation where I need to rename the column in a particular table. The version of Oracle is 8.1.7.2.0
Is there a DDL clause for renaming a column, or does it have to be done the conventional way - drop the column ( you want to rename ) and add a new column (with new name) ?Direct column renaming is not available unti 9iR2. Prior to that, yes, you need to:
1) Add a column with the new name
2) Update new column with old column data
3) Drop old column -
Is there any option in oracle 10g to rename a column?
Hi friends,
Is there any option in oracle 10g to rename a column? Please send me reply....Waiting for that...You can even rename a column in oracle 8i or 9i
E.g:
ALTER TABLE TABLE_NAME RENAME COLUMN OLD_COLUMN_NAME TO NEW_COLUMN_NAME;Message was edited by:
Mohana Kumari -
Can we rename column in Oracle 9i?
Thanks,
AlexI don't think it should be that complicated unless you have any contraints to it. Do you have any foreign keys that are referencing to this particular table ? Also let me know what syntax are you using for dropping the column ?
Also look at the following example, try these things on some test/dummt table first.
Dropping a Column: Example
===========================
This statement illustrates the drop_column_clause with CASCADE CONSTRAINTS. Assume table t1 is created as follows:
CREATE TABLE t1 (
pk NUMBER PRIMARY KEY,
fk NUMBER,
c1 NUMBER,
c2 NUMBER,
CONSTRAINT ri FOREIGN KEY (fk) REFERENCES t1,
CONSTRAINT ck1 CHECK (pk > 0 and c1 > 0),
CONSTRAINT ck2 CHECK (c2 > 0)
An error will be returned for the following statements:
/* The next two statements return errors:
ALTER TABLE t1 DROP (pk); -- pk is a parent key
ALTER TABLE t1 DROP (c1); -- c1 is referenced by multicolumn
-- constraint ck1
Submitting the following statement drops column pk, the primary key constraint, the foreign key constraint, ri, and the check constraint, ck1:
ALTER TABLE t1 DROP (pk) CASCADE CONSTRAINTS;
If all columns referenced by the constraints defined on the dropped columns are also dropped, then CASCADE CONSTRAINTS is not required. For example, assuming that no other referential constraints from other tables refer to column pk, then it is valid to submit the following statement without the CASCADE CONSTRAINTS clause:
ALTER TABLE t1 DROP (pk, fk, c1);
Shalu -
Can we rename the database name in oracle 10g
Hi,
Can we rename the database name in oracle 10g.
Please helpYes as already said, using DBNEWID Utility can renamed the database name.
You can also take a look at the Oracle Metalink Note:429674.1 (Which was written by me) - Subject: How We Used the Oracle DBNEWID Utility to Change the Database Name
Regards,
Sabdar Syed. -
How to rename the column name in oracle 8i?
hi,
Does anyone know how to rename the column name in oracle 8i?My method was drop the relationship key first then delete the old column,finally add the new column.
Thanks for your replay.
jingThere is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
For you task one example given below.
Example:-
Already existed table is ITEMS
columns in ITEMS are ITID, ITEMNAME.
But instead of ITID I want ITEMID.
Solution:-
step 1 :- create table items_dup
as select itid itemid, itemname from items;
step 2 :- drop table items;
step 3 :- rename items_dup to items;
Result:-
ITEMS table contains columns ITEMID, ITEMNAME -
Can i moved any column position at runtime, like ORACLE APPLICATIONs.
Can i moved any column position at runtime, like ORACLE APPLICATIONs.
( move left - right ..... )
Thank youNajeeb ur Rehman
Thank you very much -
Can we rename Oracle username & tablespace name in 11g R2
- We have Oracle tablespace name "TULIP"
- We have Oracle username "TULIP"
Default tablespace for use TULIP is TULIP.
- Now can we rename tablespace TULIP to TULIP_NEW ?
- Now can we rename username TULIP to TULIP_NEW ?
Can this be done online when the database is running ?
If NOT please give me the steps involved.
Thanks
BristolYes you can rename a tablespace.
ALTER TABLESPACE <tablespace_x> RENAME TO <tablespace_y>;As far as renaming the schema there is no command for that. One approach would be to export the data and re-import using the REMAP_SCHEMA (for Data Pump) option. -
How can I delete column in oracle 8i
Hi,
How can I remove the Column from table in oracle 8i
ex: table Name EMP
Empid Number(8)
EmpFName Varchar2(64)
EmpLName Varchar2(64)
EmpDOB Varchar2(10)
EmpAge Number(2)
Here i want to remove the Empage column.
Kindly give the solution.
Advance ThanxShankar,
(Shankar is my friend..)
You have to verify any composite index that are pointing to the column before dropping or setting unused to that column if required.
Othatwise the index will be amicably lost. Just gather that information before dropping, sothat you can rebuild that index after drop.
SQL> create table test(no number(10),tst_unused number(10));
Table created.
SQL> create index tst_un_idx on test(NO,TST_UNUSED);
Index created.
SQL> insert into test values(1,2);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> alter table test set unused column tst_unused;
Table altered.
SQL>
SQL> select * from user_indexes where TABLE_NAME='TEST';
no rows selected
SQL> create index tst_un_idx on test(NO);
Index created.
Regards
N.Venkatagiri -
How to rename a column name in a table? Thanks first!
I tried to drop a column age from table student by writing the
following in the sql plus environment as :
SQL> alter table student drop column age ;
but I found the following error
ORA-00905: 缺少关键字 (Lack of Key word)
I have oracle enterprise edition 8.0.5 installed at windows 2000
thank you
And I want to know how to rename a column name in a table?
thanksIn Oracle 8i, your syntax would have worked. However, if I
recall correctly, in Oracle 8.0, you can't rename or drop a
column directly. One way to get around that problem is to
create another table based on a select statement from your
original table, providing the new column name as an alias if you
want to change the column name, or omitting that column from the
select statement if you just want to drop it. Then drop the
original table. Then re-create the original table based on a
select statement from the other table. Then you can drop the
other table. Here is an example:
CREATE TABLE temporary_table_name
AS
SELECT age AS new_column_name,
other_columns
FROM student
DROP TABLE student
CREATE TABLE student
AS
SELECT *
FROM temporary_table_name
DROP TABLE temporary_table_name
Something that you need to consider before doing this is
dependencies. You need to make a list of all your dependecies
before you do this, so that you can re-create them afterwards.
If there are a lot of them, it might be worthwhile to do
something else, like creating a view with an alias for the
column or just providing an alias in a select. It depends on
what you need the different column name for. -
Can we use WHO columns in Business Logic implementation
Hi,
Can we use WHO columns for business logic implementation..?
From one table I need to pick up the latest record. I have a ActionDate column in the table which stores the date of the action.
But on the same day there can be multiple action records. ie Multiple records have same ActionDate.
Select * from action_table where action_date=(maximum action_date)
The above query will return more than 1 record.
Now can I use the Creation_Date which is a WHO column to identify the latest record..?
Will it introduce any issues if I use creation_date WHO column?
Usage of WHO column in application logic, Is it against the Standards ?
Thanks a lot.I guess you are talking about populating the value using the history column creation_dt from EO.
If so, you can use then. We are using them in all our applications to populate WHO columns of our table.
Infact as far as I know, even Oracle application uses them.
They generally populate the timestamp, so you may need to format them when doing date comparisons.
Hope that helps.
Amit -
Can we use formula column in lexical parameter in sql query ...
hi
can we use formula column in lexical parameter in sql query ...
as example
i want to give
select * from & c_table
forumula
function c_table
if :p_sort = 1 then
return 'dept'
else
return 'emp'
end;
c_table formula column
is this possible ...
i have such example in oracle apps reports
if i try in ordinary report usinf emp table it show error ..
how we can give formula column...
please help me in this regard...
Edited by: 797525 on Feb 20, 2012 9:31 PMthanks sir,
iam not exactly saying select * from &c_table but some thing that like columns in select stmt also will be populated in user_parameters ,there are lot of table select.......from mtl_demand md, mtl_system_items msi, mtl_txn_source_types mtst, mtl_item_locations loc &C_source_from &C_from_cat
&c_source_from and &c_from_cat formula column and there are defined at report level only ......
pl/sql code &c_source_from is
function C_source_fromFormula return VARCHAR2 is
begin
if :P_source_type_id = 2 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id = 3 then return(',GL_CODE_COMBINATIONS gl');
else if :P_source_type_id = 6 then return(',MTL_GENERIC_DISPOSITIONS mdsp');
else if :P_source_type_id = 5 then
if :C_source_where is null then
return NULL;
else
return(',WIP_ENTITIES wip');
end if;
else if :P_source_type_id = 8 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id is null then
return(',MTL_SALES_ORDERS mkts,
MTL_GENERIC_DISPOSITIONS mdsp,
GL_CODE_COMBINATIONS gl ');
else null;
end if; end if; end if; end if; end if; end if;
RETURN NULL; end;
this is forumula column i hope that you understand what iam saying
please help me in this regard....
thanking you... -
Can we use Dynamic SQL in Oracle Reports ?
Hi ,
Can we use Dynamic SQL in Oracle Reports ?
If yes please give some examples .
Thanx
sriniI believe the built-in package SRW.Do_Sql is what you are looking for
Example from the document:
/* Suppose you want to create a "table of contents" by getting the
** first character of a columns value, and page number on which its
** field fires to print. Assume that you want to put the "table of
contents"
** into a table named SHIP. You could write the following construct:
DECLARE
PAGE_NO NUMBER;
PAGE_FOR INDEX NUMBER;
SORT_CHAR CHAR(1);
CMD_LINE CHAR(200);
BEGIN
SORT_CHAR := :SORT_NAME ;
IF :CALLED = Y THEN
SRW.GET_PAGE_NUM(PAGE_FOR_INDEX);
SRW.USER_EXIT(RWECOP PAGE_FOR_INDEX
P_START_PAGENO);
SRW.MESSAGE(2,TO_CHAR(:P_START_PAGENO));
END IF;
SRW.GET_PAGE_NUM(PAGE_NO);
CMD_LINE := INSERT INTO SHIP VALUES
(||SORT_CHAR||,||TO_CHAR(PAGE_NO)||);
SRW.MESSAGE(2,CMD_LINE);
SRW.DO_SQL(CMD_LINE);
COMMIT;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
NULL;
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(1,FAILED TO INSERT ROW INTO SHIP TABLE);
WHEN OTHERS THEN
COMMIT;
END; -
i cannot rename a column in a table;
i tried so many sql statements but with no results;
i use the following:
alter table tablename rename column old_column to new_columnname;In other case you can create a view on that table to rename the columns like
SQL> select empno, ename, job from scott.emp;
EMPNO ENAME JOB
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES MANAGER
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
7788 SCOTT ANALYST
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK
EMPNO ENAME JOB
7900 JAMES CLERK
7902 FORD ANALYST
7934 MILLER CLERK
14 rows selected.
SQL> create or replace view emp_vw as select empno as emp_no, Ename as Employee_Name, job from scott.emp;
View created.
SQL> select * from emp_vw;
EMP_NO EMPLOYEE_NAME JOB
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES MANAGER
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
7788 SCOTT ANALYST
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK
EMP_NO EMPLOYEE_NAME JOB
7900 JAMES CLERK
7902 FORD ANALYST
7934 MILLER CLERK
14 rows selected.
SQL> -
How can i hide a column using personalization?
Hi,
Please help me how can i hide a one column in oracle forms using personalization?
ThanksHi,
When you login to My Oracle Support website, enter "458786.1" or "468657.1" in the search box, and you should get the documents.
Or, use the direct links below to access those documents.
How To Do Forms Personalization (Doc ID 468657.1)
https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=468657.1
RCVRCERC: When Using Personalization to Remove a Column Receive Error FRM-41017: Cannot set UPDATE ALLOWED (Doc ID 458786.1)
https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=458786.1
Regards,
Hussein
Maybe you are looking for
-
Apple TV, 2 iphones (4s), 1 ipad - which setup is best?
I am an apple noob and need help setting up all our devices. My husband currently has an iphone 4s, but he has not bought much iTunes content yet, while we wait to try and see the best way to set all our devices up for synching, etc. I just bought
-
Urxvt just did a little mess-up. When I press backspace, the blinker goes forwards and the character stays (it just looks like that, it is deleted). It's kinda getting annoying. Any way to fix it?
-
Can anyone identify this part?
Very early on after getting my Mac I noticed a creaking noise, it didn't bother me and thought nothing of it. A couple of months ago I decided to clean it out as it was getting rather sluggish and to be honest that with a declutter, I have seen an im
-
There is a wrong in Oracle Application Express Advanced Tutorials
In the charpter 6 of Oracle Application Express Advanced Tutorials Release 3.2, I tried the " create multi value check boxed to filter content" (6-8 page) exercise, but I couldn't find the search field (P1_REPORT_SEARCH) under the page definition ite
-
iOS 7.0.3 failed verification because you are no longer connected to the internet. I am connect via wifi and all working correctly. I also have over 7 gb left available. Any reason why I cant update? Thanks T