Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Renaming Columns 8i
A copy of this was sent to richl796_at_my-deja.com
(if that email address didn't require changing)
On Fri, 30 Jul 1999 14:35:26 GMT, you wrote:
>I'm trying to rename a column in a table and
>can't find the syntax for it in the
>documentation. I'm running 8i so I know this is
>new functionality that has been added for this
>release. I'm trying to move a long datatype from
>one table to another using the sql*plus copy
>command but the column names have to be the same
>on both tables. So I'll have to move the data
>then rename unless there is an easier way I don't
>know about.
>
there is no rename column and you don't need it.
look at the sql*plus copy command. It will do it. You need a sql*net connect string that loops back to your local database (not a dblink, a sqlplus connect string, you need to be able to "sqlplus scott/tiger_at_yourdatabase"...
For example, I just:
create table foo
( The_Whole_View varchar2(65),
TextLength number, TheText Long )
which is a table, sort of like all_views (which has a long named TEXT, not theText)... Then I:
SQL> copy from tkyte/tkyte_at_aria insert foo (the_whole_view, textlength, thetext ) using select owner||'.'||view_name, text_length, text from all_views;
So the sqlplus command transformed the table for me (the columns are not the same). Also, I could have used a where clause to pick off just some rows.
You'll want to set
set arraysize N -- amount of rows the copy command will copy with each fetch set long N -- size of your longest long set copycommit M -- number of fetches to do before commit (N*M rows!!)
in plus before doing this. see the manual for all the options....
>Thanks,
>
>-Rich
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Jul 30 1999 - 12:37:37 CDT