Move data from Non Partitioned Table to Partitioned Table
Hi Friends,
I am using Oracle 11.2.0.1 DB
Please let me know how can i copy /move the data from Non -Partitioned Oracle table to the currently created Partiotioned table.
Regards,
DB
839396 wrote:
Hi All,
Created Partitioned table but unable to copy the data from Non Partitioned table:
SQL> select * from sales;
SNO YEAR NAME
1 01-JAN-11 jan2011
1 01-FEB-11 feb2011
1 01-JAN-12 jan2012
1 01-FEB-12 feb2012
1 01-JAN-13 jan2013
1 01-FEB-13 feb2013into which partition should row immediately above ("01-FEB-13") be deposited?
[oracle@localhost ~]$ oerr ora 14400
14400, 00000, "inserted partition key does not map to any partition"
// *Cause: An attempt was made to insert a record into, a Range or Composite
// Range object, with a concatenated partition key that is beyond
// the concatenated partition bound list of the last partition -OR-
// An attempt was made to insert a record into a List object with
// a partition key that did not match the literal values specified
// for any of the partitions.
// *Action: Do not insert the key. Or, add a partition capable of accepting
// the key, Or add values matching the key to a partition specification>
6 rows selected.
>
SQL>
SQL> create table sales_part(sno number(3),year date,name varchar2(10))
2 partition by range(year)
3 (
4 partition p11 values less than (TO_DATE('01/JAN/2012','DD/MON/YYYY')),
5 partition p12 values less than (TO_DATE('01/JAN/2013','DD/MON/YYYY'))
6 );
Table created.
SQL> SELECT table_name,partition_name, num_rows FROM user_tab_partitions;
TABLE_NAME PARTITION_NAME NUM_ROWS
SALES_PART P11
SALES_PART P12
UNPAR_TABLE UNPAR_TABLE_12 776000
UNPAR_TABLE UNPAR_TABLE_15 5000
UNPAR_TABLE UNPAR_TABLE_MX 220000
SQL>
SQL> insert into sales_part select * from sales;
insert into sales_part select * from sales
ERROR at line 1:
ORA-14400: inserted partition key does not map to any partition
Regards,
DB
Similar Messages
-
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 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. -
Want to move data from 1 internal table to other?
Hi,
i have values in one internal table like in 1 st column 13 value..in second column first 13 value blank &
from 14 value starts.....so i want such internal table in another internal table having no blank values ....means in 2nd column value starts from 1st no.
Thanks,
Sagarshow an example how is ur data is currently and how shud it look.
are u trying to say smthing like this.
col1 col2
1
2
3
4
. .5
. .6
. .7
like this?
and want second column to be shifted upwards unconditional;ly or sm matching shud be thr?
Edited by: kartik tarla on Dec 10, 2008 2:24 PM
Edited by: kartik tarla on Dec 10, 2008 2:25 PM -
How to move data from one DB (non-partitioned) to another DB (partitioned)
I have a huge database (2 TB) that is storing data in non-partitioned tables. I want to create another database to store the exact same data but in partitioned tables. How can I do this in the most efficient manner? Good old export and import should work but this would take ages.
Let me give you guys a full picture and see if you could help me.
The existing Unix server is running an Oracle 8i Database (datawarehouse) and I'm planning to create a new 10g database on a new Unix server. After which I will do parallel loading on both databases until I am ready to switch over to the new database. Most of the tables in the existing database is not partitioned and I need it to be partitioned on the new database. My database is around 2.4 TB and it is residing on a SAN (4.4 TB). I am planning only to have the 10g binary files on the new unix server, thus the new database would be on the SAN. Disk space availability is my most immediate concern as I would also have to set aside 600 GB on the SAN for another server.
Any suggestions on how can I do this best? -
Converting from non partitioned to partitioned table
Hi gurus,
I need to convert non partition to partition table. Most flexible way is using DBMS_REDEFINITION package for this.
i dont have access to execute this package , when i asked for EXECUTION permission for my dev
CLIENT rejected with suggestion that
" DBMS_REDEFINITION is a very slow migration method which has never been used before here for such migrations
so I would not recommend using it as it could trigger bugs and unexpected side effects"
is it true?
what will be alternate method i can go far?
Please suggest
SI don't think DBMS_REDEFINITION has bugs. However, you (and the client) need to be familiar with the steps involved.
Other than that, you'd have to build a partitioned table and insert data from the existing table. You can speed up the insert with direct path Parallel Insert.
You also need to build indexes on the new (partitioned) table. Define constraints if necessary. Execute grants to other schemas, if required.
Hemant K Chitale -
How to exp a specific partition data from a partitioned table
Thanks in advance.
Is is possible to export a specific partition data from a partitioned table? If so Please describe how with an example. Thank You.You would specify a partition with the table_name:partition_name syntax at the TABLES parameter.
See examples at
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#CEGCJABJ -
Archiving old data from a partitioned table
Hi,
While sifting through all the options for archiving the old data from a table which is also indexed, i came across a few methods which could be used:
1. Use a CTAS to create new tables on a different tablespace from the partitions on the exisitng table. Then swap these new tables with the data from the partitions, drop the partitions on the exisiting table (or truncate them although i m not sure which one is the recommended method),offline this tablespace and keep it archived. In case you require it in the future, again swap these partitions wih the data from the archived tables. I am not sure if i got the method correctly.
2. Keep an export of all the partitions which need to be archived and keep that .dmp file on a storage media. Once they are exported, truncate the corresponding partitions in the original table. If required in the future, import these partitions.
But i have one constraint on my Db which is I cannot create a new archive tablespace for holding the tables containing the partitioned data into then as I have only 1 tablespace allocated to my appplication on that DB as there are multiple apps residing on it together. Kindly suggest what option is the best suited for me now. Should I go with option 2?
Thanks in advance.Hi,
Thanks a bunch for all your replies. Yeah, I am planning to go ahead with the option 2. Below is the method I have decided upon. Kindly verify is my line of understanding is correct:
1. export the partition using the clause:
exp ID/passwd file=abc.dmp log=abc.log tables=schemaname.tablename:partition_name rows=yes indexes=yes
2. Then drop this partition on the original table using the statement:
ALTER TABLE tablename drop PARTITION partition_name UPDATE GLOBAL INDEXES;
If I now want to import this dump file into my original table again, I will first have to create this partition on my table using the statement:
3. ALTER TABLE tablename ADD PARTITION partition_name VALUES LESS THAN ( '<<>>' ) ;
4. Then import the data into that partition using:
imp ID/passwd FILE=abc.dmp log=xyz.log TABLES=schemaname.tablename:partition_name IGNORE=y
Now my query here is that this partitioned table has a global index associated with it. So once i create this partition and import the data into it, do i need to drop and recreate the global indexes on this table or is there any aother method to update the indexes. Kindly suggest.
Thanks again!! :) -
Import data from a partitioned table
I am trying to import data from another server database. I need only data from two partitions from a partitioned table in that database. I have to use IMPORT wizard.
The new server should also have the partitioned table with those two partitions data.I created the database on the destination server with a primary, log, FG1 and FG2 filegroups.
Next, created the partition function and scheme
create partition function pfOrders(int)
as range right
for values(34);
create partition scheme psOrders
as partition pfOrders
to (FG1,FG2)
go
Next, created the table on primary with primary key.
Next, used import wizard twice to import data related to partition_id 34 and 65.
The problem is the data is on primary filegroup. FG1 and FG2 does not have any data. -
Selecting data from Multiple Partitions in a single select stmt.
Hi all,
My Database is very large & my tables are partitioned.
My question is:
1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
(Note:I dont want to make use of Union concept, i want to do it in a single select statement)
For ex:
qry1.sql:
select empno from emp_trans partition (P012000)
This above query(qry1.sql) will work fine.
qry2.sql:
select empno from emp_trans partition (P012000,P022000)
The above query(qry2.sql) will return will return the following error:
ORA-00933: SQL command not properly ended
If anybody has any solution for this, pls mail me immediately.
Thanks in advance
bye
nullAll my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
Thaks for ur reply
Bye
null -
Unable to delete data from a partition
Hi,
Unable to delete data from a partition
I am using the command as:
ALTER TABLE TEST DROP PARTITION DATE_20090820090000
Its giving 0 rows deleted.Bu there are 200 rows for the Partition.
The partition is getting deleted but the data remains.
I want a command where the data in the partition also to be deleted along with partition.
Any help will be needful for meSQL> CREATE TABLE range_part (
prof_history_id NUMBER(10),
person_id NUMBER(10) NOT NULL,
organization_id NUMBER(10) NOT NULL,
record_date DATE NOT NULL)
PARTITION BY RANGE (record_date) (
PARTITION yr0 VALUES LESS THAN (TO_DATE('01-JAN-2007','DD-MON-YYYY'))
PARTITION yr7 VALUES LESS THAN (TO_DATE('01-JAN-2008','DD-MON-YYYY'))
PARTITION yr8 VALUES LESS THAN (TO_DATE('01-JAN-2009','DD-MON-YYYY'))
PARTITION yr9 VALUES LESS THAN (MAXVALUE) );
Table created.
SQL> INSERT INTO range_part VALUES (1, 1, 1, SYSDATE-720);
INSERT INTO range_part VALUES (2, 2, 2, SYSDATE-360);
INSERT INTO range_part VALUES (3, 3, 3, SYSDATE-180);
INSERT INTO range_part VALUES (4, 4, 4, SYSDATE);
1 row created.
SQL>
1 row created.
SQL>
1 row created.
SQL>
1 row created.
SQL>
SQL> commit;
Commit complete.
SQL> SELECT * FROM range_part;
PROF_HISTORY_ID PERSON_ID ORGANIZATION_ID RECORD_DATE
1 1 1 31-AUG-2007 05:53:22
2 2 2 25-AUG-2008 05:53:22
3 3 3 21-FEB-2009 05:53:22
4 4 4 20-AUG-2009 05:53:22
SQL> SELECT * FROM range_part PARTITION(yr7);
PROF_HISTORY_ID PERSON_ID ORGANIZATION_ID RECORD_DATE
1 1 1 31-AUG-2007 05:53:22
SQL> alter table range_part drop partition yr7;
Table altered.
SQL> SELECT * FROM range_part PARTITION(yr7);
SELECT * FROM range_part PARTITION(yr7)
ERROR at line 1:
ORA-02149: Specified partition does not exist
SQL> SELECT * FROM range_part;
PROF_HISTORY_ID PERSON_ID ORGANIZATION_ID RECORD_DATE
2 2 2 25-AUG-2008 05:53:22
3 3 3 21-FEB-2009 05:53:22
4 4 4 20-AUG-2009 05:53:22 -
Move data from one table to another table
Hi all,
I had a custom table called sales_data in that table there are columns like JAn,FEB,upto DEC including other columns so in each month there is some data total data is 23000 count but each month has has specific data like JAn-2500,FEB-2000 like that it has total 23000 records
My Requirement is i have to move data from one table to another table that too if i will pass jan only jan data should move like that feb,march,.....
in my table there is no month column i had get it from another table called gl_periods and by using cursor and case function i have written the code
well while when i am inserting data am passing year,month as parameters but 23000 data is moving it should get like that.
Please suggest me.its urgent
Thank YouHi hamid,
Please go through the below procedure.
CREATE OR REPLACE PROCEDURE APPS.copy_sales_to_forecast(p_fiscal_year varchar2,p_month number)
IS
CURSOR C1 IS select period_year,period_num,start_date,end_date from apps.gl_periods
where period_set_name='Accounting'
and period_year=p_fiscal_year
and period_num<=p_month;
type type1 is table of xxc_forecast_data%rowtype;
t1 type1;
BEGIN
FOR CREC IN C1 LOOP
BEGIN
DELETE FROM xxc_forecast2
where fiscal_year = crec.period_year
and attribute1='Copied From Sales to Forecast Table of Month '||crec.period_num;
END;
SELECT
product_category ,
product_sub_category ,
product_line ,
product_style ,
item_number ,
item_description ,
customer_name ,
customer_number ,
sales_channel ,
null ,
CASE
WHEN crec.period_num=1 THEN sales_amount_month1
ELSE 0
END Transaction_quantity_period1,
CASE
WHEN crec.period_num=1 THEN sales_cost_month1
ELSE 0
END item_cogs_period1,
CASE
WHEN crec.period_num=1 THEN sales_mtl_cost_month1
ELSE 0
END item_material_cogs_period1 ,
CASE
WHEN crec.period_num=1 THEN sales_mtl_ovhd_cost_month1
ELSE 0
END item_mtl_ovhd_cogs_period1,
CASE
WHEN crec.period_num=1 THEN sales_res_cost_month1
ELSE 0
END item_resource_cogs_period1,
CASE
WHEN crec.period_num=1 THEN sales_op_cost_month1
ELSE 0
END item_op_cogs_period1,
CASE
WHEN crec.period_num=1 THEN sales_ovhd_month1
ELSE 0
END item_ovhd_cogs_period1,
CASE
WHEN crec.period_num=1 THEN sales_units_month1
ELSE 0
END extended_amount_us_period1,
CASE
WHEN crec.period_num=2 THEN sales_amount_month2
ELSE 0
END Transaction_quantity_period2,
CASE
WHEN crec.period_num=2 THEN sales_mtl_cost_month2
ELSE 0
END item_material_cogs_period2,
CASE
WHEN crec.period_num=2 THEN sales_mtl_ovhd_cost_month2
ELSE 0
END item_mtl_ovhd_cogs_period2,
CASE
WHEN crec.period_num=2 THEN sales_res_cost_month2
ELSE 0
END item_resource_cogs_period2,
CASE
WHEN crec.period_num=2 THEN sales_op_cost_month2
ELSE 0
END item_op_cogs_period2,
CASE
WHEN crec.period_num=2 THEN sales_ovhd_month2
ELSE 0
END item_ovhd_cogs_period2,
CASE
WHEN crec.period_num=2 THEN sales_units_month2
ELSE 0
END extended_amount_us_period2,
CASE
WHEN crec.period_num=3 THEN sales_amount_month3
ELSE 0
END Transaction_quantity_period3,
CASE
WHEN crec.period_num=3 THEN sales_mtl_cost_month3
ELSE 0
END item_material_cogs_period3,
CASE
WHEN crec.period_num=3 THEN sales_mtl_ovhd_cost_month3
ELSE 0
END item_mtl_ovhd_cogs_period3,
CASE
WHEN crec.period_num=3 THEN sales_res_cost_month3
ELSE 0
END item_resource_cogs_period3,
CASE
WHEN crec.period_num=3 THEN sales_op_cost_month3
ELSE 0
END item_op_cogs_period3,
CASE
WHEN crec.period_num=3 THEN sales_ovhd_month3
ELSE 0
END item_ovhd_cogs_period3,
CASE
WHEN crec.period_num=3 THEN sales_units_month3
ELSE 0
END extended_amount_us_period3,
CASE
WHEN crec.period_num=4 THEN sales_amount_month4
ELSE 0
END Transaction_quantity_period4,
CASE
WHEN crec.period_num=4 THEN sales_mtl_cost_month4
ELSE 0
END item_material_cogs_period4,
CASE
WHEN crec.period_num=4 THEN sales_mtl_ovhd_cost_month4
ELSE 0
END item_mtl_ovhd_cogs_period4,
CASE
WHEN crec.period_num=4 THEN sales_res_cost_month4
ELSE 0
END item_resource_cogs_period4,
CASE
WHEN crec.period_num=4 THEN sales_op_cost_month4
ELSE 0
END item_op_cogs_period4,
CASE
WHEN crec.period_num=4 THEN sales_ovhd_month4
ELSE 0
END item_ovhd_cogs_period4,
CASE
WHEN crec.period_num=4 THEN sales_units_month4
ELSE 0
END extended_amount_us_period4,
CASE
WHEN crec.period_num=5 THEN sales_amount_month5
ELSE 0
END Transaction_quantity_period5,
CASE
WHEN crec.period_num=5 THEN sales_mtl_cost_month5
ELSE 0
END item_material_cogs_period5,
CASE
WHEN crec.period_num=5 THEN sales_mtl_ovhd_cost_month5
ELSE 0
END item_mtl_ovhd_cogs_period5,
CASE
WHEN crec.period_num=5 THEN sales_res_cost_month5
ELSE 0
END item_resource_cogs_period5,
CASE
WHEN crec.period_num=5 THEN sales_op_cost_month5
ELSE 0
END item_op_cogs_period5,
CASE
WHEN crec.period_num=5 THEN sales_ovhd_month5
ELSE 0
END item_ovhd_cogs_period5,
CASE
WHEN crec.period_num=5 THEN sales_units_month5
ELSE 0
END extended_amount_us_period5,
CASE
WHEN crec.period_num=6 THEN sales_amount_month6
ELSE 0
END Transaction_quantity_period6,
CASE
WHEN crec.period_num=6 THEN sales_mtl_cost_month6
ELSE 0
END item_material_cogs_period6,
CASE
WHEN crec.period_num=6 THEN sales_mtl_ovhd_cost_month6
ELSE 0
END item_mtl_ovhd_cogs_period6,
CASE
WHEN crec.period_num=6 THEN sales_res_cost_month6
ELSE 0
END item_resource_cogs_period6,
CASE
WHEN crec.period_num=6 THEN sales_op_cost_month6
ELSE 0
END item_op_cogs_period6,
CASE
WHEN crec.period_num=6 THEN sales_ovhd_month6
ELSE 0
END item_ovhd_cogs_period6,
CASE
WHEN crec.period_num=6 THEN sales_units_month6
ELSE 0
END extended_amount_us_period6,
CASE
WHEN crec.period_num=7 THEN sales_amount_month7
ELSE 0
END Transaction_quantity_period7,
CASE
WHEN crec.period_num=7 THEN sales_mtl_cost_month7
ELSE 0
END item_material_cogs_period7,
CASE
WHEN crec.period_num=7 THEN sales_mtl_ovhd_cost_month7
ELSE 0
END item_mtl_ovhd_cogs_period7,
CASE
WHEN crec.period_num=7 THEN sales_res_cost_month7
ELSE 0
END item_resource_cogs_period7,
CASE
WHEN crec.period_num=7 THEN sales_op_cost_month7
ELSE 0
END item_op_cogs_period7,
CASE
WHEN crec.period_num=7 THEN sales_ovhd_month7
ELSE 0
END item_ovhd_cogs_period7,
CASE
WHEN crec.period_num=7 THEN sales_units_month7
ELSE 0
END extended_amount_us_period7,
CASE
WHEN crec.period_num=8 THEN sales_amount_month8
ELSE 0
END Transaction_quantity_period8,
CASE
WHEN crec.period_num=8 THEN sales_mtl_cost_month8
ELSE 0
END item_material_cogs_period8,
CASE
WHEN crec.period_num=8 THEN sales_mtl_ovhd_cost_month8
ELSE 0
END item_mtl_ovhd_cogs_period8,
CASE
WHEN crec.period_num=8 THEN sales_res_cost_month8
ELSE 0
END item_resource_cogs_period7,
CASE
WHEN crec.period_num=8 THEN sales_op_cost_month8
ELSE 0
END item_op_cogs_period8,
CASE
WHEN crec.period_num=8 THEN sales_ovhd_month8
ELSE 0
END item_ovhd_cogs_period8,
CASE
WHEN crec.period_num=8 THEN sales_units_month8
ELSE 0
END extended_amount_us_period8,
CASE
WHEN crec.period_num=9 THEN sales_amount_month9
ELSE 0
END Transaction_quantity_period9,
CASE
WHEN crec.period_num=9 THEN sales_mtl_cost_month9
ELSE 0
END item_material_cogs_period9,
CASE
WHEN crec.period_num=9 THEN sales_mtl_ovhd_cost_month9
ELSE 0
END item_mtl_ovhd_cogs_period9,
CASE
WHEN crec.period_num=9 THEN sales_res_cost_month9
ELSE 0
END item_resource_cogs_period7,
CASE
WHEN crec.period_num=9 THEN sales_op_cost_month9
ELSE 0
END item_op_cogs_period9,
CASE
WHEN crec.period_num=9 THEN sales_ovhd_month9
ELSE 0
END item_ovhd_cogs_period9,
CASE
WHEN crec.period_num=9 THEN sales_units_month9
ELSE 0
END extended_amount_us_period9,
CASE
WHEN crec.period_num=10 THEN sales_amount_month10
ELSE 0
END Transaction_quantity_period10,
CASE
WHEN crec.period_num=10 THEN sales_mtl_cost_month10
ELSE 0
END item_material_cogs_period10,
CASE
WHEN crec.period_num=10 THEN sales_mtl_ovhd_cost_month10
ELSE 0
END item_mtl_ovhd_cogs_period10,
CASE
WHEN crec.period_num=10 THEN sales_res_cost_month10
ELSE 0
END item_resource_cogs_period10,
CASE
WHEN crec.period_num=10 THEN sales_op_cost_month10
ELSE 0
END item_op_cogs_period10,
CASE
WHEN crec.period_num=10 THEN sales_ovhd_month10
ELSE 0
END item_ovhd_cogs_period10,
CASE
WHEN crec.period_num=10 THEN sales_units_month10
ELSE 0
END extended_amount_us_period10,
CASE
WHEN crec.period_num=11 THEN sales_amount_month11
ELSE 0
END Transaction_quantity_period11,
CASE
WHEN crec.period_num=11 THEN sales_mtl_cost_month11
ELSE 0
END item_material_cogs_period11,
CASE
WHEN crec.period_num=11 THEN sales_mtl_ovhd_cost_month11
ELSE 0
END item_mtl_ovhd_cogs_period11,
CASE
WHEN crec.period_num=11 THEN sales_res_cost_month11
ELSE 0
END item_resource_cogs_period11,
CASE
WHEN crec.period_num=11 THEN sales_op_cost_month11
ELSE 0
END item_op_cogs_period11,
CASE
WHEN crec.period_num=11 THEN sales_ovhd_month11
ELSE 0
END item_ovhd_cogs_period11,
CASE
WHEN crec.period_num=11 THEN sales_units_month11
ELSE 0
END extended_amount_us_period11,
CASE
WHEN crec.period_num=12 THEN sales_amount_month12
ELSE 0
END Transaction_quantity_period12,
CASE
WHEN crec.period_num=12 THEN sales_mtl_cost_month12
ELSE 0
END item_material_cogs_period12,
CASE
WHEN crec.period_num=12 THEN sales_mtl_ovhd_cost_month12
ELSE 0
END item_mtl_ovhd_cogs_period12,
CASE
WHEN crec.period_num=12 THEN sales_res_cost_month12
ELSE 0
END item_resource_cogs_period12,
CASE
WHEN crec.period_num=12 THEN sales_op_cost_month12
ELSE 0
END item_op_cogs_period12,
CASE
WHEN crec.period_num=12 THEN sales_ovhd_month12
ELSE 0
END item_ovhd_cogs_period12,
CASE
WHEN crec.period_num=12 THEN sales_units_month12
ELSE 0
END extended_amount_us_period12,
CASE
WHEN crec.period_num=2 THEN sales_cost_month2
ELSE 0
END item_cogs_period2,
CASE
WHEN crec.period_num=3 THEN sales_cost_month3
ELSE 0
END item_cogs_period3,
CASE
WHEN crec.period_num=4 THEN sales_cost_month4
ELSE 0
END item_cogs_period4,
CASE
WHEN crec.period_num=5 THEN sales_cost_month5
ELSE 0
END item_cogs_period5,
CASE
WHEN crec.period_num=6 THEN sales_cost_month6
ELSE 0
END item_cogs_period6,
CASE
WHEN crec.period_num=7 THEN sales_cost_month7
ELSE 0
END item_cogs_period7,
CASE
WHEN crec.period_num=8 THEN sales_cost_month8
ELSE 0
END item_cogs_period8,
CASE
WHEN crec.period_num=9 THEN sales_cost_month9
ELSE 0
END item_cogs_period9,
CASE
WHEN crec.period_num=10 THEN sales_cost_month10
ELSE 0
END item_cogs_period10,
CASE
WHEN crec.period_num=11 THEN sales_cost_month11
ELSE 0
END item_cogs_period11,
CASE
WHEN crec.period_num=12 THEN sales_cost_month12
ELSE 0
END item_cogs_period12,
a.fiscal_year ,
a.budget_entity ,
a.organization_code,
a.customer_id ,
a.inventory_item_id ,
NULL,
NULL,
a.created_by ,
a.last_updated_by ,
a.creation_date ,
a.last_update_date ,
'Copied From Sales to Forecast Table of Month '||crec.period_num,
a.attribute2,
a.attribute3 ,
a.attribute4 ,
a.attribute5 ,
a.attribute6 ,
a.attribute7 ,
a.attribute8 ,
a.attribute9 ,
a.attribute10,
a.attribute11,
a.attribute12,
a.attribute13,
a.attribute14,
a.attribute15
bulk collect into t1
FROM xxc_sales_data a
where a.fiscal_year = crec.period_year
having CASE
WHEN crec.period_num=1 THEN sum(sales_amount_month1)
WHEN crec.period_num=2 THEN sum(sales_amount_month2)
WHEN crec.period_num=3 THEN sum(sales_amount_month3)
WHEN crec.period_num=4 THEN sum(sales_amount_month4)
WHEN crec.period_num=5 THEN sum(sales_amount_month5)
WHEN crec.period_num=6 THEN sum(sales_amount_month6)
WHEN crec.period_num=7 THEN sum(sales_amount_month7)
WHEN crec.period_num=8 THEN sum(sales_amount_month8)
WHEN crec.period_num=9 THEN sum(sales_amount_month9)
WHEN crec.period_num=10 THEN sum(sales_amount_month10)
WHEN crec.period_num=11 THEN sum(sales_amount_month11)
WHEN crec.period_num=12 THEN sum(sales_amount_month12)
END !=0;
FORALL i IN t1.first .. t1.last
INSERT INTO xxc_forecast2 VALUES t1(i);
--commit;
END LOOP;
END;
Thank You -
Move data from one table to another
Hi,
I need to move data from work space -1 to work space -2. I need to move only selected data. From work space -1 to work space -2
Work space -1
Table -1_
ID NAME Description
1 xyz one
2 abc two
3 mnk three
Table -2_
ID PID NAME Description
1 1 x1 -
2 1 x2 -
3 2 a1 -
4 2 a2 -
5 3 m1 -
Table -1 is parent table and Table-2 is child. Here PID is parent key of table-1 and ID's in both the table are primary keys.
Now i need to move data from work space-1 to work space -2
Work Space -2 table structure
Table - 1
ID INDUSTRY_TYPE DATE DESC
1 TNT - -
2 MTN - -
Table - 2
ID T_ID NAME DATE DESC
1 1 T1 - -
1 1 T2 - -
2 2 E1 - -
2 2 E3 - -
I need to migrate data from work space -1 of table 1 and 2 to work space - 2 of table 1 and tabe 2
Please suggest me a query to migrate. Please let me know if the steps mentioned above is not clear.
Thanks
SudhirHi Sudhir,
since data tables are not located in work-areas but in schema's I presume you mean the latter.
A simple conversion statement would be something like :
insert into table s1.newtable ( column1, column2, ... )
select column1a, column2a, ...
from s2.oldtable
where ...
First the master table, then the child table.
This works using a user-id having al least read-access to schema s2. If no such user exists then use some export method.
No relation to APEX though.
Hope this helps.
Daniel -
I used the Migration Assistant to move data from my Time Machine to my new Mac. Most data seems to have been transferred successfully but none of my iPhoto pictures have been transferred.
My Time Machine now shows the earliest available Back-up to be after the Migration Date. My iPhoto pictures seem to have either been lost in the migration process or are locked in my Time Machine prior to the earliest back-up date now accessible.
Any advice on recovering my old iPhoto pictures would be greatly appreciated.First go to iPhoto Preferences, look in both General and Advanced tabs to make sure that things are set to import from camera into iPhoto.
Then if that doesn't help, connect the camera and open Image Capture in your Applications > Utilities folder and see if you can use Image Capture to reset the import path from the camera to iPhoto.
Image Capture: Free import tool on Mac OS X - Macgasm
Message was edited by: den.thed
Sorry John, I didn't see your post when I clicked the reply button. Dennis -
I want to do a query that returns data only from last two partitions
I have this select that returns data from one partition only.
select *
from tsieven PARTITION(P200707_2Q)
I would like to have something like this for example...
select *
from tsieven PARTITION(P200707_2Q and P200707_1Q)Oracle version is 9i
Partition method (MAX VALUE): TO_DATE(' 2006-04-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
Usually the partition is divided by 15 days. starts in the begin of the month and ends in 15th of the same month.
Partition column: DATA_CRIACAO
I'm trying to to this query:
select tsieven.loptica, tsieven.data_evento Data_Distribuicao
from tsieven (PARTITION MAX), tgirnos n, tsiobje o
where tsieven.no_evento = n.COD_NO
and tsieven.loptica = o.loptica
and to_char(tsieven.data_evento,'dd-mm-yyyy') = to_char(p_data,'dd-mm-yyyy')
and o.cod_classe = p_classe
and n.COD_TIPO_NO='2'
and tsieven.COD_T_EVEN = 'EMZ'
and n.cod_no = p_cdp
order by tsieven.loptica
For example I need to get data for sysdate from 27th of july it's not in this last partition, because it started a new one in 1st of august.
Hope I'm being clear now.
Thanks for your help.
Maybe you are looking for
-
Have a macbook air, how do i get online on an airplane with wifi
have a macbook air, how do I get online on an airplane with wifi?
-
How to produce a cut out?
As a newbie to Illustrator I'm having a problem trying to work out how to produce a rectangle with a curved cut out as per this image. The cut out portion needs to be transparent for me use as a picture overlay. Could someone please advise what I am
-
Can't sync iCal on my iMac to my iPhone
Spent most of yesterday trying to sync the info on iCal on my desktop iMac to my iPhone. Still can't do it. Any help would be appreciated. New member here; first post. Thanks so much. Liz
-
My title line is correct when I check the source code in Google Chrome. Why is it coming out differently in Firefox?
-
Hi All, Just wondering if anyone has had success (or any issues) doing Green Screen with PE7. I am going to buy a green screen kit from B&H. I know the lighting needs to be spot on, but beyond that, any tricks to the workflow? Also, I want to thank