Want to display selected rows of table in another table
Hello all,
On jspx page their is quick query search component clcking on it popup gives result in table format
user can select multiple rows for this I have provided checkbox column which transit variable in my view..
now I want to display selected rows into another table
how I can achieve this functionality...
Hi,
You can add the method in the AM, expose them as client interface. In the action listener of the button (of the popup where you are selecting the rows and clicking to continue), execute the method from AM.
Sample,
AM method
public void filterMyTableRows(){
this.getMyViewObject().setWhereClause("transient_attribute='Y'"); // Change according to your view object name and transient attribute name
this.getMyViewObject().executeQuery();
}In your actionListener, add something like
public String commandButtonActionListener() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("filterMyTableRows");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
/* your rest of the code goes here..
return null;
}-Arun
Similar Messages
-
I'm using qurey panel with table.i want to display the rows as default
Hi
I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
I'm using qurey panel with table , for first time when i run ,rows are not displayed as default .After i fire search button records / rows are displaying.Now i want to display the rows in table when i run for first time , mean i want to display rows by default.
thanks in advance.Hi,
if the queryPanel is based on a ViewCriteria in ADF BC then this autoExecute can be defined on the VC definition
Frank -
How to get selected row data of an ADF table in HashMap?
Hi,
Can anyone please tell me how to selected row data of an ADF table in HashMap like :
Object obj = pageTable.getSelectedRowData();
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)obj;
Now in above code I want the convert rowData in HashMap.
Can anyone please tell me how to do that? Its urgent.
Thanks,
VikVik,
No need to ask the same question 3 times...
In [url http://forums.oracle.com/forums/message.jspa?messageID=4590586]this post, Nick showed you how to get the Row.
If it were so urgent, you could have done a little reading of the javadocs to come up with code like this (not tested, up to you to do that)
HashMap m = new HashMap();
Row r = get it like Nick showed you to;
Object values[]=r.getAttributeValues();
String names[]=r.getAttributeNames();
for (int i=0; i<r.getAttributeCount(); i++)
m.put(names, values[i]); -
When executing query...in the result i want to display each row values
Hi All,
When executing query...in the result area i want to display each row values.
Example: query result is like this
Business Area Sales Material
kh02 1000 2000
2000 300
5000 400
6990 1000
Kh03 1400 700
200 500
50 60
but i need like this
kh02 1000 2000
kh02 500 600
kh02 400 300
kh03 1400 700
kh03 200 500
Why i need like this because am exporting to Excel spread sheet and i have to send as i show above ....i am doing manual but the file is very big like 95, 969 records i have to change manual...like this i have to change 8 files.
please advice me easy way
i willl be very gr8ful
Thanks
sidharthaHi,
that'S exactly what hide repeated key values does. If this option is on your result is:
Kh02 1000 1500
blank 500 456
blank 600 700
kh03 400 500
balnk 500 600
If you turn it off, the result will be:
Kh02 1000 1500
Kh02 500 456
kh02 600 700
kh03 400 500
kh03 500 600
Exaclty what you want. Try it, it should work
Regards,
Juergen -
Copying table rows from one table to another table form
Hi
I have a problem about Copying table rows from one table to another table form.On jsf pages if you enter command button go anather jsf page and it copy one row to another table row. But when i execute this process for table FORM it doesn't copy I wrote a code under "createRowFromResultSet - overridden for custom java data source support." Code block is:
ViewRowImpl value = super.createRowFromResultSet(qc, resultSet);
try{
AdfFacesContext fct = AdfFacesContext.getCurrentInstance();
Number abc = (Number)fct.getProcessScope().get("___");
value.setAttribute("___",abc);
}catch(Exception ex){System.out.println(ex); }
return value;Table may be copied with the
expdp and impdp utilities.
http://www.oracle.com/technology/products/database/utilities/index.html -
Need a Query to update table from another table.
I have two tables Table A and Table B , till now in table “A”. I have a column which consist of IDs and duplicate IDs( which are basically formed by Original Ids) , I have another table i.e. table “B” , which gives a mapping between original ids and duplicate Ids
TABLE A:
ID/DUPLICATEID NAME
1 Rahul
1_CAD Pawan
2 Nikhil
3 TOM
3_CAD Ravi
3_MQ Puneet
TABLE B:
ORIGINALID DUPLICATEID
1 1_CAD
3 3_CAD
3 3_MQ
Now I want to have another column in Table “A” , which will give me the mapping between the original Id and duplicate Id as shown in updated table “A”.
UPDATED TABLE A:
ID/DUPLICATEID NAME ORIGINAL_ID
1 Rahul
1_CAD Pawan
2 Nikhil
3 TOM
3_CAD Ravi
3_MQ Puneet
Now I want to write a Query in which I can update this column (ORIGINAL_ID) of Table “A”, from the table B(basically want to update mulitple rows using single query), because table B already has this mapping. Can any one help me in this. I am basically a Java guy , so I don’t know much about it. I hope to get a positive response from you people, Thanks in advance!Here you go...
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%">
<code>
SQL> CREATE TABLE A (ID VARCHAR2(10), NAME VARCHAR2(10), NEW_ID VARCHAR2(10));
Table created.
SQL> INSERT INTO A VALUES ('1', 'Rahul', '');
1 row created.
SQL> INSERT INTO A VALUES ('1_CAD', 'Pawan', '');
1 row created.
SQL> INSERT INTO A VALUES ('2', 'Nikhil', '');
1 row created.
SQL> INSERT INTO A VALUES ('3', 'TOM', '');
1 row created.
SQL> INSERT INTO A VALUES ('3_CAD', 'Ravi', '');
1 row created.
SQL> INSERT INTO A VALUES ('3_MQ', 'Puneet', '');
1 row created.
SQL> CREATE TABLE B (ID VARCHAR2(10), NAME VARCHAR2(10));
Table created.
SQL> INSERT INTO B VALUES ('1', '1_CAD');
1 row created.
SQL> INSERT INTO B VALUES ('3', '3_CAD');
1 row created.
SQL> INSERT INTO B VALUES ('3', '3_MQ');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> UPDATE A
2 SET NEW_ID = NVL((SELECT B.ID FROM B WHERE A.ID = B.NAME),A.ID)
3 /
6 rows updated.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM A;
ID NAME NEW_ID
1 Rahul 1
1_CAD Pawan 1
2 Nikhil 2
3 TOM 3
3_CAD Ravi 3
3_MQ Puneet 3
6 rows selected.
</code></pre>
Note: While asking question do give us DML/DDL script. It will make peoples life better.
Karthick.
http://www.karthickarp.blogspot.com/ -
I can't create table from another table?
Hi everyone!
I have a problem that I don't known the reason why?
I'm using Oracle version 8i and I want to create a table from another table, such as:
CREATE TABLE a_backup as SELECT * FROM a => It's OK, table a_backup is created.
But there is only a table that I can't created like that, such as:
CREATE TABLE b_backup AS SELECT * FROM b;
When I run over command, SQL Plus is not responding... and clients are can't access to DB or Executing forever
This is the first time I met this problem.
Can Anyone help me to resolved it?
Thanks in advance!xi`tin wrote:
Hi everyone!
I have a problem that I don't known the reason why?
I'm using Oracle version 8i and I want to create a table from another table, such as:You realize, of course, that 8i is completely out of support .... Is your OS and hardware just as old as your rdbms software, or is it only the rdbms that your company refuses to upgrade?
CREATE TABLE a_backup as SELECT * FROM a => It's OK, table a_backup is created.
But there is only a table that I can't created like that, such as:
CREATE TABLE b_backup AS SELECT * FROM b;
When I run over command, SQL Plus is not responding... and clients are can't access to DB or Executing forever
This is the first time I met this problem.
Can Anyone help me to resolved it?
Thanks in advance! -
Updating a table from another table
I have a target table a.
SQL> select * from a;
FUND TERM
1
2
3
4
5
6
7
8
8 rows selected.
And, I have another table 'b' where I have the values for 'term' backed up for 4 funds.
SQL> select * from b;
FUND TERM
1 07-JUL-08
2 08-JUL-08
3 09-JUL-08
4 10-JUL-08
4 rows selected.
I could use the below merge sql statement to update the target table 'a' with term dates from table b.
SQL> merge into a
using b
on (a.fund = b.fund)
when matched then
update set a.term = b.term;
Merge successfully completed.
SQL> select * from a;
FUND TERM
1 07-JUL-08
2 08-JUL-08
3 09-JUL-08
4 10-JUL-08
5
6
7
8
8 rows selected.
But, my question is, how could this update be done without using 'merge' in sql (not pl/sql). I think I've done it in the past, but just cannot recall how I did it.
Thanks in advance for any tips you may provide.A few ways:
update a
set a.term = (select b.term
from b
where b.fund = a.fund)
where exists (select b.term
from b
where b.fund = a.fund)
or
update
select a.term a_term
,b.term b_term
from a,b
where a.fund = b.fund
set a_term = b_term;The second one only works if you have a "key preserved table". -
Question on Creating table from another table and copying the partition str
Dear All,
I want to know whether is there any way where we can create a table using another table and have the partitions of the new table to be exactly like the used table.
Like
CREATE TABLE TEST AS SELECT * FROM TEMP;
The table TEMP is having range and hash partitions.
Is there any way when we use the above command, we get the table partitions of TEMP to be copied to the new table TEST.
Appreciate your suggestions on this one.
Thanks,
Madhu K.may this answer your question...
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:595568200346856483
Ravi Kumar -
Create a new table from another table that exists ussing a stored procedure
Hi,
I want to know if is posibble to create a new table from another table that exists ussing a stored procedure. This new table is created from other table that exists in the DB.
(in the next code the table tbl1 exist into the schema of the DB, but temp_tbl1 does not exist, it must be created by the procedure)
create or replace procedute temp is
temp_tbl1 tbl1%TYPE; //the temp_tbl1 will have the same type of tbl1
begin
create table temp_tbl1 as (select * from tbl1);
end temp;
thanks very muchcat wrote:
Hello,
I think my problem is not about this grant, because if I execute this as an "anonymous procedure":
DECLARE
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE Abonus (id NUMBER, amt NUMBER)';
END;
It runs ok
But if I do:
CREATE OR REPLACE procedure temp as
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE Abonus (id NUMBER, amt NUMBER)';
END;
I have the error
ORA-01031: Insufficient privileges
ORA-06512: at "temp", line 3Anonymous blocks are treated as "Invoker's Rights" from a privilege perspective whereas stored programs by default are treated as "Definer's Rights". Therefore using anonymous blocks is not a valid test to check this.
The simplest form of checking this issue is by executing
SET ROLE NONE;and then to run your statement/code block in question interactively. Using this approach you get in your session the effective rights of a "Definer's Rights" stored program, i.e. only privileges that you got granted directly to your user.
You can revert to the default setting by issuing
SET ROLE ALL;For more information regarding this topic, read e.g. the documentation:
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#LNPLS00809
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Create a table from another table
I have Windows XP with 10g 10.2.0.1.0
I need to create a table from another table to re-arrange the table column order and add the following statement at the end of creation.
PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
TABLESPACE "TAB_DATA"
Below iis my SQL statement, but it doesn't work. Please help.
create table my_table as (select t1, t5, t2, t3, t4 from orig_table
PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
TABLESPACE "TAB_DATA"
*);*Kee Kee wrote:
I have Windows XP with 10g 10.2.0.1.0
I need to create a table from another table to re-arrange the table column order Why? Column order has no meaning. The individual SELECT statement specifies the column order that particular statement wants, which may be different from the needs of some other SELECT statement.
and add the following statement at the end of creation.
PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
TABLESPACE "TAB_DATA"
Below iis my SQL statement, but it doesn't work. Please help.
create table my_table as (select t1, t5, t2, t3, t4 from orig_table
PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
TABLESPACE "TAB_DATA" -
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 -
Approaches to transfer changed data from a table to another table
Hello expert,
will you please show me all approaches to automatically detect and transfer changed data from a table to another table ? I don't need detail information, but a little comment for those approaches are more welcome.
Many Thanks,
Edited by: 843178 on 19-Dec-2011 2:04 PMYou will want to review information on replication and similar methods
In a nutshell:
Replication allowed data to exist at more than one site and take the Master / original table data and clone it at a different site
As tranporting all of the table data to a remote / clone site got more and more expensive we developed a method
to identify just the 'diffs' and only send those from the master to the clone which needed only the diffs to become a clone of the master table
This has many methods and options, but looking under key words such as
- distributed transations
- materialized views
- replication
... are a few categories that will get you started -
Create table by another table query wid contraints
how can we create table by another table but wid all the constraints of that table means
create table emp_test as select * from emp
it will create the replica of emp table but not constraints so how can i creat table along wid constraintsMushy wrote:
i cant do this i have more than 200 tables to create wid the create table statement so any simple method to create table including constrains of that table otherwise i have to make a lot of changes in this codee etcc etcc
thanks a lot for ur replyYou can automate it. Something to start with:
SET SERVEROUTPUT ON FORMAT WORD_WRAPPED
DECLARE
v_new_def CLOB;
BEGIN
FOR v_rec IN (select table_name,dbms_metadata.get_ddl('TABLE',table_name) def from user_tables where table_name in ('EMP','DEPT')) LOOP
v_new_def := v_rec.def;
FOR v_list IN (select table_name from user_tables where table_name in ('EMP','DEPT')) LOOP
v_new_def := replace(
v_new_def,
'"' || USER || '"."' || v_list.table_name || '"',
'"' || USER || '"."' || v_list.table_name || '_TEST"'
END LOOP;
v_new_def := replace(
v_new_def,
'"PK_' || v_rec.table_name || '"',
'"PK_' || v_rec.table_name || '_TEST"'
dbms_output.put_line(v_new_def);
END LOOP;
END;
CREATE TABLE "SCOTT"."DEPT_TEST"
( "DEPTNO" NUMBER(2,0),
"DNAME" VARCHAR2(14),
"LOC" VARCHAR2(13),
CONSTRAINT
"PK_DEPT_TEST" PRIMARY KEY ("DEPTNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536
NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE
"USERS" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576
MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
CREATE TABLE "SCOTT"."EMP_TEST"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
"JOB" VARCHAR2(9),
"MGR" NUMBER(4,0),
"HIREDATE" DATE,
"SAL" NUMBER(7,2),
"COMM" NUMBER(7,2),
"DEPTNO" NUMBER(2,0),
CONSTRAINT "PK_EMP_TEST" PRIMARY KEY
("EMPNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT
"FK_DEPTNO" FOREIGN KEY ("DEPTNO")
REFERENCES "SCOTT"."DEPT_TEST" ("DEPTNO") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1
MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1
FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
PL/SQL procedure successfully completed.
SQL> SY. -
Create table from another table including constraints
Hi,
Is there a way to create a table from another table including constraints.
CREATE TABLE COPY_EMP
as
SELECT *
FROM EMP
WHERE 1 =2 ;
This creates the table, but the constraints are not copied over.
I was reading about DBMS_REDEFINITION - can that be used for this scenario ?
Thanks!
Anand>
I tried that, but the constraint names are posing a problem. And unfortunately our constraints are not named in a standard, so am finding it difficult to replace them.
Was just wondering if there were any simpler approach to this.
>
No - there isn't.
You will have to use new names for the constraints. That usually means extracting the DDL and manually changing the constraint names.
Maybe you are looking for
-
Table is not in the same position form 1 page to next
Hi, Following my earlier posts regarding my website and the lack of text. I thought if I created a new index page with text and and enter site button this would go some way to sorting out the problem. The problem now is that the indes page table is n
-
IPod Touch 2G will not Sync. iTunes freezes. Help?
Hi, I have an iPod Touch 2G and iTunes on 10.5.8. I cannot place the exact time things stopped syncing, but it was right around when I upgraded to OS 3 for the iPod, and installed iTunes 8.2. Subsequently, I have tried each version/update of iTunes t
-
Indesign published site to Interactive PDF
Hi guys I wonder if anyone can help? I have created a basic website for my dad, however, I want people to be able to click on the 'Click Here' BUTTON and it takes them to an interactive PDF document that they fill in their details onto. You can see t
-
Stereo import problems creates mono to stereo problem/question
After 10 hours of uploading video to the hard drive I'm finally ready to work on the project, but something odd happened. After the first tape upload all the files switched from two track stereo to one track mono. How does this happen? I don't relish
-
Internal NT error when attempting to use the Oracle Management Server
Our platform is: HP NetServer LC 2000 1 GB Ram. CPU: x86 Family 6 Model 8 Stepping 8 Windows NT 4.0 Oracle 8.1.6 Currently the database is working fine except the problems with the Oracle Management Server which will allow us to do a backup. The Mana