Getting Inconsistent Query Results
I am getting inconsistent results when trying to filter data based on the DATETIME stamp. Any help will be appreciated.
Here is my table information.
TableA:
SR DATE
15 8/30/2007 9:34:41 AM
16 9/4/2007 1:03:38 PM
17 9/4/2007 2:50:48 PM
18 9/4/2007 3:04:03 PM
19 9/5/2007 11:47:58 AM
20 9/5/2007 12:16:23 PM
21 9/6/2007 3:34:38 PM
22 9/6/2007 3:43:27 PM
23 9/6/2007 3:46:27 PM
24 9/7/2007 10:14:26 AM
25 9/7/2007 10:16:11 AM
26 9/18/2007 1:03:47 PM
27 9/19/2007 9:31:14 AM
28 9/19/2007 9:44:36 AM
29 9/19/2007 4:18:05 PM
30 9/21/2007 10:44:52 AM
Now if I execute this query,
SELECT * FROM TableA WHERE DATE >= '9/3/2007 9:34:41 AM'
Result (Missing all 2 digit dates:
16 9/4/2007 1:03:38 PM
17 9/4/2007 2:50:48 PM
18 9/4/2007 3:04:03 PM
19 9/5/2007 11:47:58 AM
20 9/5/2007 12:16:23 PM
21 9/6/2007 3:34:38 PM
22 9/6/2007 3:43:27 PM
23 9/6/2007 3:46:27 PM
24 9/7/2007 10:14:26 AM
25 9/7/2007 10:16:11 AM
If I change the day in query to 2 digit then I am getting correct results.
SELECT * FROM TableA WHERE DATE >= '9/03/2007 9:34:41 AM'
But If I run this query:
SELECT * FROM TableA WHERE DATE >= '9/05/2007 9:34:41 AM'
Results (Getting all the dates even less than '9/5/2007':
16 9/4/2007 1:03:38 PM
17 9/4/2007 2:50:48 PM
18 9/4/2007 3:04:03 PM
19 9/5/2007 11:47:58 AM
20 9/5/2007 12:16:23 PM
21 9/6/2007 3:34:38 PM
22 9/6/2007 3:43:27 PM
23 9/6/2007 3:46:27 PM
24 9/7/2007 10:14:26 AM
25 9/7/2007 10:16:11 AM
26 9/18/2007 1:03:47 PM
27 9/19/2007 9:31:14 AM
28 9/19/2007 9:44:36 AM
29 9/19/2007 4:18:05 PM
30 9/21/2007 10:44:52 AM
The results are so inconsistent with different combination, I could not figure out the main reason behind this.
The datatype for this field in database is "VARCHAR2(250)" and because of some restrictions, I could not change datatype of this field in the table.
SQL> DESC t;
Name Null? Type
COL VARCHAR2(50)
SQL> SELECT col FROM t ORDER BY col;
COL
8/30/2007 9:34:41 AM
9/03/2007 9:34:41 AM
9/05/2007 9:34:41 AM
9/18/2007 1:03:47 PM
9/19/2007 4:18:05 PM
9/19/2007 9:31:14 AM
9/19/2007 9:44:36 AM
9/21/2007 10:44:52 AM
9/3/2007 9:34:41 AM
9/4/2007 1:03:38 PM
9/4/2007 2:50:48 PM
9/4/2007 3:04:03 PM
9/5/2007 11:47:58 AM
9/5/2007 12:16:23 PM
9/6/2007 3:34:38 PM
9/6/2007 3:43:27 PM
9/6/2007 3:46:27 PM
9/7/2007 10:14:26 AM
9/7/2007 10:16:11 AMThe ones in bold are your predicate "dates". Do you see why it doesn't work as you expect?
John
Similar Messages
-
How to get the query result of improvement (Before and After ) using sql de
how to get the query result of improvement (Before and After ) using sql developer.
Check
http://www.oracle.com/technetwork/articles/sql/exploring-sql-developer-1637307.html -
Inconsistent Query Result in SEM-BCS using Virtual Info Provider
We have just upgraded to BW 7.0 and SEM-BCS 6.0. When we run an existing 3.5 BW query for BCS through the Virtual Info Provider against the basic consolidation cube, we are getting inconsistent results. Sometimes we get the correct result, and other times our results are not rolling up correctly causing an out of balance on our balance sheet query. We did not make any hierarchy changes between the query executions. Has anyone else experienced this? We cannot see the cause of the inconsistency. Everything looks good when running through RSRT DEBUG. Any help on pushing us in the right direction to solve this would be appreciated.
Thanks,
RobHi Rob,
Could you please let me know how you have resolved this issue? Thanks.
Regards,
Ashok -
How to get dynamic query results from an array/structure
I have an edit page that is set up to display phone number fields from the user stored in our database. The properties for the phone number fields are set by a structure of arrays. My problem is that when a user has more than 1 phone number in my database, my structures correctly show this on the form by displaying 2 phone numbers. The problem I am having is that when it shows multiple phone numebrs, it always shows the first result and just repeats it as opposed to dropping the 2nd or 3rd phone number in their respective fields.
array and structure code below:
<!--- Mobile --->
<cfset mobile = StructNew()>
<cfset mobile.dynamic = false>
<cfset mobile.dynamicLabel = '+ Add'>
<cfset mobile.fields = ArrayNew(1)>
<cfif #checkuserv.recordcount# GT '0'>
<cfset mobile.fields[1] = StructNew()>
<cfset mobile.fields[1].required = false>
<cfset mobile.fields[1].label = 'Phone Number 1'>
<cfset mobile.fields[1].displayIcon = false>
<cfset mobile.fields[1].voice = true>
<cfset mobile.fields[1].voiceChecked = true>
<cfset mobile.fields[1].toolTip = "Please choose if you would like to receive a text or voice call on this number">
</cfif>
<cfif #checkuserv.recordcount# IS '2'>
<cfset mobile.fields[2] = StructNew()>
<cfset mobile.fields[2].required = false>
<cfset mobile.fields[2].label = 'Phone Number 2'>
<cfset mobile.fields[2].displayIcon = false>
<cfset mobile.fields[2].toolTip = "Please choose if you would like to receive a text or voice call on this number">
<cfset mobile.fields[2].voice = true>
<cfset mobile.fields[2].voiceChecked = true>
</cfif>
<cfif #checkuserv.recordcount# IS '3'>
<cfset mobile.fields[3] = StructNew()>
<cfset mobile.fields[3].required = false>
<cfset mobile.fields[3].label = 'Phone Number 3'>
<cfset mobile.fields[3].displayIcon = false>
<cfset mobile.fields[3].toolTip = "Please choose if you would like to receive a text or voice call on this number">
<cfset mobile.fields[3].voice = true>
<cfset mobile.fields[3].voiceChecked = true>
</cfif>
Here is the code for my fields that call the array info:
<!--- Voice 1 --->
<cfloop index="i" from="1" to="#ArrayLen(mobile.fields)#">
<cfif i EQ 1 OR NOT mobile.dynamic OR form.mobileDisplayed GTE i>
<cfparam name="form.areacode_#i#" default="">
<cfparam name="form.prefix_#i#" default="">
<cfparam name="form.suffix_#i#" default="">
<div class="fieldBlock phoneBlock" id="phoneBlock#i#">
<label for="areacode_#i#">
<cfif mobile.fields[i].required><span>*</span></cfif>
<cfif mobile.fields[i].displayIcon><img src="/images/sm_phone.jpg" /></cfif>
#mobile.fields[i].label#:
</label>
<div class="inputBlock">
<input type="text" maxlength="3" onKeyUp="numTyped(this, 'prefix_#i#', 3, event)" name="areacode_#i#" id="areacode_#i#" class="areacode" value="#trim(left(checkuserv.sub_user_number, '3'))#" />
<input type="text" maxlength="3" onKeyUp="numTyped(this, 'suffix_#i#', 3, event)" name="prefix_#i#" id="prefix_#i#" class="prefix" value="#trim(mid(checkuserv.sub_user_number, "4", '3'))#" />
<input type="text" maxlength="4" name="suffix_#i#" id="suffix_#i#" class="suffix" value="#trim(mid(checkuserv.sub_user_number, "7", '4'))#" />
<cfif StructKeyExists(mobile.fields[i], "voice") and mobile.fields[i].voice>
<div class="voice" id="voice#i#">
<input type="radio" value="0" name="voice_#i#"<cfif Not StructKeyExists(mobile.fields[i], "voiceChecked") or Not mobile.fields[i].voiceChecked> checked="checked"</cfif> />
<label>Text</label>
<input type="radio" value="1" name="voice_#i#"<cfif StructKeyExists(mobile.fields[i], "voiceChecked") and mobile.fields[i].voiceChecked> checked="checked"</cfif> />
<label>Voice</label>
</div>
</cfif>
<cfif StructKeyExists(mobile.fields[i], "toolTip") and mobile.fields[i].toolTip neq "">
<div class="toolTip" id="toolTip_#i#" title="#mobile.fields[i].toolTip#" onClick="alert('#mobile.fields[i].toolTip#')">?</div>
</cfif>
</div>
<!--- This number was invalid or if geocoding failed, and they've picked a carrier to override, display the carrier override dropdown--->
<cfif ListFindNoCase(invalidMobileIndexList, i) or ( showMap and IsDefined("form.carrierOverride" & i) )>
<div id="carrierOverrideBox#i#" class="carrierOverrideBlock">
<label>Carrier:</label>
<div class="inputBlock">
<select name="carrierOverride#i#" id="carrierOverride#i#">
<option value="-1">-- Pick your carrier --</option>
<cfloop query="carriers">
<!--- 1111 is voice, 0 is NONE, don't display --->
<cfif Not ListFindNoCase("0,1111", carriers.carrier_id)>
<option value="#Trim(carriers.carrier_id)#"<cfif IsDefined("form.carrierOverride" & i) and form["carrierOverride" & i] eq Trim(carriers.carrier_id)> selected="selected"</cfif>>#Trim(carriers.carrier_title)#</option>
</cfif>
</cfloop>
</select>
<a href="http://www.inspironlogisticscontact.cfm?account_id=#account_id#&carrierOverride=1"
title="Carrier help"
onClick="window.open('http://www.inspironlogisticscontact.cfm?account_id=#account_id#&carrierOverride=1','#accou nt_id#','width=500,height=800,scrollbars=no,screenX=100,screenY=100,top=100,left=100,resiz able=1'); return false;"
>?</a>
</div>
</div>
</cfif>
<cfif mobile.dynamic AND i EQ form.mobileDisplayed AND i LT ArrayLen(mobile.fields)>
<div class="dynamicAddBlock dynamicAddMobileBlock" id="dynamicAddmobile_#i#">
<a href="javascript: submitAddField('mobile')">#mobile.dynamicLabel#</a>
</div>
</cfif>
</div>
</cfif>
</cfloop>
<cfif mobile.dynamic>
<input name="mobileDisplayed" id="mobileDisplayed" value="#form.mobileDisplayed#" type="hidden" />
</cfif>
<input name="carrierOverrideActive" id="carrierOverrideActive" value="<cfif carrierOverrideActive>1<cfelse>0</cfif>" type="hidden" />
I have been stuck on this for days, finally turning to the forum today with a few different issues. I hate trying to work within the framwork of other peoples code.
I use coldfusion 8I broke the chunk of code away from the page and am now getting teh phone numbers in the right spots, but I am still getting a coldfusion error.
Element 2 is undefined in a Java object of type class coldfusion.runtime.Array.
Here is my code...
<cfset invalidMobileIndexList = "">
<cfset showMap = false>
<cfset carrierOverrideActive = false>
<!--- Voice 1 --->
<cfloop index="i" from="1" to="#ArrayLen(mobile.fields)#">
<!------> <cfif i EQ 1 OR NOT mobile.dynamic OR form.mobileDisplayed GTE i>
<cfparam name="form.areacode_#i#" default="">
<cfparam name="form.prefix_#i#" default="">
<cfparam name="form.suffix_#i#" default="">
<div class="fieldBlock phoneBlock" id="phoneBlock#i#">
<label for="areacode_#i#">
<cfif mobile.fields[i].required><span>*</span></cfif>
<cfif mobile.fields[i].displayIcon><img src="/images/sm_phone.jpg" /></cfif>
#mobile.fields[i].label#:
</label>
<cfoutput query="checkuserv" ><div class="inputBlock">
<input type="text" maxlength="3" onKeyUp="numTyped(this, 'prefix_#i#', 3, event)" name="areacode_#i#" id="areacode_#i#" class="areacode" value="#trim(left(checkuserv.sub_user_number, '3'))#" />
<input type="text" maxlength="3" onKeyUp="numTyped(this, 'suffix_#i#', 3, event)" name="prefix_#i#" id="prefix_#i#" class="prefix" value="#trim(mid(checkuserv.sub_user_number, "4", '3'))#" />
<input type="text" maxlength="4" name="suffix_#i#" id="suffix_#i#" class="suffix" value="#trim(mid(checkuserv.sub_user_number, "7", '4'))#" />
<cfif StructKeyExists(mobile.fields[i], "voice") and mobile.fields[i].voice>
<div class="voice" id="voice#i#">
<input type="radio" value="0" name="voice_#i#"<cfif Not StructKeyExists(mobile.fields[i], "voiceChecked") or Not mobile.fields[i].voiceChecked> checked="checked"</cfif> />
<label>Text</label>
<input type="radio" value="1" name="voice_#i#"<cfif StructKeyExists(mobile.fields[i], "voiceChecked") and mobile.fields[i].voiceChecked> checked="checked"</cfif> />
<label>Voice</label>
</cfif></div></cfoutput>
<cfif StructKeyExists(mobile.fields[i], "toolTip") and mobile.fields[i].toolTip neq "">
<div class="toolTip" id="toolTip_#i#" title="#mobile.fields[i].toolTip#" onClick="alert('#mobile.fields[i].toolTip#')">?</div>
</cfif>
</div>
<!--- This number was invalid or if geocoding failed, and they've picked a carrier to override, display the carrier override dropdown--->
<cfif ListFindNoCase(invalidMobileIndexList, i) or ( showMap and IsDefined("form.carrierOverride" & i) )>
<div id="carrierOverrideBox#i#" class="carrierOverrideBlock">
<label>Carrier:</label>
<div class="inputBlock">
<select name="carrierOverride#i#" id="carrierOverride#i#">
<option value="-1">-- Pick your carrier --</option>
<cfloop query="carriers">
<!--- 1111 is voice, 0 is NONE, don't display --->
<cfif Not ListFindNoCase("0,1111", carriers.carrier_id)>
<option value="#Trim(carriers.carrier_id)#"<cfif IsDefined("form.carrierOverride" & i) and form["carrierOverride" & i] eq Trim(carriers.carrier_id)> selected="selected"</cfif>>#Trim(carriers.carrier_title)#</option>
</cfif>
</cfloop>
</select>
<a href="http://www.inspironlogistics.com/wens/contact.cfm?account_id=#account_id#&carrierOverride= 1"
title="Carrier help"
onClick="window.open('http://www.inspironlogistics.com/wens/contact.cfm?account_id=#account_id#&carrierOverride= 1','#account_id#','width=500,height=800,scrollbars=no,screenX=100,screenY=100,top=100,left =100,resizable=1'); return false;"
>?</a>
</div>
</div>
</cfif>
<cfif mobile.dynamic AND i EQ form.mobileDisplayed AND i LT ArrayLen(mobile.fields)>
<div class="dynamicAddBlock dynamicAddMobileBlock" id="dynamicAddmobile_#i#">
<a href="javascript: submitAddField('mobile')">#mobile.dynamicLabel#</a>
</div>
</cfif>
</div>
</cfif>
<cfif mobile.dynamic>
<input name="mobileDisplayed" id="mobileDisplayed" value="#form.mobileDisplayed#" type="hidden" />
</cfif>
<input name="carrierOverrideActive" id="carrierOverrideActive" value="<cfif carrierOverrideActive>1<cfelse>0</cfif>" type="hidden" /><!------>
</cfloop> -
How to get the query result !
Experts !
i am working on a query. in this query i have a sales for a sales person for a month, and in the 2nd coulmn sales for the previous month. there is a 3rd column which gives (% change ). now i have to show only those records where (% change ) is more / less 34%. how do i get those ? Exceptions ??
If by using exceptions, then the 3rd column ( % change) is a formula column ( Not the key figure) . can i use exceptions on Formula column ?
Please helpHI ,
You can try this by creating a condition ,
Create a new condition, in keyfigure you can choose the formula for %, choose the operator as Greater than , in values give 34
Regards,
Sathya -
Hi Everyone,
I am trying to get SQL Query Result in e-mail with proper format.
I tired DB mail but result is not in proper format . It's hard to read from attachment.
From Below Query HTML format showing first 3 columns good after that all getting mixed up.
Select Ticktsno,customer_Id,Phone,Open date-time,OpenedBy,Assign_to,Category,Support_level,Incident_type,Description from dbo.query_result.
HTML Code:
if @@ROWCOUNT > 0
begin
declare @emailSubject varchar(100),
@columnHeaders varchar(1000),
@tableHTML nvarchar(max)
select @emailSubject = 'My Results Email',
-- Subject of Email
@columnHeaders = 'tickets</th><th>Customer</th><th>Phone</th><th>Open Date/Time</th><th>OpenedBy</th><th>Assign_To</th><th>Category</th><th>Support_Level</th><th>Incident_Type</th><th>Status</th><th>DEscription'
-- Column headers (must put </th><th> between each header)
set @tableHTML =
'<div><b>My Email Header</b></div><br>' + -- This is the bold text at the top of your email
'<table border="1" cellpadding="5"><font face="Calibri" size=2>' +
'<tr><th>' + @columnHeaders + '</th></tr>' +
convert(nvarchar(max),
SELECT td = Tickets, '',
td = Customer, '',
td = Phone, '',
td = [Open Date/Time], '',
td = OpenedBy, '',
td = Assign_To,
td = Category,
td = Support_Level,
td = Incident_Type ,
td = [Description]
from master.dbo.QueryResult_2000
for xml path('tr'), type))
+'</font></table>'
EXEC msdb.dbo.sp_send_dbmail @recipients='[email protected]',
@subject = 'Query Result',
@body = @tableHTML,
@body_format = 'HTML' ;
end
What changes should make in HTML code to get report in proper HTML format
Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.ShahThanks Uri for kind reply..I was able to edit that script. Script is running fine from SSMS and sending e-mail notification. But When I am running from SQK agent job getting successful but not getting e-mail notification.
I enabled the profile from SQL job properties also.
Any thoughts on this?
Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah
Hi Logicinisde,
According to your description, if you run the scripts in the SSMS, it can send an email with HTML format to your mailbox. When you run this scripts by using SQL Server Agent job, it can show running successfully but you could not get any email. We need to
verify if you select the correct Mail profile. After configuring the alert system, restart the SQL Server Agent service. If you experience any problems sending e-mail notifications through the SQL Server Agent, check the service account that the agent is running.
If the SQL Server Agent is running with one of the built-in accounts like the Local System account, resources outside the SQL Server machine will be unavailable. This includes SMTP mail servers that are on other machines. If this is the case, change the service
account for the SQL Server Agent to a domain account to resolve this issue.
For more information about using Database Mail in SQL Server and using Database Mail with SQL Server Agent, you can review the following articles.
http://www.idevelopment.info/data/SQLServer/DBA_tips/Database_Administration/DBA_22.shtml
http://technet.microsoft.com/en-us/library/ms190606(v=sql.105).aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
How to get the sql query result?
Hi,
Currently I am using LV2012 to connect a Oracle database server. After the installations/settings for Oracle Express and Oracle ODBC driver done.
I am sucessfully to use the SQL command to query the data through my window command prompt.
Now the problem is, how I do the same task in Labview by using the database connectivity toolkits?
I have build a VI for query as attached, but i have no idea what pallete to use to get the query result.
Please help me ~~
Solved!
Go to Solution.
Attachments:
Query.vi 9 KBHere is a piece of code I use to test SQL commands, you can use the part that retrieves sql results.
It is also possible to get the column headers back, but that is for next lesson!
Attachments:
RunSQLCommand.vi 30 KB -
I am wondering if anyone has or knows how to get BW query results in an RSS feed.
I have a pet project to see if I can populate an RSS feed with my P&L out of my CO-PA fed BW. If the results of a query are sitting on the WAS there should be a way to grab them for RSS.....
Anyone....anyone....?
Thanks,
Brianthis is not a OLAP bapi but a custom function which returns the query results in a xml format, may be this could be useful for you.
check out the link.
/people/durairaj.athavanraja/blog/2005/12/05/execute-bw-query-using-abap-part-iii
Regards
Raja -
Storing query results in file server via Information Broadcasting service
Dear Experts,
We use BI7.0.
I want to get the query results as PDF file or Excel file
stored in file server or BW server, EP server by night batch job.
(Not the distribution of query via E-mail.)
BW3.5, I think we can use pre-calculation service for that case.
BW7.0, I could not find such settings in EP Broadcasting service.
Please help me...
Kanako ImamuraThanks Deepu!
I found another tips;
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b891da90-0201-0010-fba7-8c35824c83a8
Kanako Imamura -
Download BW Query results in HTML format
On a daily basis, I need to get BW query results exported to an HTML extract file on the BW server. The HTML file will then be transferred to a Windows server for use in a dashboard view by a third party developed portal. The query has an input variable for period.
What is the best/simplest method for scheduling an existing BW query to run on a daily basis to produce an HTML extract / download file to the BW server file system?
We are currently on BW 7.01 SP6. We just completed a technical upgrade from BW3.5, but did not do a functional upgrade.
I have read through many postings but have been unable to find a solution. I have reviewed RSCRM_BAPI u2013 no html format.
Any help would be greatly appreciated.
Thanks,
Mark NortonHello Mark...
Amer is right. You can create a broadcast setting to daily sends your
query as MHTML format.
You can send to your e-mail but there is a possibility to save on KM and CM repository.
There is a little explanation on the link below:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5c6b686a-0901-0010-8aab-c4d0e5a093a7?quicklink=index&overridelayout=true
To create a broadcast setting, open the query via Query Designer.
Click "Query" -> "Publish" -> "BEx Broadcaster"
While you are creating the broadcast, there is a "Output Format" option.
There is MHTML.
I hope you find this information useful.
Thanks
Edward -
How to pass query result to HTML table?
Hi,
i want to get the query result in HTMl table instead of Display Grid. how to do it? i searched in help, it suggests use icommand to do this. but i dont know how to pass the select query result to HTML table.. please help me.
-senthilHi Senthil,
You can create an icommand query. You can then use the icommand retrieval methods to capture and manipulate the query data.
(http://help.sap.com/saphelp_xmii115/helpdata/en/Applet_Reference_Details/iCom
mand_Reference.htm)
Basically what we did was, use the getColumnCount() and getRowCount() methods, once you have these two numbers you can set two for loops and use String getValue(int ColID, int RowID) , within the for loops you can generate the inner html content and write the values either in a html table or html form (which is what we did). This seems to work well, I'm still playing around with it and may post this approach on sdn by end of this week.
Mahwish -
How to set query result to a single window
I am using SQL Developer 2.1063, and not happy with the default setting of result window. Everytimes when I run a query, the result appear in a new result window. Over a couple of hour I have tense or hundreds of result tabs in the low window. It is not quite fun to remove them one by one.
I am sure it can be set so that all result appear in one result window, as I am used to in the old SQ Developer version. But I failed to find it in Prefernces and in Help.-K- wrote:
This is fixed in the available 2.1.1.
Have fun,
K. K
I've just tested on 2.1.1 and i came to the same conclusion as user10369687
- if you check the box for "Preferences - Database - Worksheet - Automatically Freeze Result Tabs" or click the pin button or run as script (F5) or highlight the sql and run as script (F5) you always get new query result tab.
The option name suggest that if you check the box the same result tab will be used for different queries which is not true, is the oposite way.
If the option name is changed than the confusion will be cleared.
Dani -
Inconsistent SDO_RELATE results when querying 2.5D data
Oracle 11.1.0.7 with Patch 8343061 on Windows Server 2003 32bit.
I'm getting inconsistent results from SDO_RELATE results when querying 2.5D data. Some geometries I expect to be OVERLAPBDYDISJOINT, are not always being returned by SDO_RELATE when using the OVERLAPBDYDISJOINT mask. It seems that the order of the tables makes a difference to the result.
Here's a table with one 2.5D geometry and a 2D index:
CREATE TABLE TEST1 (
ID NUMBER PRIMARY KEY,
GEOMETRY SDO_GEOMETRY);
INSERT INTO TEST1 (id, geometry) VALUES (
1,
SDO_GEOMETRY(3002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(561695.935, 834005.726, 25.865,
561696.229, 834005.955, 25.867, 561686.278, 834015.727, 26.088, 561685.179, 834019.771, 26.226, 561680.716, 834022.389, 26.226,
561674.434, 834025.125, 26.171, 561671.963, 834032.137, 25.667, 561670.832, 834037.185, 25.619, 561667.946, 834042.976, 25.84,
561666.717, 834047.218, 26.171, 561664.229, 834051.781, 26.778, 561660.041, 834055.935, 26.64, 561657.514, 834061.742, 26.53,
561658.59, 834067.116, 27.882, 561657.67, 834070.739, 28.821, 561653.028, 834073.777, 29.042, 561653.234, 834078.769, 28.379,
561658.336, 834080.105, 29.511, 561664.582, 834079.468, 31.94, 561669.257, 834075.821, 33.707, 561672.716, 834074.456, 33.707,
561676.875, 834077.262, 33.735, 561675.868, 834081.55, 33.707, 561673.131, 834087.641, 33.679, 561672.208, 834093.502, 33.238,
561668.578, 834100.894, 33.735, 561666.013, 834106.399, 33.679, 561661.408, 834111.23, 33.514, 561654.854, 834117.181, 33.486,
561651.695, 834122.292, 33.569, 561649.112, 834128.847, 33.431, 561645.982, 834134.786, 33.293, 561642.485, 834141.235, 33.072,
561642.138, 834150.085, 33.293, 561646.072, 834159.721, 36.578, 561647.274, 834165.532, 37.02, 561646.359, 834170.867, 37.02,
561645.42, 834175.485, 36.799, 561642.44, 834180.977, 36.826, 561638.677, 834185.419, 36.771, 561636.693, 834194.824, 37.158,
561635.462, 834202.105, 37.241, 561631.998, 834208.745, 37.268, 561628.871, 834213.994, 37.241, 561627.554, 834220.393, 37.82,
561625.79, 834226.697, 39.532, 561620.561, 834236.494, 39.891, 561619.265, 834249.687, 39.697, 561619.883, 834260.02, 41.326,
561620.977, 834264.399, 43.093, 561622.557, 834270.723, 43.452, 561622.172, 834276.978, 43.452, 561621.347, 834285.541, 43.479,
561622.214, 834292.055, 43.645, 561619.718, 834302.583, 43.755, 561616.762, 834316.47, 43.755, 561608.842, 834328.241, 43.7,
561606.346, 834334.93, 43.7, 561605.27, 834341.929, 43.7, 561603.925, 834350.648, 43.728, 561602.462, 834358.405, 43.838,
561599.552, 834366.629, 44.031, 561594.551, 834374.291, 43.396, 561590.644, 834383.986, 43.065, 561588.48, 834392.21, 44.942,
561586.923, 834397.32, 46.737, 561584.608, 834402.898, 49.299, 561581.389, 834410.194, 50.077, 561580.437, 834419.49, 51.907,
561580.438, 834427.63, 53.127, 561582.245, 834433.389, 55.791, 561586.664, 834433.397, 57.503, 561593.88, 834433.608, 57.475,
561596.305,834439.653, 57.42, 561591.804, 834445.862, 57.309, 561589.097, 834447.689, 57.014)));
SELECT sdo_geom.validate_geometry_with_context(geometry, 0.0005) FROM TEST1;
DELETE FROM user_sdo_geom_metadata WHERE table_name = 'TEST1' AND column_name = 'GEOMETRY';
INSERT INTO user_sdo_geom_metadata VALUES ('TEST1','GEOMETRY',
MDSYS.SDO_DIM_ARRAY(
MDSYS.SDO_DIM_ELEMENT('X',400000,750000,0.0005),
MDSYS.SDO_DIM_ELEMENT('Y',500000,1000000,0.0005),
MDSYS.SDO_DIM_ELEMENT('Z',-10000,10000,0.0005)
), 2157);
DROP INDEX TEST1_SPIND;
CREATE INDEX TEST1_SPIND ON TEST1(GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('layer_gtype=line sdo_indx_dims=2');And here's another table with a 2D geometry and a 2D index:
CREATE TABLE TEST2 (
ID NUMBER PRIMARY KEY,
GEOMETRY SDO_GEOMETRY);
INSERT INTO TEST2 (id, geometry) VALUES (
1,
SDO_GEOMETRY(2002, 2157, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(561816.516, 834055.581, 561819.504, 834057.173,
561817.942, 834060.818, 561810.044, 834078.997, 561805.576, 834087.634, 561801.572, 834094.299, 561798.558, 834100.467,
561796.254, 834107.637, 561793.754, 834115.605, 561794.049, 834123.694, 561793.698, 834130.518, 561792.905, 834138.883,
561787.867, 834145.772, 561782.544, 834150.548, 561777.707, 834156.53, 561773.945, 834161.32, 561771.061, 834166.957,
561768.155, 834173.131, 561764.735, 834178.744, 561759.603, 834187.782, 561756.146, 834195.493, 561753.416, 834198.821,
561754.141, 834205.691, 561756.768, 834209.681, 561757.217, 834216.701, 561753.086, 834232.46, 561744.371, 834254.589,
561740.936, 834263.001, 561737.198, 834272.208, 561732.231, 834284.915, 561730.52, 834297.01, 561728.339, 834310.053,
561727.825, 834328.069, 561730.461, 834342.992, 561729.808, 834367.948, 561730.216, 834396.988, 561732.273, 834419.047,
561732.783, 834424.668, 561731.647, 834432.212, 561731.872, 834439.436, 561731.39, 834449.269, 561732.041, 834462.813,
561733.583, 834471.926, 561733.229, 834485.049, 561730.868, 834498.462, 561726.379, 834512.59, 561725.776, 834528.932,
561727.488, 834555.23, 561729.357, 834577.873, 561731.05, 834595.931, 561731.163, 834611.928, 561734.057, 834637.031,
561732.67, 834636.4, 561725.401, 834633.796, 561721.039, 834632.493, 561718.777, 834632.167, 561710.437, 834632.888,
561647.929, 834636.658, 561644.963, 834630.085, 561632.796, 834629.813, 561625.553, 834627.647, 561620.473, 834626.711,
561608.718, 834624.94, 561599.935, 834619.684, 561596.67, 834613.843, 561594.27, 834607.774, 561592.513, 834601.752,
561591.349, 834593.899, 561597.265, 834584.888, 561595.956, 834571.479, 561595.075, 834556.196, 561593.997, 834539.68,
561594.316, 834528.071, 561595.261, 834516.44, 561595.538, 834504.804, 561597.227, 834497.417, 561599.3, 834490.416,
561601.265, 834482.61, 561605.126, 834475.502, 561599.232, 834473.683, 561593.076, 834471.379, 561599.154, 834451.112,
561589.097, 834447.689, 561591.804, 834445.862, 561596.305, 834439.653, 561593.88, 834433.608, 561582.245, 834433.389,
561580.438, 834427.63, 561580.437, 834419.49, 561581.389, 834410.194, 561584.608, 834402.898, 561586.923, 834397.32,
561588.48, 834392.21, 561590.644, 834383.986, 561594.551, 834374.291, 561599.552, 834366.629, 561602.462, 834358.405,
561603.925, 834350.648, 561605.27, 834341.929, 561606.346, 834334.93, 561608.842, 834328.241, 561616.762, 834316.47,
561619.718, 834302.583, 561622.214, 834292.055, 561621.347, 834285.541, 561622.172, 834276.978, 561622.557, 834270.723,
561620.977, 834264.399, 561619.883, 834260.02, 561619.265, 834249.687, 561620.561, 834236.494, 561625.79, 834226.697,
561627.554, 834220.393, 561628.871, 834213.994, 561631.998, 834208.745, 561635.462, 834202.105, 561636.693, 834194.824,
561638.677, 834185.419, 561642.44, 834180.977, 561645.42, 834175.485, 561646.359, 834170.867, 561647.274, 834165.532,
561646.072, 834159.721, 561642.138, 834150.085, 561642.485, 834141.235, 561645.982, 834134.786, 561649.112, 834128.847,
561651.695, 834122.292, 561654.854, 834117.181, 561661.408, 834111.23, 561666.013, 834106.399, 561668.578, 834100.894,
561672.208, 834093.502,561673.131, 834087.641, 561675.868, 834081.55, 561676.875, 834077.262, 561672.716, 834074.456,
561669.257, 834075.821, 561664.582, 834079.468, 561658.336, 834080.105, 561653.234, 834078.769, 561653.028, 834073.777,
561657.67, 834070.739, 561658.59, 834067.116, 561657.514, 834061.742, 561660.041, 834055.935, 561664.229, 834051.781,
561666.717, 834047.218, 561667.946, 834042.976, 561670.832, 834037.185, 561671.963, 834032.137, 561674.434, 834025.125,
561680.716, 834022.389, 561685.179, 834019.771, 561686.278, 834015.727, 561696.229, 834005.955, 561695.935, 834005.726,
561677.805, 833994.91, 561683.163, 833985.817, 561703.01, 833949.434, 561725.891, 833961.856, 561744.35, 833971.197,
561768.396, 833983.86, 561777.842, 833988.883, 561798.333, 833999.743, 561797.243, 834005.725, 561783.574, 834040.515,
561798.127, 834046.391, 561807.001, 834050.509, 561816.516, 834055.581)));
SELECT sdo_geom.validate_geometry_with_context(geometry, 0.0005) FROM TEST2;
DELETE FROM user_sdo_geom_metadata WHERE table_name = 'TEST2' AND column_name = 'GEOMETRY';
INSERT INTO user_sdo_geom_metadata VALUES ('TEST2','GEOMETRY',
MDSYS.SDO_DIM_ARRAY(
MDSYS.SDO_DIM_ELEMENT('X',400000,750000,0.0005),
MDSYS.SDO_DIM_ELEMENT('Y',500000,1000000,0.0005)
), 2157);
DROP INDEX TEST2_SPIND;
CREATE INDEX TEST2_SPIND ON TEST2(GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('layer_gtype=line sdo_indx_dims=2');Now if I check how these two geometries relate to each other, the answer is OVERLAPBDYDISJOINT, which makes sense when inspecting the geometries.
SQL> SELECT
2 sdo_geom.relate(t1.geometry, 'determine', t2.geometry, 0.0005) relate_1_to_2,
3 sdo_geom.relate(t2.geometry, 'determine', t1.geometry, 0.0005) relate_2_to_1
4 FROM test2 t2, test1 t1
5 WHERE t1.id = t2.id;
RELATE_1_TO_2 RELATE_2_TO_1
OVERLAPBDYDISJOINT OVERLAPBDYDISJOINT
1 row selected.So, I'd expect this query to return something...
SELECT /*+ ORDERED */ t1.id, t2.id, sdo_geom.relate(t1.geometry, 'determine', t2.geometry, 0.0005) relate
FROM test2 t2, test1 t1
WHERE sdo_relate(t1.geometry, t2.geometry, 'mask=overlapbdydisjoint') = 'TRUE'
AND t1.id = 1
AND t2.id = 1;Nada. And this...
SELECT /*+ ORDERED */ t1.id, t2.id, sdo_geom.relate(t1.geometry, 'determine', t2.geometry, 0.0005) relate
FROM test1 t1, test2 t2
WHERE sdo_relate(t2.geometry, t1.geometry, 'mask=overlapbdydisjoint') = 'TRUE'
AND t1.id = 1
AND t2.id = 1;Nada.
And this...
SQL> SELECT /*+ ORDERED */ t1.id, t2.id, sdo_geom.relate(t1.geometry, 'determine', t2.geometry, 0.0005) relate
2 FROM test2 t2, test1 t1
3 WHERE sdo_relate(t2.geometry, t1.geometry, 'mask=overlapbdydisjoint') = 'TRUE'
4 AND t1.id = 1
5 AND t2.id = 1;
ID ID RELATE
1 1 OVERLAPBDYDISJOINT
1 row selected.This version gives the right answer.
Can anyone explain this?Hi,-
I think you are running into these bugs 7158518 and 7710726.
Could you please request the patch for the bugs so that they are published on Metalink
if they dont exist there?
Please let us know if these fix your problem.
Best regards
baris -
Getting query results from a PL/SQL procedure
Hi! So, I’m a little stumped and I can’t seem to find the answer to what I believe is probably a simple question…
So, here goes… I have a big ol’ union query that I use to create a report on a page, it’s about 25k – not over the 32k limit, but fails to be able to compile every time (I always get a 400 – Bad Request error). I’m not sure why this is happening, but I can remove a union statement and it compiles just fine – so it has something to do with the size of the query. ANYWAY – I’ve resolved that I should put this bad boy into the database as a stored procedure and just call it from Apex, my problem is I can’t figure out quite how to do this with variables, etc.…
Instead of giving you my whole big query, I’ll use the emp table as the concept is the same:
Say we have a query that creates a report on a page:
select empno, ename, job, mgr, hiredate, sal, comm, deptno
from emp
where job = :P_JOB
and hiredate >= :P_HIREDATE;
How would I take this query, create it as a stored procedure on the db, pass the variables from Apex and return the query result set from the stored proc as a report?
I really appreciate any help on this!
Best,
GilcrestHi Gilcrest,
You should create the query as a View and use the view name and the WHERE clause in the report's sql source.
Andy -
How to get Query Results based on Analysis Authorization Ranges????
Hi Experts,
I have gone through the lot of SDN Links, however not able to find the answer to my question.
I have an Authorization Issue, NO Authorization
Error : EYE 007 ( Insufficient Authorizations )
<b>Here is the issue:</b>
Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
<b>Its really urgent, please help..!</b>
Here are the logs:
Authorization Check Log
Date and Execution Time (Local Server)
Execution Date: 06.09.2007
Execution Time: 14:48:41
Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
Executed by User ZBI_TEST_001
Executed with Analysis Authorizations of Another User ZBI_TEST_001
InfoProvider Check
Building the Buffer...
...Buffer Built
Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
InfoProvider Check
Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:
0CO_AREA
0TCAACTVT
Relevant Characteristics for Detailed Authorization Check
(Characteristics with Full Authorization Are Not Listed!)
List of Effective Authorization-Relevant Characteristics for InfoProvider :
List Is Empty:
There Are No Characteristics That Have to Be Checked in Detail
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
CO_AREA = '0003'
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Authorized
Subselection (SUBNR) Is Authorized
Authorization Check Complete
Authorization Check
Detail Check for InfoProvider 0CCA_C11
Preprocessing:
Selection Checked for Consistency, Preprocessed and Supplemented As Needed
Subselection (Technical SUBNR) 1
Check Node Definitions and Value Authorizations...
Node- and Value Authorizations Are OK
End of Preprocessing
Filling the Buffer...
...Buffer Filled
Main Check:
Subselection (Technical SUBNR) 1
Supplementation of Selection for Aggregated Characteristics
No Check for Aggregation Authorization Required
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Partially or Fully Authorized (Intersection) Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Value selection partially authorized. Check of remainder at end
Following Set Is Checked Comparison with Following Authorized Set Result Remaining Set
Characteristic Contents
0CO_AREA
0TCAACTVT
SQL Format:
( CO_AREA < '0001'
OR CO_AREA > '0005' )
AND TCAACTVT = '03'
Characteristic Contents
0CO_AREA I BT 0001 0005
0TCAACTVT I EQ 03
I EQ 16
Not Authorized
All Authorizations Tested
Message EYE007: You do not have sufficient authorization
No Sufficient Authorization for This Subselection (SUBNR)
Following CHANMIDs Are Affected:
184 ( 0CO_AREA )
Authorization Check CompleteHi,
Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
Hope it helps,
Cheers,
Balaji
Maybe you are looking for
-
Takes a long time to write email
I am using windows 7, internet explorer 8.1 . It takes a very long time to write an email, each letter typed, it takes a long time to appear on the page sometimes it don't appear.. Please help
-
Why won't IE7 let me install flash player? I keep clicking 'allow active x' but it doesn't allow the installation. Help
-
Making pull down menus and file open dialogs speak
Hi, I'm trying to create some applications that include speech assistance for the visually impaired. there are two things that are causing problems: 1. I can't make the file open dialog boxes speak. I would like to emulate the behavior of third party
-
Can't apply effects to some photos
I have a medium-size iPhoto library but some of the photos contained therein will not accept any affects. For example, most of my photos will accept a black-and-white or a sepia affect, but a very few refuse to; absolutely nothing happens. I've rever
-
received email notification, ff4 now available, click here , clicked on button as directed, file downloaded, dbl clicked on icon, dragged new icon to applications folder, looked up "info" and saw "ff4" to which I then dragged a copy to my bottom bar.