Create values for analogous periods in the same table with DS
Hi,
in the course of a pilot we want to create additional columns with data for analogous periods.
We have values for a month and need to create new columns for values for last month and last year in order to compare.
Attached youu2019ll find a few sample rows resembling the basic concept of what we have
Region Country Year Month Value
Europe Spain 2009 1 285
Europe Spain 2009 2 129
Europe Spain 2009 3 153
Europe Spain 2008 1 288
Europe Spain 2008 2 284
Europe Spain 2008 3 125
Europe France 2009 1 135
Europe France 2009 2 125
Europe France 2009 3 284
Europe France 2008 1 208
Europe France 2008 2 221
Europe France 2008 3 220
In this case, new columns would be
LastMonth (125 for Spain month 1 year 2009, since this is the value for month 3 year 2008)
LastYear (288 for Spain month 1 year 2009, since this is the value for month 1 year 2008).
Can you help on what function to use in the DS query transformation?
thanks everybody, and enjoy!
Hi David,
Probably the easiest way of resolving this would be to add extra columns which show the projected date each row should be shown on e.g.
Region Country Year Month Value LM_Year LM_Month LY_Year LY_Month
Europe France 2008 1 208 2008 2 2009 1
Europe France 2008 2 221 2008 3 2009 2
Europe France 2008 3 220 2008 4 2009 3
Europe France 2009 1 135 2009 2 2010 1
Europe France 2009 2 125 2009 3 2010 2
Europe France 2009 3 284 2009 4 2010 3
This would be written to a staging table then used as a source with the original source file to produce the target table. I've illustrated an example of how this could be achieved below:
Create two dataflows; DF 1 and 2.
In DF 1 read source, add additional columns to show the date (year, month, etc) this should be projected as. This would need to be done for both the last month and last year. Load staging table.
In DF 2 Read the source and outer join to the new staging table twice. Use the region, Country, Year, Month, to join and use the new additional projected date columns. Ensure the last month date fields are used on one staging table and last year date fields are used on the next staging table. The value from the two staging tables is then used in the last month and last year value.
Load into target table.
To calculate the projected date columns you would probably want to format the source fields into a date then add the required number of months. e.g. to_date('01' || month || year, 'DDMMYYYY') + 12
Obviously this would need the stage table to be truncated before each load and you would need to assess your load strategy. When doing these calculated fields if you have any retrospective updates on the source then these would then need recalculating, therefore this assumes it's a complete reload each time.
Edited by: Richard Saltern on Jul 16, 2010 2:01 PM
Edited by: Richard Saltern on Jul 19, 2010 10:10 AM
Similar Messages
-
Can i use one JSF component's value for other component in the same page.
Can i use one JSF component's value for other component in the same page.
For example
I have a <h:selectBooleanCheckbox id="myChk"> in my jsf page, i want to access its value for another component like:
<h:commandButton disabled="#{myChk.checked}" action="myAction" value="myValue" />
** "myChk.checked" >> I am just asuming "checked" property is available...Bind the checkbox to a UIInput myChk property. Then you can reference this property from the page, e.g.
<h:selectBooleanCheckbox binding="#{myBean.myChk}" onchange="submit();" />
<h:commandButton disabled="#{myBean.myChk.value}" action="myAction" value="myValue" /> -
Trigger in mutation - Update another rows in the same table with a trigger
Hi ,
I try to do a before update trigger on a table , but the trigger is in mutation. I understand why it do that but my question is :
How can I update other rows in the same table when a UPDATE is made on my table??????
Here is my trigger :
CREATE OR REPLACE TRIGGER GDE_COMPS_BRU_5 BEFORE
UPDATE OF DEPARTEMENT--, DISCIPLINE, DEG_DEMANDE, CE_ETAB
ON GDEM.COMPOSITION_SUBV
FOR EACH ROW
Organisme : FQRNT-FQRSC
Date de création : 14-07-2011
Date de modification :
Modifié par :
Auteur : Johanne Plamondon
Description : Ce déclencheur s'executera lors de la modification
du responsable dans la table COMPOSITION_SUBV
DECLARE
V_OSUSER V$SESSION.OSUSER%TYPE;
V_PROGRAM V$SESSION.PROGRAM%TYPE;
V_TERMINAL V$SESSION.TERMINAL%TYPE;
V_MACHINE V$SESSION.MACHINE%TYPE;
V_MODULE V$SESSION.MODULE%TYPE;
V_LOGON_TIME V$SESSION.LOGON_TIME%TYPE;
V_AUDIT_ID NUMBER;
vSEQ NUMBER;
i NUMBER;
vID DEMANDE.ID%TYPE;
BEGIN
begin
SELECT OSUSER, PROGRAM, TERMINAL,MACHINE,MODULE, LOGON_TIME
INTO V_OSUSER,V_PROGRAM,V_TERMINAL,V_MACHINE,
V_MODULE,V_LOGON_TIME
FROM V$SESSION
WHERE TYPE = 'USER'
AND USERNAME = USER
AND LAST_CALL_ET IN (0,1)
AND ROWNUM < 2;
exception when others then null; end;
IF NVL(:NEW.SC_PART,' ') = 'CHC' THEN
SELECT COUNT(*)
INTO i
FROM DEMANDE
WHERE DEM_REF = :NEW.DEM_ID
AND PER_NIP = :NEW.PER_NIP;
IF i = 1 THEN
SELECT ID
INTO vID
FROM DEMANDE
WHERE DEM_REF = :NEW.DEM_ID
AND PER_NIP = :NEW.PER_NIP;
UPDATE COMPOSITION_SUBV
SET --CE_ETAB = :NEW.CE_ETAB,
--DISCIPLINE = :NEW.DISCIPLINE,
DEPARTEMENT = :NEW.DEPARTEMENT,
--DEG_DEMANDE = :NEW.DEG_DEMANDE,
DATE_MODIF = SYSDATE,
USER_MODIF = V_OSUSER
WHERE DEM_ID = vID
AND PER_NIP = :NEW.PER_NIP
AND ANNEE = :NEW.ANNEE;
END IF;
END IF;
/*EXCEPTION
WHEN OTHERS THEN
NULL;*/
END;A standard disclaimer, the mutating trigger error is telling you that you really, really, really don't want to be doing this. It generally indicates a major data model problem when you find yourself in a situation where the data in one row of a table depends on the data in another row of that same table. In the vast majority of cases, you're far better off fixing the data model than in working around the problem.
If you are absolutely sure that you cannot fix the data model and must work around the problem, you'll need
- A package with a collection (or global temporary table) to store the keys that are modified
- A before statement trigger that initializes the collection
- A row-level trigger that adds the keys that were updated to the collection
- An after statement trigger that iterates over the data in the collection and updates whatever rows need to be updated.
If you're on 11g, this can be simplified somewhat by using a compound trigger with separate before statement, row-level, and after statement sections.
Obviously, though, this is a substantial increase in complexity over the single trigger you have here. That's one of the reasons that it's generally a bad idea to work around mutating table exceptions.
Justin -
LookUp to the same table with multiple conditions
Hi,
I nead to do a lookup to the same table in the flow but with diffrent quieres, each query contains it's own 'where'.
Can I do it somehow in one look up or do I have to use a few ?
select a from table where a=1
select b from table where c=3
ThanksHi,
Using multiple lookups will be a cleaner approach. If you are using multiple lookups on the same table consider using Cache transform. Refer the below link for details on Cache transform
Lookup and Cache Transforms in SQL Server Integration Services
Alternatively if you want to go ahead with single look up , you may have to modify the SQL statement in the Lookup accordingly to return the proper value. In you case it may be
select a,b from table where a=1 or c=3
Note : Consider the above as a pseudo code. This needs to be tested and applied based on your requirement.
Best Regards Sorna -
How create 3 libraries for 3 Ipods on the same XP with 1 loging
Hi all
I just purchased 3 Ipods 30Go.
I own only 1 XP SP2 DELL station with Itunes at 7.1 level.
I don't have any special account - logging
How can I create 3 diff. libraries ?
Starting Itunes with MAJ key on in :
1 - in program mode
2 - with Itunes icon on the desk
don't work fine.
Ilibs soft seems to be ok for that; what's APPLE & IPOD
solution ?If you are adding two or more iPods for your own use, just connect each iPod to your computer and follow the on screen instructions. It will update from your existing library. Depending on the size of your library and the type of iPod you choose you can have it update all songs and playlists, selected playlists only or you can manage it manually.
If the iPods belong to different people, there are basically two ways of using multiple iPods on a computer and these involve:
a) Sharing a single iTunes library and or user account or
b) Creating multiple user accounts.
Note: When you are sharing an iTunes library, you don't have to set each iPod to update in the same manner, you can mix and match from the options below as each iPod has it's own update settings
Sharing a Library and/or User Account
If you want to share the one library, you can set either or all of the iPods so that they only get updated with only certain playlists (you can update from more than one if you wish):
Loading songs onto iPod automatically - Windows
Choosing the update option "Sync Music - Selected playlists" allows you to create a playlist specifically for the iPod and drag the tracks you want into it. If you tire of the list and want to change it, you just add or remove the songs you don't want. The ones you take out out remain in the library to be used some other time if you choose. You can read more about playlists at these links:
iTunes: Creating playlists of your favorite songs
How to create a Smart Playlist with iTunes
Or you can choose to update any or all of the iPods manually and just drag whatever content you want to them: Managing content manually on iPod
It's also possible to have multiple libraries in a single account. To create or access a second (or more) library, hold down the Option key (or Shift key in Windows) when launching iTunes 7. In the resulting dialogue you will get the option to create a new library or navigate to the other Library.
Note: You can only have one Library open at a time and iTunes will default to the last library opened if you don't use the keyboard command to choose one. This can prove tricky when using multiple iPods, if you don't use the keyboard command you can risk syncing to the wrong library:
Using multiple iTunes libraries -Windows
Separate User Accounts
Another option is to create a separate User account for each person on your PC or Mac. Different accounts by definition would give you completely separate libraries. Each account has it's own iTunes folder, Library and iTunes Music folder and you load it with CDs etc just as you did with your original one. The iPod can be set to update however the owner chooses, sync all, manual or sync specific playlists
I don't use Windows so I can't give you a step by step on that one, however I can point you to another web page which should help you out. You can read about Windows user accounts here:
Using Windows XP User Accounts -
Selecting specific records out of the same table with PICS
Post Author: nambi
CA Forum: Formula
I have a Database table in which we have information for our paint codes,
This database when accessed through our will display the types of tests we do for the products we manufacture, we manually enter in these results through the software. When I open up this same table in access I noticed that each test we do is displayed as new entry under the same product, therefore I have several entries for the same product code, and since we have several tests for each I am unable to specifically pull out the data I need.
For example I need to create a data sheet for our customers displaying the bake time for these all our products the Product code (formkey) is listed multiple times but all I need is to record the Bake (TargetAlphaValue) time. Out of this table I will also need to report on the Gloss. If I use the record selection I am only able to display one type of test although I will need to specify other types as well. This is the area I have the problem with,
I have shown in a jpg what I am looking for, would anyone here know how to pull out only the TargetAlphaValue and associate it to the bake and formkey? Then do the same with the Gloss test and pull up the TargetAlphaValue for that it would be of great helpCan you be more precise , please :
- which table stores the people identities ? (I call this one Identity)
- which table gives the class where the student works in (I cal l this one Claa_attendees)
- which table gives the instructor of a class (I call this one Class)
If your issue is that you have one table which stores Itendities , and you need to display Student identity and Instructor Identity, you have to call this table twice in your query , using table aliases . I mean :
Select Stud_iden.name, Instr_iden.name
From Identity Stud_iden, Identity Instr_iden, Class_attendees, Class
Where Class.clas_id = class_attendees.class_id
and class.instructor_id = Instr_iden.people_id
and class_attendees.student_id = Stud_iden.people_id
Is this what you need to do ? -
Selecting two different Names using the same table with same field
Hello,
I am trying to display several fields from different tables. Here are some of the fields that I need: The instructor needs to go after the social.
WESL | ENGR-1101-SW1 | Hinojosa | Ashley | Social | Instructor |
I am using a table where they have the social and I need to get both the student and the instructor. How do I select the instructor when the instructor's id is on a different table. example
CLASS PERSON CLASS_ASSIGN
student_id student_id: name facutly_id
Here is the code that I have so far and it works.
rem ----------------
rem Filename: cer.sql
rem Purpose: to get data from banner and put into flat file
rem Date: August 17, 2006 4:51 P.M.
rem Author: Robert Hernandez
rem ---------------
rem Notes: Need to add the Instructor - having problems
rem using the same spriden_id.
rem Also need to have admissions enter the grad date for
rem several students: Procedure is working as is.
declare
l_output utl_file.file_type;
grad_month varchar2(2);
buffer varchar2(1000);
cursor cursor1 is
select ssrmeet_bldg_code,
ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_seq_numb,
spriden_last_name,
spriden_first_name,
spriden_id,
scbcrse_title,
ssbsect_term_code,
sfrstcr_grde_code,
sorhsch_graduation_date,
decode(substr(sorhsch_graduation_date,4,3),'JAN','01',
'FEB','02',
'MAR','03',
'APR','04',
'MAY','05',
'JUN','06',
'JUL','07',
'AUG','08',
'SEP','09',
'OCT','10',
'NOV','11',
'DEC','12') as grad_month,
sorhsch_sbgi_code
from ssbsect,ssrmeet,sfrstcr,spriden,scbcrse,sorhsch
where rownum < 200
and ssbsect_seq_numb like 'S%'
and (ssrmeet_term_code = ssbsect_term_code
and ssrmeet_crn = ssbsect_crn)
and (ssbsect_crn = sfrstcr_crn
and sfrstcr_pidm = spriden_pidm
and length(spriden_id) = 9
and substr(spriden_id,1,1) <> 'A')
and (ssbsect_crse_numb = scbcrse_crse_numb
and ssbsect_subj_code = scbcrse_subj_code)
and spriden_pidm = sorhsch_pidm
and sorhsch_graduation_date is null
order by ssbsect_crse_numb;
begin
l_output := utl_file.fopen('CER','rbfpce.txt','W');
for cur1_rec in cursor1 loop
buffer:= cur1_rec.ssrmeet_bldg_code||'|'||
cur1_rec.ssbsect_subj_code||'-'||
cur1_rec.ssbsect_crse_numb||'-'||
cur1_rec.ssbsect_seq_numb||'|'||
cur1_rec.spriden_last_name||'|'||
cur1_rec.spriden_first_name||'|'||
substr(cur1_rec.spriden_id,1,3)||'-'||
substr(cur1_rec.spriden_id,4,2)||'-'||
substr(cur1_rec.spriden_id,6,4)||'|'||
cur1_rec.scbcrse_title||'|'||
cur1_rec.ssbsect_term_code||'|'||
cur1_rec.sfrstcr_grde_code||'|'||
'20'||SUBSTR(cur1_rec.sorhsch_graduation_date,8,2)||
cur1_rec.grad_month||'|'||
cur1_rec.sorhsch_sbgi_code;
utl_file.put_line(l_output,buffer,false);
end loop;
utl_file.fclose(l_output);
exception
when no_data_found then
utl_file.fclose(l_output);
end;
/Can you be more precise , please :
- which table stores the people identities ? (I call this one Identity)
- which table gives the class where the student works in (I cal l this one Claa_attendees)
- which table gives the instructor of a class (I call this one Class)
If your issue is that you have one table which stores Itendities , and you need to display Student identity and Instructor Identity, you have to call this table twice in your query , using table aliases . I mean :
Select Stud_iden.name, Instr_iden.name
From Identity Stud_iden, Identity Instr_iden, Class_attendees, Class
Where Class.clas_id = class_attendees.class_id
and class.instructor_id = Instr_iden.people_id
and class_attendees.student_id = Stud_iden.people_id
Is this what you need to do ? -
Web Analysis : populate the same table with multiple data sources
Hi folks,
I would like to know if it is possible to populate a table with multiple data sources.
For instance, I'd like to create a table with 3 columns : Entity, Customer and AvgCostPerCust.
Entity and Customer come from one Essbase, AvgCostPerCust comes from HFM.
The objective is to get a calculated member which is Customer * AvgCostPerCust.
Any ideas ?
Once again, thanks for your help.I would like to have the following output:
File 1 - Store 2 - Query A + Store 2 - Query B
File 2 - Store 4 - Query A + Store 4 - Query B
File 3 - Store 5 - Query A + Store 5 - Query B
the bursting level should be give at
File 1 - Store 2 - Query A + Store 2 - Query B
so the tag in the xml has to be split by common to these three rows.
since the data is coming from the diff query, and the data is not going to be under single tag.
you cannot burst it using concatenated data source.
But you can do it, using the datatemplate, and link the query and get the data for each file under a single query,
select distinct store_name from all-stores
select * from query1 where store name = :store_name === 1st query
select * from query2 where store name = :store_name === 2nd query
define the datastructure the way you wanted,
the xml will contain something like this
<stores>
<store> </store> - for store 2
<store> </store> - for store 3
<store> </store> - for store 4
<store> </store> - for store 5
<stores>
now you can burst it at store level. -
How do I search for overlapping polygons in the same table?
I have a table of approxiimately 1200 polygons. How can I find the records where there is an overlap between any of these polygon records? I'm using oracle Spatial 11g R2.
Hi,
use
SDO_GEOM.RELATE
reference link: SDO_GEOM Package (Geometry)
hope this helps.
Regards, -
Updating values with in the same table for other records matching conditions
Hi Experts,
Sorry for not providing the table structure(this is simple structure)
I have a requirement where i need to update the columns of a table based on values of the same table with some empid and date match. If the date and empid match then i have take these values from other record and update the one which is not having office details. I need the update query
Before update my table values are as below
Sort_num Emp_id office start_date
1 101 AUS 01/01/2013
2 101 01/01/2013
3 101 15/01/2013
4 103 USA 05/01/2013
5 103 01/01/2013
6 103 05/01/2013
7 104 FRA 10/01/2013
8 104 10/01/2013
9 104 01/01/2013
After update my table should be like below
Sort_num Emp_id office start_date
1 101 AUS 01/01/2013
2 101 AUS 01/01/2013
3 101 15/01/2013
4 103 USA 05/01/2013
5 103 01/01/2013
6 103 USA 05/01/2013
7 104 FRA 10/01/2013
8 104 FRA 10/01/2013
9 104 01/01/2013
Thanks in advanceI do not have time to create the table with data but basically you should be able to code the following
update table a
set office = ( select office from table b where b.emp_id = a.emp_id
and b.start_date = a.start_date
and b.office is not null
where exists ( [same query as in set] )
and a.office is null
I believe that will do the trick.
HTH -- Mark D Powell -- -
Data of column datatype CLOB is moved to other columns of the same table
Hi all,
I have an issue with the tables having a CLOB datatype field.
When executing a simple query on a table with a column of type CLOB it returns error [POL-2403] value too large for column.
SQL> desc od_stock_nbcst_notes;
Name Null? Type
OD_STOCKID N NUMBER
NBC_SERVICETYPE N VARCHAR(40)
LANGUAGECODE N VARCHAR(8)
AU_USERIDINS Y NUMBER
INSERTDATE Y DATE
AU_USERIDUPD Y NUMBER
MODIFYDATE Y DATE
VERSION Y SMALLINT(4)
DBUSERINS Y VARCHAR(120)
DBUSERUPD Y VARCHAR(120)
TEXT Y CLOB(2000000000)
NBC_PROVIDERCODE N VARCHAR(40)
SQL> select * from od_stock_nbcst_notes;
[POL-2403] value too large for column
Checking deeply, some of the rows have got the data of the CLOB column moved in another column of the table.
When doing select length(nbc_providercode) the length is bigger than the datatype of the field (varchar(40)).
When doing substr(nbc_providercode,1,40) to see the content of the field, a portion of the Clob data is retrieved.
SQL> select max(length(nbc_providercode)) from od_stock_nbcst_notes;
MAX(LENGTH(NBC_PROVIDERCODE))
162
Choosing one random record, this is the stored information.
SQL> select length(nbc_providerCode), text from od_stock_nbcst_notes where length(nbc_providerCode)=52;
LENGTH(NBC_PROVIDERCODE) | TEXT
-------------------------+-----------
52 | poucos me
SQL> select nbc_providerCode from od_stock_nbcst_notes where length(nbc_providerCode)=52;
[POL-2403] value too large for column
SQL> select substr(nbc_providercode,1,40) from od_stock_nbcst_notes where length(nbc_providercode)=52 ;
SUBSTR(NBC_PROVIDERCODE
Aproveite e deixe o seu carro no parque
The content of the field is part of the content of the field text (datatype CLOB, containts an XML)!!!
The right content of the field must be 'MTS' (retrieved from Central DB).
The CLOB is being inserted into the Central DB, not into the Client ODB. Data is synchronized from CDB to ODB and the data is reaching the client in a wrong way.
The issue can be recreated all the time in the same DB, but between different users the "corrupted" records are different.
Any idea?939569 wrote:
Hello,
I am using Oracle 11.2, I would like to use SQL to update one column based on values of other rows at the same table. Here are the details:
create table TB_test (myId number(4), crtTs date, updTs date);
insert into tb_test(1, to_date('20110101', 'yyyymmdd'), null);
insert into tb_test(1, to_date('20110201', 'yyyymmdd'), null);
insert into tb_test(1, to_date('20110301', 'yyyymmdd'), null);
insert into tb_test(2, to_date('20110901', 'yyyymmdd'), null);
insert into tb_test(2, to_date('20110902', 'yyyymmdd'), null);
After running the SQL, I would like have the following result:
1, 20110101, 20110201
1, 20110201, 20110301
1, 20110301, null
2, 20110901, 20110902
2, 20110902, null
Thanks for your suggestion.How do I ask a question on the forums?
SQL and PL/SQL FAQ -
can i create additional apple id's using the same email address for using multiple products with iCloud?
Hi Anne,
I'm pretty sure different eMail addies are needed for different Apple IDs. -
I have an iCloud email address on my iMac. How can I create an icloud email address for my wife on the same computer?
If all you want is an additional email address you can create up to three 'email aliases' - these are additional addresses (not accounts) which deliver into the same inbox as the main account.
You should be aware before you start that once you've created an alias you cannot turn that address into a full iCloud account, move it to another account, or reactivate it if you delete it.
More information on aliases here:
http://help.apple.com/icloud/#mm6b1a490a
If you want to keep her email separate from yours she will need to create a new Apple ID, and use it to create a new iCloud account either on a separate computer or on a separate User Account on your Mac. -
Instead of creating new resource, recon is updating the same resource object for a user
Hi,
I created a DB target recon in OIM 11g. I ran recon and it created resource object. Resource is visible in Accounts tab.Now, I added one more entry with different description in DB. I ran the recon again. This time, instead of creating new resource object, recon linked it the same user with same resource object.
My requirement is to create as many resource object as there are entries in DB table. The recon should not link all DB entries with same resource object in IDM. For every entry in DB, recon should create that many resource objects in accounts tab of user.
Please let me know how to achieve the same.
Regards,
Kalpana.Hint is : Verify Reconciliation Key field mapping in Process definition
Thanks,
Pallavi -
I have created a form which needs to be completed once a week for 6 weeks. On completing week 1, weeks 2 - 6 are completed at the same time with week 1 information. please help?
Hello, thanks for replying.
Yes they just copy to the next page, the fields are the same. The document is an observation to school lessons so it needs to be consistent but with different data on.
Maybe you are looking for
-
How do I maintain control of my form?
This is a bit "wordy", but here is the scoop. I'm using Microsoft Visual Studio for VC++ in Windows 2000. I made an application which had no form in it. So when I ran the application, I just got a DOS box that showed some progress info. I then decide
-
Cannot connect to the itunes store following update of itunes
Have just updated my itunes on my Windows 7 (64 bit) computer. Now I cannot connect to the itunes store. Have checked firewall settings, all OK. My daughters computer (also windows 7 64 bit) is still working OK, but HAS NOT got the latest version of
-
Short Dump with Fetch in ECC 6.0
Hello Friends, I have a query sth like this. <b>fetch next cursor wc_cursor into table it_bdi_entry package size s_pkg.</b> it_bdi_entry is a internal table of type bdi_entry. When i use this fetch statement in ECC 6.0 and the fetch
-
How to use LKM sql Incremetal update
Hi , I am using ODI to intergrate the SQL server database to Oracle. I have created interface where it selects all the records and puts in to Staging area (Oracle). I want to have only daily incements to add to the staging stable (initial full load)
-
Can we Open Period at one time for all entity
Hi Environment: 11.5.10 Is it possible to open period for all the legal entities at single click like R12. Any alternative?