Comparing data, different datasources, output results
Hi All,
I have two datasources, 1 contains "strHRimage","strImage"
and 2nd contains "strHRimage".
I want to be able to compare the 2nd datasource "strHRimage"
values with the 1st datasource "strHRimage" values and output the
compared "strImage" values from the 1st datasource
strHRimage is a hi res image
strImage is a low res image
I'm afraid all my efforts have not worked, any examples would
be greatfully received.
Regards
Trevor
Yes, the key is "key"...sorry for the pun.
The best way (that I know of) is to create 2 arrays--assuming
that the keys are numeric--and comparing the 2 arrays. That way,
it's only 2 SELECT queries to the DB and then CF processes
comparision.
For ex,
Query #1:
arrayfirst[1] = John
arrayfirst[2] = Mary
arrayfirst[3] = Larry
...where 1,2,3 are keys from 1st query
Query #2:
arraysecond[1] = Ken
arraysecond[2] = Mary
arraysecond[3] = Larry
...where 1,2,3 are keys from 2nd query
Then compare...
Similar Messages
-
Comparing data in different resultsets
Hi everybody!
I am working on an web application involving some EAI, as a requirement i need to compare data from two different sources (databases to be precise) and fill a XML based on certain rules. I wish to know if there is a way to compare two ResultSet objects (with almost similar data) directly, or the only way to do is compare each value seperately.
Also please suggest from efficiency point of view if its viable to store data from resultSet to a certain struc kind of object and then comparing, as it would involve lots of overhead compared to directly comparing the two resultsets.
TIA
Abhisheki have to compare various columns of each row and assign flags in output xml as to note if data is inconsistant, though i am taking measures so as to get the rows in the same order in both result sets, but the primary purpose of this comparison is indeed to check data integrity between both the sources.
-
How to compare data from 2 different time periods
Hi folks,
I have a question on approach to a problem. I want to be able to compare data from a common db, but for 2 different time periods. For example I want to see the number of occurences of an instance in my data for today and compare it against occurences a week ago today. What's the best approach for this kind of problem? Is this done with 2 separate queries from 2 sub reports and then compared some how? Any comments on this approach or an other are appreciated.
TIA bvdFollow these steps:
1) Bring your first time period in your main report. This will be your first query.
2) Bring your second time period in a subreport. This will be your second query.
3) Bring the values from your subreport into your main report using shared variables.
4) Lastly, compare the results using formulas in your main report.
I hope this information proves useful.
Regards,
Zack H. -
Best way to compare data of 2 tables present on 2 different servers
Hi,
We are doing data migration and I wil like to compare data between 2 tables which are present on 2 different server. I know to find the difference i can go for minus or full outer join and by creating the database link.
But my problem is the volume of the data. The tables under consideration has approximately 40-60 columns and number of rows in each tables are around 60-70 million. Also both the tables are on 2 diffferent servers.
I would like to know
1] What will be the best way to compare the data and print the difference from performance perepective? I know that if I am going for DB links then its will definitely impact the performance as the tables are across 2 different servers.
2] Is it advisable to go for using SQL - PL/SQL for this kind of senario or dump the data in flat files and use C or C++ code to find the difference.
Regards,
AmolCheck this at asktom.oracle.com. Search for "Marco Stefanetti" and follow the few posts between Marco and Tom. As far as your tables being on separate servers, you could consider dumping the data to file and using external table or using CTAS ( create table as select ) to get both tables locally.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2151582681236 -
Table_comparison - how to compare data at a high level
Hi,
I have to do data validation at a high level between two tables that I am loading.
I am trying to use table_comparion transform but the problem is that my target table is at a much lower level than at which I want to compare data. So it has many more columns (both key and data fields) than what I want to compare.
Does the output of query transform ( which I am using as input into table_comparion) be in the exact same format as comparion table? If not, then can somebody suggest me something else.
Or how can I compare output of two query transforms ?
Thanks,
Saurabh BansalDear Saurabh,
Not sure if you have already got the solution to this. If yes please close the thread.
If not, i would suggest you can use the validation rule to compare the two tables and then based on the PASS or FAIL result can check what needs to be done on the output.
Do post back if you have got the solution or you need any furthur help or else close the question.
regards,
Den -
How to call a SP with dynamic columns and output results into a .csv file via SSIS
hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales from previous
days. For example, Previous day, customers have purchased 20 products but today , 30 products have been purchased.
Right now, on SSMS, I am able to execute this SP when supplying a parameter. What I want to achieve here is to automate this process and send the result as a .csv file and SFTP to a server.
SFTP part is kinda easy as I can call WinSCP with proper script to handle it. How to export the result of a dynamic SP to a .CSV file?
I've tried
EXEC xp_cmdshell ' BCP " EXEC xxxx.[dbo].[ResultsWithDynamicColumns ] @dateFrom = ''2014-01-21''" queryout "c:\path\xxxx.dat" -T -c'
SSMS gives the following error as Error = [Microsoft][SQL Server Native Client 10.0]BCP host-files must contain at least one column
any ideas?
thanks
Hui
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --Hey Jakub, thanks and I did see the #temp table issue in our 2008R2. I finally figured it out in a different way... I manage to modify this dynamic SP to output results into
a physical table. This table will be dropped and recreated everytime when SP gets executed... After that, I used a SSIS pkg to output this table
to a file destination which is .csv.
The downside is that if this table structure ever gets changed, this SSIS pkg will fail or not fully reflecting the whole table. However, this won't happen often
and I can live with that at this moment.
Thanks
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN -- -
Data Mismatch in MTM Results page Vs SSRS Report
Hi,
Data found to be different from MTM results page to SSRS page. Few asked me wait for some time as it may get delayed 2-24 hrs to get updated with Data WareHouse. I waited for 3 days and the difference remains.
In the results page in MTM it shows higher no. of Passed Test Cases than what it's showing in the default SSRS report
MTM - VS TFS 2013
Any help is appreciated.
Regards,
TFS QueriesHi TFSQ,
Thanks for your post.
You’re using TFS 2013 Update 4 and VS 2013 Update 4?
Your current team project created using which default TFS 2013 process template?
What’s the detailed result page in your MTM, and you compared the result with which team project SSRS report?
These two reports worked fine in your team project before? And this same issue also happened in other team projects or not?
Please share your screenshots here, it will help us provide the better response.
Additionally, please manually process your TFS Warehouse and Cube, ensure can process successfully.
https://msdn.microsoft.com/en-us/library/ff400237.aspx.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi there. I have a problem with sound on my 4s. When you move the volume slider up, it sounds well. But when I move the volume slider down I will hear barely and unclear sound in my headphone.I tried different headphones but result is same as old one.Help
Try A and B
(A) Restart iPad
1. Hold down the Sleep/Wake button until the red slider appears.
2. Drag the slider to turn off iPad.
3. Turn iPad back on, hold down the Sleep/Wake until the Apple logo appears
(B) Reset iPad
Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
Note: Data will not be affected. -
Using different datasources and different view objects.. (ADF 11g)
In our application we have the need for using two different datasource (an old version and a new verision) - but not at the same time.
Isn't it possible to base a viewobject on top of two sub viewobjects and run time decide which sub viewobject to use?
If possible - could someone please show some code examples?
Thanks...Hi,
no, not exactly. You can have polymorphic views, but the use case is a different. The transaction is maintained by the AM, so if you want to connect to different data sources then you have to connect to them when starting the application, For this you can configure it for dynamic JDBC connect
Frank -
Outputting Results in a single row from a Table
Afternoon folks,
I have a scenario in hand and I was hoping to get some pointers. I could write a PL/SQL program and all would be fine. I was hoping if there was a way to do it in SQL and not have to create a whole new sub-program for this. I already have a PL/SQL program that populates a table. I want to use that data now and output it in a certain manner.
Any help is greatly appreciated and this is not something I need to solve by tonight. :)
Script to create table and insert records into it:
drop table FLIGHT_ROUTES;
CREATE TABLE FLIGHT_ROUTES
(FLIGHT_NO VARCHAR2(7),
ROUTE_ID NUMBER,
DAY_OF_OPERATION NUMBER,
ORIGIN VARCHAR2(3),
DESTINATION VARCHAR2(3),
STOPVER VARCHAR2(3),
ROUTE_TYPE VARCHAR2(1)
REM INSERTING into FLIGHT_ROUTES
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,1,'SFO','LAX',null,'D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,2,'SFO','LAX',null,'R'); -- Record 2
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,1,'SFO','JFK',null,'D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,2,'SFO','JFK','ORD','D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,3,'SFO','JFK','DEN','R'); -- Record 5
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,1,'LAX','JFK','YYZ','D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,2,'LAX','JFK','YYC','D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,3,'LAX','JFK','YUL','D');What I would like to do is output the results by Flight Number, Origin1, Destination1, Origin2, Destination 2 and Origin 3, Destination 3. The maxium number combinations per Flight is 3. The other condition is that the listing should only show the Origin and Destinations and Stopover if it's a Day time Flight. If its a Red Eye, then don't show that option. So, Record 2 would be completely omitted here as it's a Red Eye flight and Record 5 would be omitted for Origin/Destination/Stopover 3 for flight UX-2001.
Flight_No Origin1 Destination1 Stopover 1 Origin2 Destination2 Stopver2 Origin3 Destination3 Stopover3
============================================================================================================================================================
UX-1001 SFO LAX
UX-2001 SFO JFK SFO JFK ORD
UX-3001 LAX JFK YYZ LAX JFK YYC LAX JFK YULEdited by: Roxyrollers on Sep 9, 2011 3:59 PM
Edited by: Roxyrollers on Sep 9, 2011 3:59 PM
Edited by: Roxyrollers on Sep 9, 2011 4:00 PMHi,
Assuming that day_of_operation is what determines whether a row is 1, 2 or 3:
WITH got_r_num AS
SELECT f.*
, ROW_NUMBER () OVER ( PARTITION BY flight_no
ORDER BY day_of_operation
) AS r_num
FROM flight_routes f
WHERE route_type != 'R'
SELECT flight_no || ',' ||
MAX (CASE WHEN r_num = 1 THEN origin END) || ',' || -- Origin 1
MAX (CASE WHEN r_num = 1 THEN destination END) || ',' || -- Destination 1
MAX (CASE WHEN r_num = 1 THEN stopver END) || ',' || -- Stopover 1
MAX (CASE WHEN r_num = 2 THEN origin END) || ',' || -- Origin 2
MAX (CASE WHEN r_num = 2 THEN destination END) || ',' || -- Destination 2
MAX (CASE WHEN r_num = 2 THEN stopver END) || ',' || -- Stopover 2
MAX (CASE WHEN r_num = 3 THEN origin END) || ',' || -- Origin 3
MAX (CASE WHEN r_num = 3 THEN destination END) || ',' || -- Destination 3
MAX (CASE WHEN r_num = 3 THEN stopver END) AS csv_text -- Stopover 3
FROM got_r_num
GROUP BY flight_no
ORDER BY flight_no
;Output:
CSV_TEXT
UX-1001,SFO,LAX,,,,,,,
UX-2001,SFO,JFK,,SFO,JFK,ORD,,,
UX-3001,LAX,JFK,YYZ,LAX,JFK,YYC,LAX,JFK,YULThis does not assume that origin1 is always on the same row with day_of_operation=1. Origin1 will be from the row with the lowest day_of_operation, not counting red-eyes. Likewise, origin2 will be from the row with the 2nd lowest day_of_operation, whether that value is 2 or not.
If your data is such that the row with day_of_operation=n will necessarily be the nth lowest one, not counting red-eyes, then you don't need the sub-query got_r_num; just use your real table (with the condition WHERE route_type != 'R'), and use day_of_operation where I used r_num. (This is what Solomon's solution, which I just saw, does.)
Edited by: Frank Kulash on Sep 9, 2011 4:47 PM
Edited by: Frank Kulash on Sep 9, 2011 4:53 PM -
Hello, I am trying to compare data from one and the same table. In short I have:
NAME DTM CHARGE
Atanas 8/18/2012 9:33:23 AM 100
Atanas 8/18/2012 9:33:23 AM 101
Niki 8/18/2012 9:33:43 AM 200
Niki 8/17/2012 9:34:10 AM 100
Niki 8/18/2012 9:33:43 AM 201
Niki 8/17/2012 9:34:10 AM 101
Atanas 8/17/2012 9:34:29 AM 50
Atanas 8/17/2012 9:34:29 AM 51
Joro 8/18/2012 12:10:12 PM 400
Joro 8/17/2012 12:10:21 PM 300
Joro 8/18/2012 12:10:12 PM 401
Joro 8/17/2012 12:10:21 PM 301
And I want to sum CHARGE for each DTM for each NAME and present the difference in an additional column, the output should be like that:
NAME DTM CHARGE DTM CHARGE DIFFERENCE
Atanas 8/17/2012 9:33:23 AM 101 8/18/2012 9:33:23 AM 201 - 100
Niki 8/17/2012 9:33:23 AM 201 8/18/2012 9:33:23 AM 401 - 200
Joro 8/17/2012 9:33:23 AM 601 8/18/2012 9:33:23 AM 801 200
the DTM will be always /sysdate - 2/ and /sysdate - 1/,
Thanks in advance!It is not clear what you are trying to do, but it looks like:
with sample_table as (
select 'Atanas' name,to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am') dtm,100 charge from dual union all
select 'Atanas',to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),200 from dual union all
select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),100 from dual union all
select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),201 from dual union all
select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),50 from dual union all
select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),51 from dual union all
select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),400 from dual union all
select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),300 from dual union all
select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),401 from dual union all
select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),301 from dual
select nvl(s1.name,s2.name) name,
s1.dtm,
s1.charge,
s2.dtm,
s2.charge,
s2.charge - s1.charge diff
from (
select name,
dtm,
sum(charge) charge
from sample_table
where dtm >= trunc(sysdate) - 1
and dtm < trunc(sysdate)
group by name,
dtm
) s1
full join
select name,
dtm,
sum(charge) charge
from sample_table
where dtm >= trunc(sysdate)
and dtm < trunc(sysdate) + 1
group by name,
dtm
) s2
on s1.name = s2.name
NAME DTM CHARGE DTM CHARGE DIFF
Atanas 17-AUG-12 101 18-AUG-12 201 100
Niki 17-AUG-12 201 18-AUG-12 401 200
Joro 17-AUG-12 601 18-AUG-12 801 200
SQL> SY. -
Different templates with different datasource files
Hi All,
Can someone tell me how we can have two different templates with different datasource files in one BIP report.
I need PDF template based on one xml file and CSV teamplate based on another in one report.
Thanks.you can have two data-set or query , and select concatenated data and have a single xml file.
But pdf template will look at those, dataset in the xml, which you want. and CSV will look only on the other dataset.
what method are you using for CSV ? -
Comparing data from two tables
My PL/SQL is very limited, however, I need to write some code that compares data stored in two different Oracle tables and then writes the differences to a third table. Both tables have primary keys that I will use to ensure I am comparing like for like. These tables could be large.
Any help on the best way to do this, or any code examples would be very appreciated.One fairly efficient way of doing this is with set operators. The following code is untested - but looks right ;). It also assumes you want to know the provenance of the rows; if not, just zap the literal from each SELECT statement.
INSERT INTO diff_tab SELECT * FROM
( (SELECT 'tab1nottab2' AS provenance, t1.col1, t1.col2 FROM tab1 t1
MINUS
SELECT 'tab1nottab2', t2.col_a, t2.col_b FROM tab2 t2)
UNION ALL
(SELECT 'tab2nottab1', t2.col_a, t2.col_b FROM tab2 t2
MINUS
SELECT 'tab2nottab1', t1.col1, t1.col2 FROM tab1 t1)
/Cheers, APC -
How to compare date which is greatest date
iam new to sql
how to compare date which date is greatest date with example
can i use to_char to compare date
SELECT eno, ename, GREATEST (TBLE.MAX1, TBLE.MAX2) recent_date "
FROM (SELECT TBLA.eno, TBLA.ename, "
MAX (TO_CHAR (TBL.date1, 'MM/DD/YYYY HH24:MI') "
) MAX1, "
MAX (TO_CHAR (TBL.date2, 'MM/DD/YYYY HH24:MI') "
) MAX2 "
FROM dual TBL, dual2 TBLA
in above query if any one of the date having null value then recent_date is showing 'null'
and also it showing wrong value
example
date1='08-22-2009' and date2='01-23-2010' then it showing wrong recent_datel ike='08-22-2009'
as according my knowledge it is comparing with month it sholud not be like this wat i have to do pls explain with example my o/p should come for recent_date like =''01-23-2010''
Edited by: user9112274 on Aug 27, 2010 5:31 AMHi,
there are numerous ways to compare dates, i give you some examples:
with data_Sample as
(select to_date('01-jan-2001','dd-mon-yyyy') d1, to_date('01-mar-2002','dd-mon-yyyy') d2, to_date('03-feb-2002','dd-mon-yyyy') d3 from dual)
select greatest(d1,d2,d3) from data_Sample
GREATEST(D1,D2,D3)
3/1/2002
with data_Sample as
(select to_date('01-jan-2001','dd-mon-yyyy') d1 from dual union all
select to_date('01-mar-2002','dd-mon-yyyy') from dual union all
select to_date('03-feb-2002','dd-mon-yyyy') from dual)
select max(d1) from data_Sample
MAX(D1)
3/1/2002
declare
d1 date :=to_date('01-jan-2001','dd-mon-yyyy');
d2 date :=to_date('01-jan-2001','dd-mon-yyyy');
begin
if d1>d2 then
dbms_output.PUT_LINE('d1 greater than d2');
else
dbms_output.PUT_LINE('d1 less or equql than d2');
end if;
end;
output:
d1 less or equal than d2now concerning your question:
>
can i use to_char to compare date
>
If you have date data types : don't convert them.
if you have no choice, use something like:
if to_char(d1,'YYYYMMDD') > to_char(d2,'YYYYMMDD') then
else
end if;Take care when you convert a date into a char format it becomes string comparison (with all it implies) (It's the reason why i've use an explicit mask format). -
How to compare dates using javascript?
Hi,
I have to compare dates using javascript. The dates are in format "mm/dd/yy" for eg "10/09/06".
I have written a script to compare the dates but the problem I 'm facing is with the year.
For example if I compare "10/09/06" with "10/04/98", then "10/04/98" is coming out to be greater than "10/09/06" because it is considering year "98" to be greater than "06".
Please advice/suggest.
Thanks in advance...Dude, you're here in a Java forum, not in a Javascript forum. Those are two entirely different languages.
The answer in Java is to use java.text.SimpleDateFormat to convert String to Date and use java.util.Date and/or java.util.Calendar to compare dates.
Maybe you are looking for
-
Removing item from iTunes library AND computer
Under the "Help" search for the topic on iTunes 11 it says: "3. Do one of the following: Remove the item only from your iTunes library: Click Keep File. Delete the item from your computer: Click Move to Trash. The item is removed the next time you em
-
Problem with itunes and iphone
Hello, Well, I have a problem: A few days ago I upgraded iTunes to the latest version, and since then the program has stopped me in August to sync with your phone. That is, it performs the synchronization process, but does it very quickly and not mak
-
ICal won't recognize calendars in a calendar group
First - I do not use the cloud, everything is stored on my local hardDisk Second - the problem is only with iCal. Other programs can see calandars within calendar groups just fine. Third and most importantly - I apologize in advance for misspelling c
-
My screen is white, why?
I was charging my IPod Touch and when I tried to use it the screen turned white. None of my applications are showing. What happened? I only have a blank white screen?
-
Sure hope someonce can help. When I connet my Curve to the Desktop Manager I get the following error: Problem signature: Problem Event Name: APPCRASH Application Name: Rim.Transcoder.exe Application Version: 6.1.0.32 Application Timestamp: 4dee0de3