Infoset Query Returns Wrong Data
Hi there exports,
I created a infoset query based on 3 DSO's 0PUR_O01 (Purchase Order Items), 0PUR_DS03 (Purchase Order Item Schedule Line) & a Z-DSO (Material Consumption).
I need information by PO Number (Item, Material) and the total consumption for that material from the Z-DSO irrespective what the item & PO Number is.
My link to Z-DSO is material & plant. My problem is that the info from the orther 2 DSO is triple when I run my query.
Any suggestions?
Thank you
Dirk
Hi,
This issue arrises due to the infoset property, ie. Infoset provides intersection of data.
So for a single combination of material and plant in Z-DSO, there might be multiple (here 3)records in other two DSO so you get the triple amount in Query.
Inorder to overcome it you must ideally join the DSO in a infoset based on the same key fields..
Hope it helps..
Regards..
Umesh.
Similar Messages
-
Report returns wrong data when run on server
Hi,
I'm runing CRS XI R2 on Windows Server 2003 SP2. When I refresh a report in the Crystal Reports XI Designer, I'm getting correct data. But when I schedule the report to run on the server it returns wrong data. The data is different from what I see when I refresh it from the designer. In the report I have running totals set up to count customers that meet a certain criteria. The report is very large. It take almost 2 hours to refresh.
I was wondering what is causing the difference in running total data between refreshing it on the designer and running it on the server. Is it returning wrong data b/c of it not reading all the records? Should I be making any changes to the server settings? I saw that under pageserver, there are options for setting the 'Minutes Before an Idle Report Job is Closed' and 'Database Records To Read When Previewing Or Refreshing a Report". Do either of those have anything to do with the report returning incorrect data when being scheduled to run on the server?
Thanks,
KimHi Xuandao,
You would need to Use Cell Binding and Trigger concept to accomplish this.
Its simple, however, you would have to work on a trial and error basis to understand this concept as implementing the same is subject to your dashboard and WEBI Design.
Open you LiveOffice.
Insert your WEBI, Now, go to Object Properties of your WEBI, select the second tab that says Prompt, Here, it lists the prompts that you have for your WEBI. This would also enlist your BEx variables as well. Select this BEx variable and click on the button that says Prompt at the bottom of this window. Here, select choose Excel Data Range and click on the cell select button on the right (small button that lets you choose what cell you want to bind this prompt to), Now select a free cell that would not be even populated later on when you run the dashboard say A1 (remember the value that you select). Click on OK and again OK. The WEBI Refreshes and you can see all the prompt values at the cell A1. These are all the possible values stored for your BEx prompt variables (these values are fetched from BW system dynamically).
Now, save this LiveOffice, Go to you dashboard. Connect your dashboard to your Live office. Go to Data-> connections-> Now, select the WEBI and in the right hand pane go to Usage tab, here, Click on Trigger cell button on the right hand side and select A1 in you LiveOffice.
It should work fine.
Let me know.
Rgds,
Sreekul Nair -
JSObject returns wrong date. How can I extract correct date from digital signature?
I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and minute are correct, but only day is incorrect.
Here is my code. I'm using Acrobat 8.1.3.
Please tell me what's wrong with this code and how I can extract correct date from digital signatures.
Public Sub sbTest()
Dim oApp As Acrobat.acroApp
Dim oPDDoc As Acrobat.AcroPDDoc
Dim jso As Object
Dim f As Object
Dim sig As Object
Dim strFileName As String
Set oApp = CreateObject("AcroExch.App")
Set oPDDoc = CreateObject("AcroExch.PDDoc")
strFileName = "C:\Test.pdf"
If (oPDDoc.Open(strFileName)) Then
Set jso = oPDDoc.GetJSObject
Set f = jso.getField("Signature1.0")
Set sig = f.signatureInfo()
Debug.Print sig.Name
Debug.Print sig.Date
End If
Call oPDDoc.Close
Call oApp.Exit
End SubHi
You can use TDMS file format to save the data. I have attached a reference Vi.
On button click you can log the data or remove the case structure and continuous log the complete acquisition data.
Thanks and Regards
Himanshu Goyal
Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Attachments:
Data Save in File.vi 35 KB -
Using external parameters within MS Query returning that data right into a pivot table Excel 2010
In Excel 2010 i was able to use the external parameters within MS Query returning that data right into a pivot table. But the parameter on the worksheet will not save in the paremeter setting of the data connection. And if you save it and open
it and try to refresh the pivot table Excel stops responding and you have to force the file closed. I found out the reason to crash is that it did not keep the parameter saved.
Can this be fixed?Hi,
Just
checking in to see if the information of Oskar was helpful. Please
let us know if you would like further assistance.
Jaynet Zhang
TechNet Community Support -
Function sometimes return wrong data
Hi all.
I have a very strange problem with a function. Situation is this: I have an application that handles processes. Each process have a number of steps that is arranged in a matrix like layout. User clicks a step to start/execute it.
Now in a list of current processes i want to have an indication of how "far" a process has reached so i created a function for that and included that in my processlist fetch.
gchs_user_process_steps is the table where the user data for the process step is
gchs_process_steps is the definition table of what steps a process has
gchs_steps is the definition table of all steps
The below function is supposed to return latest step user clicked in the display matrix. tier is used to store the column number and sortorder is the row number of any step user clicked.
CREATE OR REPLACE FUNCTION FN_REACHEDSTEP(p_user_process_id NUMBER)
RETURN VARCHAR IS
ret VARCHAR(30);
ret_id INTEGER;
ret_num INTEGER;
BEGIN
ret := '';
ret_id := 0;
ret_num := 0;
BEGIN
SELECT substr(step_name,1,30),step_id,reached INTO ret,ret_id,ret_num
FROM (
SELECT a.*, rownum rnum
FROM (
SELECT s.name AS step_name, ps.id AS step_id, max((ps.tier*1000)+ps.sortorder) AS reached
FROM gchs_user_process_steps ups, gchs_process_steps ps, gchs_steps s
WHERE ups.gchs_process_step_id=ps.id AND
ps.gchs_step_id=s.id AND
ups.gchs_user_process_id=p_user_process_id
GROUP BY s.name,ps.id
ORDER BY 3 DESC) a
WHERE rownum <= 1 )
WHERE rnum >= 1;
EXCEPTION
WHEN OTHERS THEN
ret:='';
END;
RETURN ret;
EXCEPTION
WHEN OTHERS THEN
ret := '';
RETURN ret;
END FN_REACHEDSTEP;
Now the problem is that the function sometimes return wrong value. The name of the step that is returned is not the one i get if i run the SQL by itself.
So doing a
SELECT substr(step_name,1,30),step_id,reached INTO ret,ret_id,ret_num
FROM (
SELECT a.*, rownum rnum
FROM (
SELECT s.name AS step_name, ps.id AS step_id, max((ps.tier*1000)+ps.sortorder) AS reached
FROM gchs_user_process_steps ups, gchs_process_steps ps, gchs_steps s
WHERE ups.gchs_process_step_id=ps.id AND
ps.gchs_step_id=s.id AND
ups.gchs_user_process_id=21680
GROUP BY s.name,ps.id
ORDER BY 3 DESC) a
WHERE rownum <= 1 )
WHERE rnum >= 1;
and a
select fn_ReachedStep(21680) from dual;
will sometimes return different values.
So is the function fundamentally wrong or is there any cache or something that i've missed that could hold "old" function outputs or am i missing something else.
Thankful for any clues.
I'm using Oracle 10.2.0.1.0
Best regards
/Tomas
Edit: Here's some data that the system uses.
gchs_steps
ID NAME
10000 Step 1
10020 Step 2
10021 Step 3
10022 Step 4
10023 Step 5
10060 Step 6
10140 Step 7
gchs_process_steps
ID GCHS_STEP_ID TIER SORTORDER
10000 10000 0 1
10001 10020 1 1
10002 10021 1 2
10003 10022 2 1
10020 10023 3 5
10060 10060 3 4
10080 10140 3 2
10040 10040 3 3
10100 10160 4 3
10160 10220 4 2
11640 11640 3 1
11660 11660 0 6
11661 11661 0 7
11600 11600 0 4
11620 11620 4 1
gchs_user_process_steps
ID GCHS_USER_PROCESS_ID GCHS_PROCESS_STEP_ID
35541 21680 10002
38441 21680 10020
38440 21680 10000
52062 21680 10060
Relations beween table is
gchs_user_process_steps.gchs_process_step_id=gchs_process_steps.id
and
gchs_process_steps.gchs_step_id=gchs_steps.id
So doing the SQL alone will always return
SUBSTR(..) STEP_ID REACHED
Step 5 10020 3005
but executing the function sometimes returns
FN_REACHEDSTEP(21680)
Step 6
Also removing the rownum limits return and doing a
SELECT s.name AS step_name, ps.id AS step_id, max((ps.tier*1000)+ps.sortorder) AS reached
FROM gchs_user_process_steps ups, gchs_process_steps ps, gchs_steps s
WHERE ups.gchs_process_step_id=ps.id AND
ps.gchs_step_id=s.id AND
ups.gchs_user_process_id=21680
GROUP BY s.name,ps.id,ps.tier, ps.sortorder
ORDER BY 3 DESC
give this result
STEP_NAME STEP_ID REACHED
Step 5 10020 3005
Step 6 10060 3004
Step 3 10002 1002
Step 1 10000 1
Edited by: user4935832 on 2008-sep-19 01:38ORDER BY 3 DESC) a
WHERE rownum <= 1 )
WHERE rnum >= 1;Just some thoughts.
1. You could replace "ORDER BY 3" by "ORDER BY reached"
2. the rownum <=1 and rnum>=1 will return only one row... I don't understand the second one.
Lastly, the difference might come from a duplicate value return by your MAX() function.
If there is two rows (or more) with same MAX, Oracle might return one row arbitrary.
To get the same row, you have to use some aggregation function like MAX() KEEP (DENSE_RANK LAST...).
Here a try for your query, obviously not tested :
SELECT max(substr(step_name,1,30)) keep (dense_rank last order by reached) as step_name,
max(step_id) keep (dense_rank last order by reached,step_name) as step_id,
max(reached) as reached
FROM (SELECT s.name AS step_name,
ps.id AS step_id,
max((ps.tier*1000)+ps.sortorder) AS reached
FROM gchs_user_process_steps ups,
gchs_process_steps ps,
gchs_steps s
WHERE ups.gchs_process_step_id=ps.id
AND ps.gchs_step_id=s.id
AND ups.gchs_user_process_id=21680
GROUP BY s.name,ps.id) a;Nicolas. -
Data driven subscription query returns no data
We have a data driven subscription on SSRS 2008 R2. The columns in the query are tied to one or more parameters of the report. When we run the subscription and if the query does not return any rows, I was hoping that the subscription will not start; however,
instead, to my surprise, I got error stating..."Parameter XYZ value can't be null". How to avoid this error and keep subscription from running in this situation?
Example: I have a report that required employeeID as a parameter. I have a query (step 3: data driven subscription) that fetches employee ID based on some criteria. If there is no row returned by the query; It throws error on report stating "Parameter
EmployeeID can't be null."
Nehal JainHello Nehal -
Try adding a UNION ALL to your parameter dataset query like
UNION ALL SELECT NULL AS EmployeeID , ..
Just check accordingly. I ll revert again based on this , got a priority now.
Happy to help! Thanks. Regards and good Wishes, Deepak. http://deepaksqlmsbusinessintelligence.blogspot.com/ -
Oralce query giving wrong data
Hi all oracle experts :
in oracle backend ( LOV ) user is selecting 'long text' instead of 'short text' and as a result user is getting wrong data Ship_To_Adress ( column ). here what i need is :
Upon data is coming from Long_Text table - it should not bring the wrong data Ship_To address.. It should give no value on the report.
feasibility of modifying query to maintain two Scenarios - Irrespective of Long or Short text - User should not give wrong 'Ship To' address on the pick ticket.
please go through the following query and make necessary changes. thanks in advance for your precious time valuable advice
looking the feasibility of modifying query to maintain two Scenarios - Irrespective of Long or Short text - User should not give wrong 'Ship To' address on the pick ticket.
Thanks in advance
Shiva
SELECT
wpsv.pick_slip_number "Pick Slip #",
wdd.source_header_number "Sales Order #" ,
wdd.source_line_number "Sales Order Line #" ,
nvl(round(ool.unit_selling_price,2),0) "unitsell price" ,
(nvl(round(ool.unit_selling_price,2),0))*nvl(wpsv.primary_qty,0) "Extended sell rice",
'*'||wpsv.transaction_id||'*' "Task ID" ,
wpsv.transaction_id "Task ID#" ,
msi.segment1 "Item",
msi.description "Item Description",
msi.segment1 || ' - ' ||msi.description "Item - Description",
wdd.requested_quantity_uom "UOM",
wdd.serial_number "Serial #",
wnd.delivery_id "Delivery#",
wpsv.from_subinventory "Pick from Sub-inventory",
wpsv.from_subinventory || ' - ' ||
SELECT
segment1||'.'||segment2||'.'||segment3||'.'||segment4
FROM
INV.MTL_ITEM_LOCATIONS
WHERE
inventory_location_id = DECODE(msi.reservable_type,2,wdd.locator_id,wpsv.from_locator_id)
) "Pick From",
SELECT
segment1||'.'||segment2||'.'||segment3||'.'||segment4
FROM
INV.MTL_ITEM_LOCATIONS
WHERE
inventory_location_id = DECODE(msi.reservable_type,2,wdd.locator_id,wpsv.from_locator_id)
) "Pick from Location",
wpsv.to_subinventory "Deliver to Sub-inventory",
select
segment1||'.'||segment2||'.'||segment3||'.'||segment4
from
inv.mtl_item_locations
where
inventory_location_id = wpsv.to_locator_id
) "Deliver to Location",
wpsv.primary_qty "Quantity to be Picked",
party.party_name||CHR(10)||
DECODE(ship_loc.address1, NULL, '',ship_loc.address1||CHR(10))||
DECODE(ship_loc.address2, NULL, '',ship_loc.address2||CHR(10))||
DECODE(ship_loc.address3, NULL, '',ship_loc.address3||CHR(10))||
DECODE(ship_loc.address4, NULL, '',ship_loc.address4||CHR(10))||
DECODE(ship_loc.city, NULL, NULL, ship_loc.city || ', ') || DECODE(ship_loc.state, NULL, NULL, ship_loc.state || ', ') || DECODE(ship_loc.postal_code, NULL, NULL, ship_loc.postal_code || ', ') || DECODE(ship_loc.country, NULL, NULL, ship_loc.country) SHIP_TO_ADDRESS,
NVL(h.shipping_instructions, '-') shipping_instructions,
NVL(h.shipment_priority_code,'-') shipment_priority_code,
NVL(OL.MEANING,'-') "Freight Terms",
NVL(FLV.meaning, '-') shipping_method,
NVL(QQA.quote_attachment, '-'),
RSA.name,
NVL(h.packing_instructions, '-') packing_instructions,
NVL(H.CUST_PO_NUMBER,'-') customer_po#
FROM
apps.oe_order_lines_all ool,
APPS.WSH_PICK_SLIP_V WPSV,
WSH.WSH_DELIVERY_DETAILS WDD,
INV.MTL_SYSTEM_ITEMS_B MSI,
WSH.WSH_DELIVERY_ASSIGNMENTS WDA,
WSH.WSH_NEW_DELIVERIES WND,
APPS.ORG_ORGANIZATION_DEFINITIONS ORG,
WMS.WMS_DISPATCHED_TASKS WDT,
APPS.OE_ORDER_HEADERS_ALL H,
APPS.HZ_CUST_SITE_USES_ALL SHIP_SU,
APPS.HZ_PARTY_SITES SHIP_PS,
APPS.HZ_LOCATIONS SHIP_LOC,
APPS.HZ_CUST_ACCT_SITES_ALL SHIP_CAS,
APPS.HZ_PARTIES PARTY,
APPS.FND_LOOKUP_VALUES FLV,
APPS.OE_LOOKUPS OL,
SELECT
OOH.header_id,
MAX(DECODE(rownum,1, FDST.short_text, ''))||CHR(10)||CHR(10)||MAX(DECODE(rownum,2, FDST.short_text, ''))||MAX(DECODE(rownum,3, FDST.short_text, ''))||CHR(10)||CHR(10)||MAX(DECODE(rownum,4, FDST.short_text, '')) quote_attachment
FROM
APPS.FND_ATTACHED_DOCUMENTS FAD
, APPS.FND_DOCUMENTS_TL FDT
, APPS.FND_DOCUMENTS_SHORT_TEXT FDST
, APPS.FND_DOCUMENTS FD
, APPS.FND_DOCUMENT_CATEGORIES_TL FDC
, APPS.OE_ORDER_HEADERS_ALL OOH
, APPS.ORG_ORGANIZATION_DEFINITIONS OOD
WHERE
OOD.organization_id =?Organization ? AND
OOH.ORDER_NUMBER = ?SO#? AND
OOH.org_id = OOD.operating_unit AND
TO_CHAR(OOH.header_id) = FAD.pk1_value AND
FAD.document_id = FDT.document_id AND
FAD.entity_name = 'OE_ORDER_HEADERS' AND
FDT.media_id = FDST.media_id AND
FDT.language = 'US' AND
FAD.document_id = FD.document_id AND
FD.category_id = FDC.category_id AND
FDC.language = 'US' AND
FDC.user_name ='APS_Pack/AR Invoice/CI/SO Ack Printing'
GROUP BY
OOH.header_id
) QQA
, APPS.RA_SALESREPS_ALL RSA
WHERE
wpsv.move_order_line_id =wdd.move_order_line_id AND
(wdd.source_header_number = ?SO#? ) AND
wdd.inventory_item_id = msi.inventory_item_id(+) AND
wdd.organization_id = msi.organization_id(+) AND
wdd.delivery_detail_id = wda.delivery_detail_id AND
wda.delivery_id = wnd.delivery_id(+) AND
wdd.organization_id = org.organization_id AND
wdt.TRANSACTION_TEMP_ID(+)=wpsv.transaction_id AND
wdt.organization_id (+) =?Organization ? AND
wdd.organization_id =?Organization ? AND
wdd.source_header_number = h.order_number AND
h.salesrep_id = RSA.salesrep_id(+) AND
h.org_id = RSA.org_id(+) AND
h.org_id = org.operating_unit AND
SHIP_PS.party_id = PARTY.party_id(+) AND
H.ship_to_org_id = SHIP_SU.site_use_id(+) AND
SHIP_SU.cust_acct_site_id = SHIP_CAS.cust_acct_site_id(+) AND
SHIP_CAS.party_site_id = SHIP_PS.party_site_id(+) AND
SHIP_LOC.location_id(+) = SHIP_PS.location_id AND
H.shipping_method_code = FLV.lookup_code(+) AND
FLV.lookup_type(+) = 'SHIP_METHOD' AND
FLV.language(+) = 'US' AND
QQA.header_id(+) = TO_CHAR(H.header_id) AND
wpsv.line_status = 'UNPICKED' AND
H.FREIGHT_TERMS_CODE=OL.LOOKUP_CODE(+)
AND OL.LOOKUP_TYPE(+) ='FREIGHT_TERMS' AND
OOL.header_id = wdd.source_header_id(+) AND
OOL.line_id = wdd.source_line_id(+) AND
EXISTS(
SELECT
'Y'
FROM
INV.MTL_ONHAND_QUANTITIES_DETAIL OHQ
WHERE
WDD.inventory_item_id = OHQ.inventory_item_id AND
WDD.organization_id = OHQ.organization_id AND
WPSV.from_subinventory = OHQ.subinventory_code
GROUP BY
'Y'
HAVING
SUM(transaction_quantity) >0
ORDER BY
2, 11, 12, 6, 3Thank you very much indeed for your reply - yes youre right. in oracle backend there are dropdown selections : 1) short text and 2) long text. as per the table user has to select short text so that he will get the correct output , but if by mistake user selects long text then the table is pulling wrong data. so here we need the query to be changed if user selects long text report shouldnt show any data..
i am not sure but as per my little knowledge in oracle i believe that the problem is lying in the folloiwng query line.. please help me out in this regard. i have a screen shots of oralce backend where user is selecting long text / short text but here theres no option of inserting the files...
DECODE(ship_loc.address1, NULL, '',ship_loc.address1||CHR(10))||
DECODE(ship_loc.address2, NULL, '',ship_loc.address2||CHR(10))||
DECODE(ship_loc.address3, NULL, '',ship_loc.address3||CHR(10))||
DECODE(ship_loc.address4, NULL, '',ship_loc.address4||CHR(10))||
DECODE(ship_loc.city, NULL, NULL, ship_loc.city || ', ') || DECODE(ship_loc.state, NULL, NULL, ship_loc.state || ', ') || DECODE(ship_loc.postal_code, NULL, NULL, ship_loc.postal_code || ', ') || DECODE(ship_loc.country, NULL, NULL, ship_loc.country) SHIP_TO_ADDRESS,
Thank you very much once again
Shiva -
Java.util.Calendar returning wrong Date object
Example: This was my scenario last night. A server in California has date/time of 'Mon Aug 18'. Current time in Indiana is 'Sun Aug 17'. I use Calendar.getInstance(TimeZone.getTimeZone("America/Indiana/Indianapolis")) to return a Calendar instance. I then call the getTime() method on that instance. It should return a Date object relating to that particular time zone. It will not. It defaults back to the server time. When I print out the Calendar instance everything is good, correct date, correct time,etc. WHY WON'T THE getTime() return the correct java.util.Date???
Following is the output was run today so the dates happened to be the same so focus on the Time. Output includes Server time, new Calendar values, and the Date returned by calendar instance getTime(). See that the Calendar is getting the correct Time.
SERVER DATE=Mon Aug 18 15:52:13 CEST 2003
CALENDAR INSTANCE=java.util.GregorianCalendar[time=1061214732975,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Indiana/Indianapolis",offset=-18000000,dstSavings=0,useDaylight=false,transitions=35,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=1,ERA=1,YEAR=2003,MONTH=7,WEEK_OF_YEAR=34,WEEK_OF_MONTH=4,DAY_OF_MONTH=18,DAY_OF_YEAR=230,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=8,HOUR_OF_DAY=8,MINUTE=52,SECOND=12,MILLISECOND=975,ZONE_OFFSET=-18000000,DST_OFFSET=0]
Date from getTime()=Mon Aug 18 15:52:12 CEST 2003I got it worked with using DateFormat.parse !
The trick is to instantiate a new Date object as a result
of parsing out of 'localized' date string.
with below code :
Calendar localCal = new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));
localCal.set(Calendar.DATE, 25);
localCal.set(Calendar.MONTH, 7);
localCal.set(Calendar.YEAR, 2003);
localCal.set(Calendar.HOUR_OF_DAY,6);
localCal.set(Calendar.MINUTE, 38);
localCal.set(Calendar.SECOND, 11);
Calendar sinCal = new GregorianCalendar(TimeZone.getTimeZone("Asia/Singapore"));
sinCal.setTimeInMillis(localCal.getTimeInMillis());
int date = sinCal.get(Calendar.DATE);
int month = sinCal.get(Calendar.MONTH);
int year = sinCal.get(Calendar.YEAR);
int hour = sinCal.get(Calendar.HOUR_OF_DAY);
int min = sinCal.get(Calendar.MINUTE);
int sec = sinCal.get(Calendar.SECOND);
String sinTimeString = date + "/" + month + "/" + year + " " + hour + ":" + min + ":" + sec;
System.out.println("VIDSUtil.hostToLocalTime : time string now in SIN time : " + sinTimeString);
java.util.Date sinTime = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse(sinTimeString);
System.out.println("time in SIN using Date.toString(): " + sinTime.toString());
It prints out :
VIDSUtil.hostToLocalTime : time string now in SIN time : 25/7/2003 21:38:11
time in SIN using Date.toString(): Fri Jul 25 21:38:11 PDT 2003
(Ignore the PDT, because Date.toString() defaults where the JVM is running) -
Simple query returns wrong results in Sql 2012
On my Windows 8 box running Sql 2012 11.0.3128, this query returns an IncludeCount of 0 and an ExcludeCount of 1.
On my Windows 7 box running Sql 2008 10.50.2550 this query returns an IncludeCount of 3 and an ExcludeCount of 1, which is correct.
In short, it runs properly on these versions of OS and Sql's:
Windows 2008 R2 + Sql 10.50.2550
Windows 2008 R2 + Sql 10.50.4000
Windows 2012 SP1 + Sql 11.0.3000
Windows 7 + Sql 11.0.2100
And gives incorrect results on these OS's and Sql's (so far, tested):
Windows 8 Enterprise + Sql 11.0.3128
Windows 2008 R2 + Sql 10.50.2550
I wondered if anyone else can reproduce this? I can't figure out the magic combination of OS and SQL version this breaks on.
In all scenarios, the resulting @filters table is populated correctly, and the [Include] column is properly set to a 1 or a 0, so why aren't the other variables being properly set?
If I change the [ID] column to NONCLUSTERED, it works fine, too. It doesn't matter if @filters is a TVP or a temp table or an actual table, same (incorrect) results in each case.
DECLARE @filters TABLE([ID] bigint PRIMARY KEY, [Include] bit)
DECLARE @excludecount int = 0
DECLARE @includecount int = 0
DECLARE @id bigint
INSERT INTO @filters ([ID])
VALUES (1), (3), (4), (-7)
UPDATE @filters SET
@id = [ID],
@includecount = @includecount + (CASE WHEN @id > 0 THEN 1 ELSE 0 END),
@excludecount = @excludecount + (CASE WHEN @id < 0 THEN 1 ELSE 0 END),
[Include] = CASE WHEN @id > 0 THEN 1 ELSE 0 END,
[ID] = ABS(@id)
SELECT @includecount as IncludeCount, @excludecount as ExcludeCount
SELECT * FROM @filtersWhat part is undocumented?
http://technet.microsoft.com/en-us/library/ms177523.aspx
The above link states I can update variables inside an UPDATE statement ...
But it does not say what the correct result of what you are trying to would be. Variable assignment in UPDATE only makes sense if the UPDATE hits one row. If the UPDATE matches several rows, which value you the variable is set to is not defined.
It gets even more complicated when you have the variable on both sides of the expression. But I'd say that the only two values that makes as the final value of @includecount 0. An UPDATE statement, like other DML statements in SQL, is logically defined
as all-at-once. There are no intermediate results. Therefore the only possible values are the initial value of @includecount plus the value of the CASE statement, which always should returns 0, since @id is NULL when the UPDATE statement starts to execute.
I'm afraid that what you have is nonsense from a language perspective, and the result is undefined. Whenever you get different results from a query depending on whether you have certain indexes in place, you know that the query is indeterministic. There
are certainly part of SQL that are indeterministic, for instance ORDER BY on a non-unique columns. But in this particular case you have also wandered out into the land that is also undefined.
I'm not sure what you are trying to achieve, but I can only advice you to go back to the drawing board.
Erland Sommarskog, SQL Server MVP, [email protected] -
SQL query return wrong Windows version
when excuting 'select @@VERSION' returns wrong Windows version. Why?
when excuting 'select @@VERSION' returns wrong Windows version. Why?
SELECT @@VERSION will return SQLServer version and not windows version
Even in case of sql, if you're seeing a different version from what your management studio suggests, then it may be that you're SSMS (client tool) is of another later version whereas the server instance which you're actually connecting to may
be of different (earlier) version.
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 -
Report Query returning "No Data Found" with bind variables
I put a simple query into Report Query:
Select "bluefish". "name" as "name",
"bluefish"."primary_flag" as "primary_flag",
"bluefish"."status" as "status",
"bluefish"."ID" as "ID" from "bluefish" "bluefish" where "bluefish"."ID" = :P3_XPRINTID
When I test the query, data is returned; however, when I try to run the query using "Test Report" button, I get an error 01403 No Data Found. If I replace the bind variable with an explicit value, the report works.
Anyone have any ideas as to what is causing this problem? I am using the Generic Report Layout, with various output types. I AM editting the query and defining the bind variable before I test the report (otherwise, the query wouldn't run).
CharlesSometimes if you create a form/report/whatever using the wizards, it will create an After Submit process called something like Reset Page - basically you want to make sure you don't have any After Submit processes that call a Clear Session state (it may say something like Clear Cache for Page).
In your branch, there is also a box that says Clear Cache - you want to make sure that does not have page Number 8 in it or it will clear your session state.
Put the page in Debug mode and read through it - check to make sure your value is getting saved and maybe you can see what is going wrong. -
Status of data in Bex query shows wrong date
Dear Experts,
The Bex qurey after sucessful execution, show the Status of data as old date i.e. feb 2012. but we observed that the data uplaod happens regularly and sucessful.
we tried executing the same query using RSRT/Bex Analyzer/Portal. the results are same i.e. showing incorrect status of data.
Note: The Bex query is built on BI Infoset which sources from DSOs and Master Data infoobjects, and BI version is 7.0.
Kindly please help for resolving the issue.
Best Regards,
Mannu.Hi Vijay,
The data upload has happend today also and it is sucessful, the reporing status is available for requests from respective infoproviders.
'Status of data' is not a filed. if it an information to tell the status of data in query result.
Please find the following steps to find the 'status of data'
go to RSRT->give the query name and execute-> now after query results-> go to last page-> you can find the 'status of data'.
Best Regards,
Mannu -
Union_all query returns wrong results
I have 6 individual queries that combine together using "union_all". If I run it, it returns 6084 records, see example 1.
Example 1:
sql1
union_all
sql2
unionl_all
sql3
sql6;
if I do it this way, example2, I get only 3821 records. Is there a bug in Oracle 11g? I select everything from 6084 records, I should get them all, correct?
Example 2:
select * from
sql1
union_all
sql2
unionl_all
sql3
sql6
note that I use "union_all" because the computer does not take it without the underscore.user557594 wrote:
Your queries do not deal with thousand of rows. My queries worked ok before the upgrade to 11g. I just want to know if there is a bug related to union all in 11g.If you believe that you are encountering a bug, you really should be posting this over on Metalink (My Oracle Support). When you do, you'll want to specify at a minimum the 4 digit Oracle version you are using (11g could mean either of two major releases and a few different patchsets).
I'm sure if you search My Oracle Support, you'll find at least one bug in whatever version of 11g you're using that occurs when UNION ALL is used (though I'll wager that you need two or three other conditions to be true as well). If you open a ticket, however, Oracle Support can determine whether you are actually encountering an error and/or whether you've encountered any of the published bugs, an unpublished bug, or a new bug. Once you know that, Oracle Support may or may not have a patch for you.
Unfortunately, if you can't post a test case that would allow us to reproduce the problem locally, it's going to be hard for us to provide much assistance. Of course, Oracle Support will also need a reproducible test case, but they can probably help you work through the process of putting one together complete with sample data and a query plan.
Justin -
Strange issue - WD4A when called from EP returns wrong data
Hi Experts,
I am facing a very strange issue with WD4A. I have created one RFC. WD4A program calls this RFC. When I am executing the RFC using se37 it gives me 10 records. When I am executing the same RFC from WD4A program (Web Dynpro Application -- Right Click -
test) the program is returning 10 records.
I have created one iView in Portal. When I am calling the same program from portal, sometimes it returns 9 records and sometimes 10 records. I just refresh the iview and no of records getting displayed in screen changes.
I have cheked the code many times. The code is perfectly fine.
I have used clear and refresh command in the beginigng of RFC.
What may be wrong? I have wasted my full dayfor resolving the issue. But I could not succeed.
Is it due to some BASIS issue? Is it due to some server session issue?
I have used business graphics in my application. Is it due to this? Whether IGS server and ECC contain different data?
Please suggest
Regards,
GaryHi Experts,
The System configuration in the EP is pointing to the right system and right client. I am using same setting for other Iviews. The other iViews are working fine.
How we can apply break point in WDA. I beliveve I have to meet following requirement:
1) Suppose EP user is 4755. The EP user 4755 is mapped to R/3 user 4755 and R/3 pernr 4755.
2) Backend R/3 user 4755 should have se80
3) Backend R/3 user should have debug access.
The authorization will not provide such accesses for backend user 4755.
Do we have any workaround?
Please help.
Regards,
Gary -
Query returning wrong results - Help required.
Hi All,
I am having a query in which I have 10 records, 5 with stop time 1 and 5 with stop time 2.
I have a scenario in which, I need to calculate the maximum,minimum for the records
with stop time 1 and 2.
What I did is, I selected all the 10 records using for loop. Within the loop
I am trying to find the maximum and minimum. It is giving me wrong results.
Please help me. My code is follows
declare
v_p1_min_stop_tm number;
v_p1_max_stop_tm number;
v_p2_min_stop_tm number;
v_p2_max_stop_tm number;
begin
for i in(
select
stop_tm
from
sample_stop
where
map_nbr = 16645 and
stop_dt = '05-sep-08'
)loop
if i.stop_tm = 1 then
select
min(i.stop_tm),
max(i.stop_tm)
into
v_p1_min_stop_tm,
v_p1_max_stop_tm
from
dual;
elsif i.stop_tm = 2 then
select
min(i.stop_tm),
max(i.stop_tm)
into
v_p2_min_stop_tm,
v_p2_max_stop_tm
from
dual;
end if;
end loop;
dbms_output.put_line('minimum p1 stop time : '|| v_p1_min_stop_tm);
dbms_output.put_line('maximum p1 stop time : '|| v_p1_max_stop_tm);
dbms_output.put_line('minimum p2 stop time : '|| v_p2_min_stop_tm);
dbms_output.put_line('maximum p2 stop time : '|| v_p2_max_stop_tm);
end;
My o/p is :
Minimum P1 stop time : 523
Maximum P1 stop time : 523
Minimum P2 stop time : 719
Maximum P2 stop time : 719
Here how can I make the data as two sets, one set with stop time 1 and
other with stop time 2.
Regards
RaghuIf the data type of stop_tm is varchar then try following
declare
v_p1_min_stop_tm number;
v_p1_max_stop_tm number;
v_p2_min_stop_tm number;
v_p2_max_stop_tm number;
begin
for i in(select stop_tm from sample_stop
where
map_nbr = 16645 and
stop_dt = '05-sep-08'
)loop
if i.stop_tm = 1 then
select min(to_number(i.stop_tm)), max(to_number(i.stop_tm))
into v_p1_min_stop_tm,v_p1_max_stop_tm
from
dual;
elsif i.stop_tm = 2 then
select
min(to_number(i.stop_tm)), max(to_number(i.stop_tm))
into
v_p2_min_stop_tm,v_p2_max_stop_tm
from
dual;
end if;
end loop;
dbms_output.put_line('minimum p1 stop time : '|| v_p1_min_stop_tm);
dbms_output.put_line('maximum p1 stop time : '|| v_p1_max_stop_tm);
dbms_output.put_line('minimum p2 stop time : '|| v_p2_min_stop_tm);
dbms_output.put_line('maximum p2 stop time : '|| v_p2_max_stop_tm);
end;
/ Regards
Singh
Maybe you are looking for
-
Could someone tell me alittle about the AbstractDocument please
Hi, hope someone can help, I am making a small internet chat program, and had it working great using JTextArea, but I wanted to style the text, and so switched to JTextPane, and using the AbstractDocument. Here these two code chunks are setting up my
-
The following jsf code isnt displaying my table headers. <h:dataTable rowClasses="list-row" headerClass="tableHeader" width="60%" var="product" value="#{products.products}" border="1">
-
Windows 7 Adobe Air Problems linked to BBC iplayer
For the last month or so I've been having problems downloading BBCiplayer so I tried downloading Adobe AIR on its own and that was fine although iplayer still didn't work so I uninstalled AIR. Anyway today I thought I'd retry my luck and I attempted
-
Hi, I want to test the CM - samples. How can I test the FinanceCorp - Analystreport sample? i did not find any ImageController in the flex-code. regards Johannes
-
Can't connect to X11 windows server
Hi all, I am having problems installing oracle in Fedora Core 1. This is where i'm stuck at and im not sure what to do. Preparing to launch Oracle Universal Installer from /tmp/OraInstall2004-11-24_09-23-44AM. Please wait ...[student@BI GCPU026 Disk1