How to move a column within a table?
Hi All!
Is it possible in Oracle 9i to move a column within a table? For instance, I have a table
ID1 ID2 ID3 SRC_ID1 SRC_ID2 SRC_ID3
and I want to add one more column ID4. So, I can do it like this:
ALTER TABLE MY_TABLE
ADD ID4 NUMBER(18);
In this case, the column will be added to end of the table but I want to move the column on the position after ID3. So, my question is, is it possible to move a column within a table? And if yes, how I can do it?.
Any help will be appreciate.
With best regards,
Andrej Litowka.
Hi,
Actually speaking it makes no difference where a column is placed in the table. The select clause is the one that decides on how to display the data. But still if you want to store it next to a particular column then there are 2 options...
1. Rename <tname> to <tname_1>;
Create view <tname> as select <cols> from <tname_1>;
The above option is useful in case of selects. In case of DMLs it will have to do a little more work by going and firing the same on the actual underlying table.
2. Rename <tname> to <tname_1>;
Create table <tname> (<new col order with the new col>);
Insert into <tname> (select <col order> from <tname_1>);
This option seems to be better than the first one.
Hope this helps you.
Regards,
DJ
Similar Messages
-
How to Delete a Column in Internal Table
Hi All,
Does any one know ,How to Delete a Column in Internal Table?Hi,
For deleting the column in the internal table, you have to eliminate the field which you want to delete.
loop at itab into wa.
move corresponding wa to wa1.
append wa1 to itab1.
clear wa1.
clear wa.
endloop.
wa1 is the workarea without the field which you want to delete.
itab1 is the internal table which consists of the deleted column. -
How to move data from a staging table to three entity tables #2
Environment: SQL Server 2008 R2
I have a few questions:
How would I prevent duplicate records, when/ IF SSIS is executed many times?
How would I know that all huge volume of data being loaded in the entity tables?
In reference to "how to move data from a staging table to three entity tables ", since I am loading large volume of data, while using lookup transformation:
which of the merge components is best suited.
How to configure merge component correctly. (screen shot is preferred)
Please refer to the following link
http://social.msdn.microsoft.com/Forums/en-US/5f2128c8-3ddd-4455-9076-05fa1902a62a/how-to-move-data-from-a-staging-table-to-three-entity-tables?forum=sqlintegrationservicesYou can use RowCount transformation in the path where you want to capture record details. Then inside rowcount transformation pass a integer variable to get count value inside
the event handler can be configured as below
Inside Execute SQL task add INSERT statement to add rowcount to your audit table
Can you also show me how to Check against destination table using key columns inside a lookup task and insert only non
matched records (No Match output)
This is explained clearly in below link which Arthur posted
http://www.sqlis.com/sqlis/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx
For large data I would prefer doing this in T-SQL. So what you could do is dump data to staging table and then apply
T-SQL MERGE between tables (or even a combination of INSERT/UPDATE statements)
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to sum the column in a table seperated by sign.
How to sum the column in a table separate by sign.
For Example:
A B
10 MOHAN
-15 KUMAR
-25 MARCH
50 MAYSELECT SUM(CASE SIGN(A) WHEN 1 THEN A ELSE NULL END) SUM_POSTIIVE,
SUM(CASE SIGN(A) WHEN -1 THEN A ELSE NULL END) SUM_NEGATIIVE
FROM tbl
/SY. -
How to delete a column from the table control in module pool?
Hi,
can any one please tell How to delete a column from the table control in module pool?
thanks in advance
warm regards
HareeshKumar Nhi hareesh,
I think it is better to hide it.
How to hide: You can check this link
Dynamic Hide column in table control -
How to move the data of a table from sqlplus to XML file
Hi,
Could you pls guide me how to move the data of a table from sqlplus to XML file.
i want to do it from sqlplus rather than toad.pls help
ThanksOh..I'm in 9i.
Try this out..and let me know.
DECLARE
CTX DBMS_XMLGEN.CTXHANDLE ;
XML CLOB ;
F UTL_FILE.FILE_TYPE;
XMLC VARCHAR2(32767);
BEGIN
CTX := DBMS_XMLGEN.NEWCONTEXT('SELECT * FROM department1 ') ;
XML := DBMS_XMLGEN.GETXML(CTX) ;
XMLC:=TO_CHAR(XML);
SHOW_ENVELOPE(XMLC);
F := UTL_FILE.FOPEN('ATTACH_FILES','DEPT.XML', 'W');
UTL_FILE.PUT_LINE(F,XML);
UTL_FILE.FCLOSE(F);
END ;
Good luck!!!
Bhagat
null -
How to move data from 2 internal table to 1 internal table
Can any body send me code that how to move data from 2 internal table into one internal table.
Moderator message : Read ABAP documentation. Thread locked.
Edited by: Vinod Kumar on Jun 13, 2011 11:45 AMHi Mohdarif92;
I don't know your full needs. But general method should be as below code.
Please check exam below code.
Best regards.
data : begin of gt_result.
... like mkpf-...
... like mkpf-...
... like mseg-...
... like mseg-...
end of gt_result
select *
into table gt_mkpf
from mkpf where ...
select *
into table mseg
from mseg where ...
loop at gt_mkpf.
loop at gt_mseg where ... = mkpf-...
move-corresponding gt_mkpf to gt_result.
move-corresponding gt_mseg to gt_result.
append gt_result
endloop.
endloop. -
How can i set tab within a table?
how can i set tab within a table?
With a live insertion point in a cell, type Alt/Opt+TAB, or, right-click and choose > Insert Special Character > Other > Tab, or, press Ctrl/Cmd+Shift+T to bring up the Tabs panel.
-
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 can I select columns from a table EMP, using Select statement?.
Hi Friends,
How can I select columns from a table EMP?.
I want to select columns of EMP table, using select statement.
Please reply me urgently.
ShahzadSomething like this:
scott@DBA> select empno,ename,job from 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
7900 JAMES CLERK
7902 FORD ANALYST
7934 MILLER CLERK
14 rows selected.Check the documentation:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#sthref9697
Message was edited by:
Delfino Nunez -
Need a document about how to move the fact and dimension table's to different server's
Hello Experts,
I need a detailed doc on how to move the fact and dimension tables to different server's.Please help me out from this
Thanks in advance....You still haven't told anyone what products besides Essbase you are using, without which this is an impossible question to answer.
https://forums.oracle.com/thread/2585515
https://forums.oracle.com/thread/2585171
Are you connecting to these tables from Essbase with a load rule / ODBC? Using Studio? Using Integration Services? Any Drill-Through reporting set up?
This may sound harsh, but if you truly don't know how to answer any of these questions you should probably not be anywhere near this task... -
How do I Freeze Columns in HTML Tables
How do I Freeze Columns in HTML Tables when scroll vertically as well as horizontally? (header and some columns on LHS). I generate a JSP report which got more than 1000 rows. Please advise. Thanks.
Gooooooooooooooooogle searched "Freeze Columns in HTML Tables"
So many solutions available !!!!!
see the 1st link
http://web.tampabay.rr.com/bmerkey/examples/locked-column-csv.html -
How to move lob segment in partitioned table
On my Oracle 11.2, I have a partitioned table wich I would like to move to another tablespace
After invoking script, there's still unmoved lob segment withing table
CREATE TABLE BONGO.AAA_3
ID NUMBER,
DATUM DATE,
OBJEKAT BLOB
TABLESPACE BONGODATA_HUGE
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
LOGGING
PARTITION BY RANGE (DATUM)
PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE BONGODATA_HUGE
LOB (OBJEKAT) STORE AS
( TABLESPACE BONGODATA
ENABLE STORAGE IN ROW
CHUNK 8192
RETENTION
NOCACHE
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;how to move this lob segment in partitioned table?
or, is there some package for data move within tablespaces?
regardstnx...
now, I have another problem..
I have a nested table within partitioned table, and I'm trying to move it to another tablespace.
I tried to move child table (of nested type colum), but I didn't succedeed... -
How to read BLOB column from a table in SQL or PL/SQL
I have table which is having one BLOB data type column . Ihave inserted few rows in that table . Now i want to see wheather BLOB column has been inserted properly or not . How to read that column through SQL or PL/SQL.
Can anyone help me to do this.You can only manipulate LOBs in PL/SQL because you have to use the DBMS_LOB package.
Check out the Oracle Developer's Guide -
How to keep view column in a table
Hi,
I have two table and one view(I have same data in any other schema so I don't want to keep same data in both schema) I want to make primary key in first table based on one column from 2nd table and one column from view, but it's not looking possible if it's possible so how, if it is not there is any other solution.
Thanks and Regards, Khawar.Hello all,
Thanks for reply following are view and table desc.
SQL> desc emp_dept_vw
Name Null? Type
EMP_ID NOT NULL VARCHAR2(10)
F_NAME NOT NULL VARCHAR2(50)
M_NAME VARCHAR2(15)
L_NAME VARCHAR2(15)
DESIGNATION VARCHAR2(40)
JOIN_DATE DATE
REGION_ID VARCHAR2(15)
DEPT_ID VARCHAR2(30)
FAMILY_NAME VARCHAR2(20)
SEX CHAR(1)
LOCATION VARCHAR2(20)
DEPT_NAME VARCHAR2(30)
SECTION VARCHAR2(40)
SQL> desc pc_user
Name Null? Type
PC_SERIAL NOT NULL VARCHAR2(20)
PRINTER_SERIAL VARCHAR2(20)
SQL> desc pc
Name Null? Type
PC_SERIAL NOT NULL VARCHAR2(20)
BRAND NOT NULL VARCHAR2(50)
HDD_MODEL_NO CHAR(18)
MEM_CODE VARCHAR2(20)
NIC_CODE VARCHAR2(20)
PROCESSOR_ID VARCHAR2(20)
MONITOR_ID VARCHAR2(20)
MOTHER_BOARD VARCHAR2(30)
SUPP_ID VARCHAR2(20)
FDD VARCHAR2(20)
PRICE NOT NULL NUMBER
WARRANTY NOT NULL VARCHAR2(20)
DELIVERY_DATE NOT NULL DATE
REMARKS NOT NULL VARCHAR2(200)
I want to use EMP_ID from EMP_DEPT_VW view as a part of composite key in PC_USER table.
Many Thanks .
Khawar
Maybe you are looking for
-
Install windows8 on macbook pro
Can you tell me how to install windows 8 on my macbook pro? Can you guide me?
-
Mac Book Pro won't wake up from "sleep mode"
After putting laptop to sleep last night, I wake up to a computer in "sleep mode" The screen is black and not responding, the sleep indicator is lit steadily (not slowly blinking as it normally does in sleep mode) but the computer does not seem to re
-
SuperDrive not reading any DVDs or CDs
My Matshita UJ-857E (ZA0E) SuperDrive died on me.... It now does not accept any CDs or DVDs and instead just spits them back out a few seconds after putting them in the slot. Running Leopard 10.5.5 on MBP (Aug. 2007)... I really need to use the drive
-
Won't recognize my CD burner ...
I was trying to burn a CD from windows media player and just today, after installing Itunes, etc., my computer doesn't recognize that I even have a burner ... Man, this Ipod/tunes stuff has been difficult to use so far ... Any help for me please ?? D
-
How a mobile phone access my MIDlet
Hi all I have question, I create a MIDlet that can communicate to a servlet and this servlet returns some values(taken from the database) to the MIDlet.Now my servlet is in the local Machine and I test the MIDlet using the WirelessToolKit. But In Rea