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.
jing
There 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
Similar Messages
-
Hi,
I am using OCCI to interact with DB through code, which means I am writing a vc++ file to interact with Data Base and execute the Stored Procedure which I am calling from the C++ Code. And also displaying the output of the Stored Procedures to the Front End. I am succeeded in this, but now I should be able to display the Column names of the output to Front End. Can any one help me on this.
Example:
Sno | Sname
------- |-------------
1 ABC
2 DEF
I am getting (1,ABC) and (2,DEF) as the output of the Stored Procedure but I need the Column names also to display. How to get them.
Thanks in Advance..:)Look at Re: exporting csv via pl/sql - select statement?
It has an example how to extract the column name from a cursor. You have to check, whether you can use DBMS_SQL.DESCRIBE_COLUMNS
Your procedure might need another out parameter, that returns the column names , e.g. as comma separated list or as varray. -
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. -
How to use the column names generated from Dynamic SQL
Hi,
I have a problem with Dynamic SQL.
I have written an SQL which will dynamically generate the Select statement with from and where clause in it.
But that select statement when executed will get me hundreds of rows and i want to insert each row separately into one more table.
For that i have used a ref cursor to open and insert the table.
In the select list the column names will also be as follows: COLUMN1, COLUMN2, COLUMN3,....COLUMNn
Please find below the sample code:
TYPE ref_csr IS REF CURSOR;
insert_csr ref_csr;
v_select VARCHAR2 (4000) := NULL;
v_table VARCHAR2 (4000) := NULL;
v_where VARCHAR2 (4000) := NULL;
v_ins_tab VARCHAR2 (4000) := NULL;
v_insert VARCHAR2 (4000) := NULL;
v_ins_query VARCHAR2 (4000) := NULL;
OPEN insert_csr FOR CASE
WHEN v_where IS NOT NULL
THEN 'SELECT '
|| v_select
|| ' FROM '
|| v_table
|| v_where
|| ';'
ELSE 'SELECT ' || v_select || ' FROM ' || v_table || ';'
END;
LOOP
v_ins_query :=
'INSERT INTO '
|| v_ins_tab
|| '('
|| v_insert
|| ') VALUES ('
|| How to fetch the column names here
|| ');';
EXECUTE IMMEDIATE v_ins_query;
END LOOP;
Please help me out with the above problem.
Edited by: kumar0828 on Feb 7, 2013 10:40 PM
Edited by: kumar0828 on Feb 7, 2013 10:42 PM>
I Built the statement as required but i need the column list because the first column value of each row should be inserted into one more table.
So i was asking how to fetch the column list in a ref cursor so that value can be inserted in one more table.
>
Then add a RETURNING INTO clause to the query to have Oracle return the first column values into a collection.
See the PL/SQL Language doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/returninginto_clause.htm#sthref2307 -
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 voting disk name in oracle clusterware 11gr2
Hi:
I need change the name of voting disk at os level, original name is /dev/rhdisk20, I need rename to /dev/asmocr_vote1 (unix AIX), the voting disk is locate in ASM diskgroup +OCR.
Initial voting disk was: /dev/rhdisk20 in diskgroup +OCR
#(root) /oracle/GRID/11203/bin->./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
1. ONLINE a2e6bb7e57044fcabf0d97f40357da18 (/dev/rhdisk20) [OCR]
I createt a new alias disk name:
#mknod /dev/asmocr_vote01 c 18 10
# /dev->ls -lrt|grep "18, 10"
brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:57 rhdisk20 --> Old name
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:59 asmocr_vote01 ---> alias to old name, the new name.
After change votingn disk unix name, the cluster doesn't start, voting disk is not found by CRSSD.
-STEPS to start clusterware after changing the OS voting disk name are:
1- stop al nodes:
#crsctl stop crs -f (every node)
Work only in one node (node1, +ASM1 instance):
2- Change asm_diskstring in init+ASM1.ora:
asm_diskstring = /dev/asm*
3- change disk unix permiss:
# /dev->ls -lrt|grep "18, 10"
brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
crw-rw---- 1 root system 18, 10 Sep 6 16:59 asmocr_vote01
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 17:37 rhdisk20
#(root) /dev->chown oracle:asmadmin asmocr_vote01
#(root) /dev->chown root:system rhdisk20
#(root) /dev->ls -lrt|grep "18, 10"
brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:59 asmocr_vote01 --> new name only have oracle:oinstall
crw-rw---- 1 root system 18, 10 Sep 6 17:37 rhdisk20
4-start node in exclusive mode:
# (root) /oracle/GRID/11203/bin->./crsctl start crs -excl
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.mdnsd' on 'orarac3intg'
CRS-2676: Start of 'ora.mdnsd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'orarac3intg'
CRS-2676: Start of 'ora.gpnpd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'orarac3intg'
CRS-2672: Attempting to start 'ora.gipcd' on 'orarac3intg'
CRS-2676: Start of 'ora.cssdmonitor' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.gipcd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'orarac3intg'
CRS-2672: Attempting to start 'ora.diskmon' on 'orarac3intg'
CRS-2676: Start of 'ora.diskmon' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.cssd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'orarac3intg'
CRS-2672: Attempting to start 'ora.drivers.acfs' on 'orarac3intg'
CRS-2679: Attempting to clean 'ora.cluster_interconnect.haip' on 'orarac3intg'
CRS-2681: Clean of 'ora.cluster_interconnect.haip' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'orarac3intg'
CRS-2676: Start of 'ora.ctssd' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.drivers.acfs' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'orarac3intg'
CRS-2676: Start of 'ora.asm' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'orarac3intg'
CRS-2676: Start of 'ora.crsd' on 'orarac3intg' succeeded
5-check votedisk:
# (root) /oracle/GRID/11203/bin->./crsctl query css votedisk
Located 0 voting disk(s).
--> NO VOTING DISK found
6- mount diskgroup of voting disk (+OCR in this case) in +ASM1 instance:
SQL> ALTER DISKGROUP OCR mount;
7-add votedisk belongs diskgroup +OCR:
# (root) /oracle/GRID/11203/bin->./crsctl replace votedisk +OCR
Successful addition of voting disk 86d8b12b1c294f5ebfa66f7f482f41ec.
Successfully replaced voting disk group with +OCR.
CRS-4266: Voting file(s) successfully replaced
#(root) /oracle/GRID/11203/bin->./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
1. ONLINE 86d8b12b1c294f5ebfa66f7f482f41ec (/dev/asmocr_vote01) [OCR]
Located 1 voting disk(s).
8-stop node:
#(root) /oracle/GRID/11203/bin->./crsctl stop crs –f
8-start node:
#(root) /oracle/GRID/11203/bin->./crsctl start crs
10- check:
# (root) /oracle/GRID/11203/bin->./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
1. ONLINE 86d8b12b1c294f5ebfa66f7f482f41ec (/dev/asmocr_vote01) [OCR]
Vicente.
HP.
Edited by: 957649 on 07-sep-2012 13:11There 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 -
How to get the column names of the table into the Dashboard prompt
how to get the column names of the table into the Dashboard prompt
Thanks & Regards
Kishore PHey john,
My requirement is as follows
I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
My pivot table looks like this
COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
---------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK REGION DOLLARS DOLLARS DOLLARS DOLLARS
1 CENTRAL 10 20 30 40
2 SOUTHERN 10 30 30 70
3 EASTERN 20 20 20 60
4 WESTERN 10 20 30 40
When i select the District in column selector
Report has to display rank based on Total Sales by District. i.e
------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK DISTRICT DOLLARS DOLLARS DOLLARS DOLLARS
for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
do you have any solution for this?
http://rapidshare.com/files/402337112/Presentation1.jpg.html
Thanks & Regards
Edited by: Kishore P on Jun 24, 2010 7:24 PM
Edited by: Kishore P on Jun 24, 2010 7:28 PM -
How to find the column name and table name with a value
Hi All
How to find the column name and table name with "Value".
For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
Any help is highly appricatable
Thanks & Regards
Srikkanth.M2 solutions by Michaels (the latter is 11g upwards only)...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
How to Rename the technical name and description of an infocube?
Hi,
How to Rename the technical name and description of an infocube?
Thanx in advance,
Ravi.Ravi,
You cant change the Technical name of the cube but you can change the description of the Cube. If you want to have a Cube with the same properties and with different Techname and Description better you do copy from the base cube and rename as per your requirement.
Regards,
Gattu. -
Rename the column names in Embedded BPM Worklist
Hi,
I have embedded the BPM worklist in ADF Page.
My requirement is to rename the column names in the task list.
For example, the column 'state' should be renamed as 'Status' and the column 'from User' should be renamed as 'From'.
Is there any possibility to achieve this? Please let me know.
Regards,
TamilSee if the solution in this post helps -
Re: Customize workspaceAlso , its better to post these questions in the BPM forum -
Business Process Management SuiteEdited by: Sudipto Desmukh on Apr 27, 2012 8:57 AM -
How to rename the column field names
hello guys,
i am retrieving my field names from the database and i view it thru HTML.
When i view it,the column names are those which are given while creating tables.
Ex..
fname,lname,phno,
i want it as First Name,Last Name,Phone Number etc ...<%
try {
stmt = con.createStatement();
sql="SELECT fname, lname, gender, email,phnum,sartweblink, sartaddress1, sartaddress2,sartcounty, country,sartpostcode,dob FROM Artist where artistid='" + sartid + "'";
rs=stmt.executeQuery(sql);
rsmd=rs.getMetaData();
int colcount=rsmd.getColumnCount();
for(i=1;i<=colcount;i++)
%>
<tr><td width="200"><FONT face=verdana size=2><%= rsmd.getColumnName(i)%>
<%
%> </FONT>
<font face=verdana size=2>
<% while(rs.next())
fname=rs.getString("fname");
lname=rs.getString("lname");
gender=rs.getString("gender");
email=rs.getString("email");
phnum=rs.getInt("phnum");
weblink=rs.getString("sartweblink");
address1=rs.getString("sartaddress1");
address2=rs.getString("sartaddress2");
county=rs.getString("sartcounty");
country=rs.getString("country");
postcode=rs.getString("sartpostcode");
dob=rs.getString("dob");
%>i make use of metadata..
can anyone tell me how to do this..
thanks in advancewhy not use alias:
your query is
SELECT fname, lname, gender, email
and will be:
SELECT fname FIRSTNAME, lname LASTNAME, gender GENDER, email EMAILADDRESS -
Reading csv file how to get the Column name
Hi,
I am trying to read a csv file and then save the data to Oracle.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:odbc:;Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=.;Extensions=csv,txn");
Statement stmt = c.createStatement();
ResultSet rs = stmt.executeQuery("select * from filename.csv");
while(rs.next())
System.out.println(rs.getString("Num"));
My csv file looks like this:
"CHAM-23","COMPANY NAME","Test","12",20031213,15,16
Number,Environ,Envel,Date,Time
"1","2",3,"4",5
"6","7",8,"9",9
Now is there anyway using the above code I start processing the file from the second row that holds the names of the columns and skip the first row. And also can I get the name of the column using ResultSet something like:
if columnName.equals("Number")
Because I may have a csv file that could have more columns:
"CHAM-24","COMPANY NAME","Test","12",20031213,16,76
Number,Environ,Envel,Date,Time,Total,Count
"1","2","3","4","5",3,9
"6","7","8","9",9",,2
So I want to get the column name and then based on that column I do some other processing.
Once I read the value of each row I want to save the data to an Oracle Table. How do I connect to Oracle from my Application. As the database is on the server. Any help is really appreciated. ThanksThe only thing I could think of (and this is a cluj) would be to attempt to parse the first element of each row as a number. If it fails, you do not have a column name row. You are counting on the fact that you will never have a column name that is a number in the first position.
However, I agree that not always placing the headers in the same location is asking for trouble. If you have control over the file, format it how you want. If someone else has control over the file, find out why they are doing it that way. Maybe there is a "magic" number in the first row telling you where to jump.
Also, I would not use ODBC to simply parse a CSV file. If the file is formatted identically to Microsoft's format (headers in first row, all subsequent rows have same number of columns), then it's fine to take a shortcut and not write your own parser. But if the file is not adhering to that format, don't both using the M$ ODBC driver.
- Saish
"My karma ran over your dogma." - Anon -
How do i change column names in oracle model?
Hi,
I am performing a migration from SQL SERVER 7.0 to Oracle 8.1.7.
I have tables that have tables in SQL SERVER with column names
that are "TYPE" and "BODY".(These are generally TEXT datatype
columns that need to be converted to LONG in Oracle.We need
these to be LONG datatype in Oracle because of an application we
are using. LOBS cannot be allowed)
The migration utility renames these columns as "TYPE_"
and "BODY_" and creates the tables in the Oracle Database.
I need to have these tables in Oracle with the same column names
viz. "TYPE" and "BODY" .
I can create new tables in Oracle with the column names "TYPE"
and "BODY" but cannot change the options in the migration
workbench for this.
Is there any option or any workaround I can use to change the
column names in the Oracle model?or set the options so that the
Oracle model tables donot modify these column names?
Thanks in advance for all the help.
MandarThe words 'TYPE' and 'BODY' are reserved Oracle words. Its best
to go along with what the workbench has suggested. If you have
to keep the original names of the columns trying wrapping double
quotes around them after the data migration is complete. This
may cause a case sensitivity or referential problem later on
though. -
How to change the column names in display
Hi,
I want to change the columns names and give the display names as more User friendly..
How should I acheive this in WebI reports.
Regards,
BOBHi,
the columns names are normal text fields. Just selecdt to edit your report , go to the editor panel and select the column header you want to modify. You can enter the text you want to display
Regards,
Stratos -
How to put the column name and variable value in the alert message.
Dear,
how can i put the column name and variable value in the alert message text. i want to display an alert which tell the user about the empty textboxes. that these textboxes must be filled.
Regards:
Muhammad Nadeem
CHIMERA PVT. LTD.
LAHORE
[email protected]Hello,
The name of the item that fires the current trigger is stored in the :SYSTEM.TRIGGER_ITEM system variable.
The value contained in this item can be retrived with the Name_In() built-in
value := Name_In( 'SYSTEM.TRIGGER_ITEM') ;
LC$Msg := 'The item ' || :SYSTEM.TRIGGER_ITEM || ' must be entered' ;
Set_Alert_Property('my_alert_box', ALERT_MESSAGE_TEXT, LC$Msg ) ;
Ok := Show_Alert( 'my_alert_box' ) ;
...Francois
Maybe you are looking for
-
AP Balance report containing available prepayments
Dear experts, Last week I came to the conclusion that the Open Account AP Balance Listing would never contain available prepayments. Oracle Support advised to compare the Open Account AP Balance Listing with a prepayments report but this is not an ef
-
Not Able to use Mail.app
Hello to everyone. After been browsing this site and google for about 2 days I have decided to post this message and see if someone can help me fix the problem I am having. My mail.app has been not working for me ever since I got my new mac and migra
-
Can you share Itunes purchases with family members without them using your Apple ID?
-
Dear Gurus,how to maintain business area for a line item?
Hi Gurus, Thanks for all gurus for your knowledge sharing,everyday i get new things from you gurus, right now i got one problem, while releasing the invoice i got the error as "Business Area not entered in the line item 000000012" where i should
-
Hi, Basically, I receive a hash of a pk and would like to compare that hash value a pk in SQL Server. There is no stored hash value in that table. So I have to use CF function Compare to compare while looping the whole table. As a result, it's sl