How to sort columns in the target table
I have a simple mapping which I am trying to design. There's only one table on the source and one in the target . There are no filter conditions, only thing is I want the target table to be sorted.
Literally, say
Src is source table has 3 columns x,y,z
Trg is dest table and has 3 columns a,b,c
x--->a
y---->b
z---->c
The SQL should be
select x,y,z from src order by x,y.
I could do the mapping but the order by ..I could not do it .
IKM used: IKM BIAPPS Oracle Incremental Update
Why can't you use simple UPDATE command in EXECUTE SQL Task as below,
DROP TABLE SSN
DROP TABLE STAGING
DROP TABLE STUDENT
CREATE TABLE SSN(pn_id VARCHAR(100),ssn BIGINT)
INSERT INTO SSN VALUES('000616850',288258466)
INSERT INTO SSN VALUES('002160790',176268917)
CREATE TABLE Staging (ssn BIGINT, id INT, pn_id BIGINT, name VARCHAR(100), subject VARCHAR(100),grade VARCHAR(10), [academic year] INT, comments VARCHAR(100))
INSERT INTO Staging VALUES(288258466, 1001, '770616858','Sally Johnson', 'English','A', 2005,'great student')
INSERT INTO Staging VALUES(176268917, 1002, '192160792','Will Smith', 'Math','C', 2014,'no comments')
INSERT INTO Staging VALUES(444718562, 1003, '260518681','Mike Lira', 'Math','B', 2013,'no comments')
CREATE TABLE Student(id INT,pn_id BIGINT,subject VARCHAR(100), [academic year] INT, grade VARCHAR(10), comments VARCHAR(100) )
INSERT INTO Student VALUES(1001, '000616850', NULL,NULL,NULL ,NULL)
INSERT INTO Student VALUES(1002, '002160790', NULL,NULL,NULL ,NULL)
UPDATE Student SET Subject = C.Subject, [academic year]=C.[academic year], grade=C.grade,comments=C.comments
FROM SSN A INNER JOIN Student B
ON A.pn_id=B.pn_id INNER JOIN Staging C
ON A.ssn = C.ssn
SELECT * FROM Student
Regards, RSingh
Similar Messages
-
How to gather stats on the target table
Hi
I am using OWB 10gR2.
I have created a mapping with a single target table.
I have checked the mapping configuration 'Analyze Table Statements'.
I have set target table property 'Statistics Collection' to 'MONITORING'.
My requirement is to gather stats on the target table, after the target table is loaded/updated.
According to Oracle's OWB 10gR2 User Document (B28223-03, Page#. 24-5)
Analyze Table Statements
If you select this option, Warehouse Builder generates code for analyzing the target
table after the target is loaded, if the resulting target table is double or half its original
size.
My issue is that when my target table size is not doubled or half its original size then traget table DOES NOT get analyzed.
I am looking for a way or settings in OWB 10gR2, to gather stats on my target table no matter its size after the target table is loaded/updated.
Thanks for your help in advance...
~SalilHi
Unfortunately we have to disable automatic stat gather on the 10g database.
My requirement needs to extract data from one database and then load into my TEMP tables and then process it and finally load into my datawarehouse tables.
So I need to make sure to analyze my TEMP tables after they are truncated and loaded and subsequently updated, before I can process the data and load it into my datawarehouse tables.
Also I need to truncate All TEMP tables after the load is completed to save space on my target database.
If we keep the automatic stats ON my target 10g database then it might gather stats for those TEMP tables which are empty at the time of gather stat.
Any ideas to overcome this issue is appreciated.
Thanks
Salil -
How to delete rows in the target table using interface
hi guys,
I have an Interface with source as src and target as tgt both has company_code column.In the Interface i need like if a record with company_code already exists we need to delete it and insert the new one from the src and if it is not availble we need to insert it.
plz tell me how to achieve this?
Regards,
sai.gatha wrote:
For this do we need to apply CDC?
I am not clear on how to delete rows under target, Can you please share the steps to be followed.If you are able to track the deletes in your source data then you dont need CDC. If however you cant - then it might be an option.
I'll give you an example from what im working on currently.
We have an ODS, some 400+ tables. Some are needed 'Real-Time' so we are using CDC. Some are OK to be batch loaded overnight.
CDC captures the Deletes no problem so the standard knowledge modules with a little tweaking for performance are doing the job fine, it handles deletes.
The overnight batch process however cannot track a delete as its phyiscally gone by the time we run the scenarios, so we load all the insert/updates using a last modified date before we pull all the PK's from the source and delete them using a NOT EXISTS looking back at the collection (staging) table. We had to write our own KM for that.
All im saying to the OP is that whilst you have Insert / Update flags to set on the target datastore to influence the API code, there is nothing stopping you extending this logic with the UD flags if you wish and writing your own routines with what to do with the deletes - It all depends on how efficient you can identify rows that have been deleted. -
How to hide columns in the output table in webdynpro based on input
Hi Experts,
I have 2 inputs and 1 input is optional.If both inputs are given proper table output is displayed,but if only 1 input is given a column is empty in the output table so i want to hide this column dynamically at runtime based on my inputs.And i want to hide some empty rows also at runtime based on inputs.
Can anyone help me out to solve this.
Thanks in advance.
Regards,
Anita.Hi Anitha,
What i understood from your question is,you want to control the table from your inputs.I have a one question for you what do you want to show defaultly i.e when you run the application what you want to show,either no table or table with some values.
Any how i am giving solution in this way.
If both inputs are given proper table output is displayed
Write your below logic in the WDDOMODIFYVIEW )
Here i am assuming that you already have a table element in the view.
Get the values entered in the input fields and compare those 2 values ,if the condition is satisfied then bind the values which you want to show in the table to the context node.
but if only 1 input is given a column is empty in the output table so i want to hide this column dynamically at runtime based on my inputs
You are telling that you know the empty column.If so get the view element reference and use the REMOVE_COLUMN to remove the column.
data:lr_table type ref to cl_wd_table,
lr_column type ref to L_WD_TABLE_COLUMN.
lr_table ?= view->get_element( 'TABLE1' ).
CALL METHOD LR_TABLE->REMOVE_COLUMN
EXPORTING
ID = 'TABLE1_color'
INDEX =
RECEIVING
THE_COLUMN = lr_column.
i want to hide some empty rows also at runtime based on inputs.
Removing the rows is very simple.if you know the key fields data of internal table from your input fields then do in this way.
delete itab from wa where key1= "12" and key2="abd".
Now bind the internal table to context node.
LO_ND_hcm->BIND_TABLE(
NEW_ITEMS = it_final
SET_INITIAL_ELEMENTS = ABAP_TRUE ). -
How to update fields in the target table in correspondance with the source file values
Environment: win7, SQL server 2008 R2
Application: Microsoft Management SQL Studio 2008 R2, Business Intelligence 2008 - SSIS
SSIS competency level: Novice
Problem: I have been trying to update some of the fields in the destination table,student table, in reference to data set in the staging table and ssn table. I was able to insert/load new data to the destination using look up transformation
while the driver is ssn (data mapping) but i couldn't know how to update some of the fields in the student table while keeping the orignal pn_id of both tables(ssn and student tables), because pn_id already exists in the SSN table and student table. There
are other records also associated with the pn_id so I am not allowed to update the pn_id in the destination tables. For example,
SSN Table (pn_id,ssn)
('000616850',288258466)
('002160790',176268917)
Staging Table (ssn, id, pn_id, name, subject, academic year, comments)
(288258466, 1001, '770616858',Sally Johnson, English,A, 2005,'great student')
(176268917, 1002, '192160792',Will Smith, Math,38000,C, 2014,'no comments')
(444718562, 1003, '260518681',Mike Lira, Math,38000,B, 2013,'no comments')
Student Table (destination table)(id,pn_id,subject,academic year, grade, comments):
(1001, '000616850', ' ',' ', ,'')
(1002, '002160790', ' ',' ', ,'')
Expected Results:
My goal is to have student table updated as the following:
Student Table
(1001, '000616850', 'English','A' ,2005 ,'great student')
(1002, '002160790', 'Math ',' C',2014 ,'no comments')
please adviseWhy can't you use simple UPDATE command in EXECUTE SQL Task as below,
DROP TABLE SSN
DROP TABLE STAGING
DROP TABLE STUDENT
CREATE TABLE SSN(pn_id VARCHAR(100),ssn BIGINT)
INSERT INTO SSN VALUES('000616850',288258466)
INSERT INTO SSN VALUES('002160790',176268917)
CREATE TABLE Staging (ssn BIGINT, id INT, pn_id BIGINT, name VARCHAR(100), subject VARCHAR(100),grade VARCHAR(10), [academic year] INT, comments VARCHAR(100))
INSERT INTO Staging VALUES(288258466, 1001, '770616858','Sally Johnson', 'English','A', 2005,'great student')
INSERT INTO Staging VALUES(176268917, 1002, '192160792','Will Smith', 'Math','C', 2014,'no comments')
INSERT INTO Staging VALUES(444718562, 1003, '260518681','Mike Lira', 'Math','B', 2013,'no comments')
CREATE TABLE Student(id INT,pn_id BIGINT,subject VARCHAR(100), [academic year] INT, grade VARCHAR(10), comments VARCHAR(100) )
INSERT INTO Student VALUES(1001, '000616850', NULL,NULL,NULL ,NULL)
INSERT INTO Student VALUES(1002, '002160790', NULL,NULL,NULL ,NULL)
UPDATE Student SET Subject = C.Subject, [academic year]=C.[academic year], grade=C.grade,comments=C.comments
FROM SSN A INNER JOIN Student B
ON A.pn_id=B.pn_id INNER JOIN Staging C
ON A.ssn = C.ssn
SELECT * FROM Student
Regards, RSingh -
How to execute query to store the result in the target table column ?
Hi
Source: Oracle
Target: Oracle
ODI: 11g
I have an interface which loads the data from source table to target. Some of the columns in the target tables are automatically mapped with source table. Some of the column remain un-mapped. Those who remain un-mapped, I want to load the values in that column by executing an query. So can anybody tell me where I should mention that query whose result would become the value of the specific column.
-Thanks,
ShrinivasActually I select the column from the target table then in the Property Inspector-->Mapping properties-->Implementation
tab I have written the query which retrieve the value for that column. Is the right place to write the query? How can do this ?
-Shrinivas -
How do I make Merge operation into the target table case insensitive?
Hi All,
We have a target table that has a varchar 2 column called nat_key and a map that copies over data from a source table into the target table.
Based on wheteher the values in the nat_key column matches between the source and the target, an update or an insert has to be done into the target table.
Let us say target table T has the following row
nat_key
EQUIPMENT
Now, my source table has the same in a different case
nat_key
equipment
I want these rows to be merged .
In the OWB map, I have given the property of nat_key column in the target table as 'Match while updating' = 'Yes'. Is there a built in feature in OWB, using which I can make this match as case insensitive?
Basically, I want to make OWB generate my mapping code as
if UPPER(target. nat_key)=upper(source.nat_key) then update...else insert.
Note: There is a workaround with 'Alter Session set nls_sort=binary_ci and nls_comp=linguistic', but this involves calling a pre-mapping operator to set these session parameters.
Could anyone tell me if there is a simpler way?Hi,
use an expression operator to get nat_key in upper case. Then use this value for the MERGE. Then nat_key will only be stored in upper case in your target table.
If you have historic data in the target table you have to update nat_key to upper case. This has to be done only once and is not necessary if you start with an empty target table.
Regards,
Carsten. -
Issue with INSERT INTO, throws primary key violation error even if the target table is empty
Hi,
I am running a simple
INSERT INTO Table 1 (column 1, column 2, ....., column n)
SELECT column 1, column 2, ....., column n FROM Table 2
Table 1 and Table 2 have same definition(schema).
Table 1 is empty and Table 2 has all the data. Column 1 is primary key and there is NO identity column.
This statement still throws Primary key violation error. Am clueless about this?
How can this happen when the target table is totally empty?
ChintuNope thats not true
Either you're not inserting to the right table or in the background some other trigger code is getting fired which is inserting into some table which causes a PK violation.
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How can I insert an aggregated column name as a string in the target table?
I have a large source table, with almost 70 million records. I need to pull the sum of four of the columns into another target table, but instead of having the same four target columns I just want to have two.
So, let's take SUM(col1), SUM(col2), SUM(col3), and SUM(col4) from the source DB & insert them into the target like this:
SOURCE_COLUMN
| AMOUNT
1 col1
| SUM_AMOUNT
2 col2
| SUM_AMOUNT
3 col3
| SUM_AMOUNT
4 col4
| SUM_AMOUNT
I know how to do this in four separate Data Flows using the source, an Aggregation Transformation, a Derived Column (to hard code the SOURCE_COLUMN label), and destination... but with this many records, it takes over 3 hours to run because it has to loop
through these records four separate times instead of once. Isn't there a way to do this with one Data Flow? I'm thinking maybe Conditional Split?
Any help is appreciated, thanks!Hi ,
This could be achieved using UNPIVOT transformation. The below sample uses the below source query
SELECT 1 AS COL1,2 AS COL2,3 AS COL3,4 AS COL4
setup the UNPIVOT transformation as below
The output of unpivot transformation will be as below
Hope this helps.
Best Regards Sorna -
How do I make a JTable's header sorting actually change the actual table?
How do I make a JTable's header sorting actually change the actual table?
Currently, I'm using
table.setAutoCreateRowSorter(true);to allow the user to sort the table.
However, I want to be able to load something based on the selected row's index. The problem is that when the table is rearranged, the change appears to only be local, in other words, the actual table isn't changing.
For instance:
index 0 "A"
index 1 "B"
index 2 "C"
Sorted in reverse gives me
"C"
"B"
"A"
But C is still index 2 (instead of 0).
Thanks in advance.Cross posted and answered in the Swing forum.
[http://forums.sun.com/thread.jspa?threadID=5353865]
I see this is not your first incidence of cross posting. In future, please post a question once only.
db -
How do I change the order of columns in the responses table?
How do i change the order of columns in the responses table in FormsCentral? The default setting puts them in reverse order!
Hi,
The issue with the default ordering of columns in the response table is something that we hope to address in the next update to FormsCentral. In the meantime, you can reorder the columns by selecting them then click/drag using the gray area above the column name. As shown below, an orange marker will show you where the columns will be placed when you release the mouse button.
Sorry for the inconvenience.
Regards,
Brian -
How to sum different column in the same table
Hi everyone
I would like to know how can I make the sum of different column in the same table using apex
exple:
TR_PROJ_BIL_TRIM.ENTPIDFISC as ENTPIDFISC,
TR_PROJ_BIL_TRIM.EXEANNEE as EXEANNEE,
TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV as PROJBILTRIMT1PREV,
TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV as PROJBILTRIMT2PREV,
trunc( TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV)+(TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV)
from TR_PROJ_BIL_TRIM TR_PROJ_BIL_TRIM
group by TR_PROJ_BIL_TRIM.ENTPIDFISC,TR_PROJ_BIL_TRIM.EXEANNEE
but while trying to run this script i get this error message:"ORA-00979: not a GROUP BY expression"
thanks for reading me and I hope to hear from you soonHi,
Your question do not have anything do with APEX.
It is pure SQL question and you will get better answer this kind questions from SQL and PL/SQL forum
You need have GROUP BY when you use aggregate functions like SUM.
I assume you like just add two columns.
Try
SELECT ENTPIDFISC
,EXEANNEE
,PROJBILTRIMT1PREV
,PROJBILTRIMT2PREV
,trunc(PROJBILTRIMT1PREV) + (PROJBILTRIMT2PREV)
FROM TR_PROJ_BIL_TRIM
Regards,
Jari -
How to soft delete a row from the target table?
Could someone help me on this requirement?
How to implement the below logic using only ODI? I am able to implement the below logic with the "DELETE_FLAG" as "N".
I want to make the latest record with the flag as "N" and all the previous other records with the flag as "D".
Thanks a lot in advance.
I have a source table "EMP".
EMP
EMPID FIRST_NAME
1 A
2 B
First name is changed from A to C and then, C to D etc. For each data change, I would add a target row and mark the latest row as "N" and the rest as "D". The target table would contain the following data:
Target_EMP
EMPID FIRST_NAME DELETE_FLAG
1 A D
1 C D
1 D NThe problem is that I can't delete the row cause it demands from me to fill the mandatory field previously. It takes place when the key field is ROWID. In other cases delete is succesful.
-
Duplicates in the target table.
Hi, I am working on ODI 10.
In one of my interface when ever I executes there are some duplicates are coming to the target table.
Say if the count of the rows around 5000 in the source table and in the target it would be around 120000. Even after using the distinct rows in the flow control some bugs are coming.
Can you please help how solve this...
Note:In source table one column contains surrogate key.
IKM oracle control append is the KM I am usingUsing the Control Append IKM will always add the data that is in the Source to the Target, unless you truncate or delete from the Target first. If you have data in the Source that has already been loaded to the Target, and you do not truncate the Target prior to the next load, you will have duplicates.
Are you truncating the Target or is the Source data always "new" each time the Interface is run?
Regards,
Michael Rainey -
How to sort column totals in pivot view
Hello guys
I have a report in pivot view where I have put call type on the column section. So the report looks like below with SUM applied at the column section:
Call Type1 Call Type2 Call Type3 TOTAL
ID SALES TOTAL
A 100 200 300 500
B 200 200 400 800
C
D
EMy question, how do I sort the data in 'TOTAL' field? The challenge it seems is that since 'TOTAL' isn't a table column, but just a display of pivot Sum, it can't be sorted H-L or L-H..
But I'd like to have some advice from you guys before I make my conclusion
Thanks
Edited by: user7276913 on Jan 11, 2010 10:05 AMYou can't have the sorting on the total in Pivot table.
On a workaround,
you can create a column in the criteria which calculate the sum
SUM(sales_total by ID)Assign sorting order on this column
You can exclude this column in the pivot table
Regards,
Raghu
Maybe you are looking for
-
LR5 's Adjustment Brush doesn't seem to work-does the New Radial Filter have priority?
So why in the world would I update Lightroom in the middle of a job.? Before I was able to do in and touch up shadowy areas using (K) adjustment brush, but now it doesn;t seem to work. The radial brush does a good job for a defined area but for SPOT
-
Question about XSL Mapper in BPEL designer
Hi, I have a question regarding the XSL mapper within JDeveloper BPEL Designer. Scenario: Consider 1. Source xsd with 3 attributes 2. Target xsd with 5 attributes An XSL mapping is defined for 3 source attributes to the corresponding target attribute
-
Hi all, Can any one help me out how can I Post a Payment Lot With Scheduled Process, Means Lot is Like this PDDMMYY001C. & Date is variable as per the day...Is it Possible through FPB3 ...also I have to generate the Lot with with Program on daily Scc
-
KODO JDO Exception - kodo.util.FatalDataStoreException
Using <b>Kodo Version - 3.3.4</b>, getting following exception when we try to <b>COMMIT</b>. Please let us know the reason for this kind of exception. java.lang.NullPointerException> kodo.util.FatalDataStoreException: java.lang.NullPointerException a
-
What is normalization and denormalization in BW
Hi, i am new to BW i have searched few forums regarding this. some people are telling the if the data in the table is divided in to two tables that is called normalization if suppose if we want to divide the data in to two tables on what condition we