CFCHART with dates
I am having a problem with getting dates to line up in the appropriate order in a CFCHART from 3 different queries. In other words, August dates might come before July dates on the chart. Ideally I would like to have these 3 queries as one query because the records I am accessing are all in the same table. That can be battle for another day once I resolve this issue. Hints would be helpful on the query dilemma.
Just a little background:
MSSQL database
ColdFusion 9
Each record has 3 bit datatype fields and a timestamp datatype field.
What I am trying to do is loop over the selected records and count each bit that is 'true'. Here is what I have.
<!--- Get record bit 1 --->
<cfquery ="Datasource" name="record1q" cachedwithin="#CreateTimeSpan(0, 0, 10, 0)#">
SELECT Month(myDate) AS DateMonth, Day(myDate) AS recordDate,
Year(myDate) AS DateYear, COUNT(record1bit) AS record1bitCount
FROM myTable
WHERE record1bit = 'true'
GROUP BY Month(myDate), Day(myDate), Year(myDate), record1bit
</cfquery>
<!--- Get record bit 2 --->
<cfquery ="Datasource" name="record2q">
SELECT Month(myDate) AS DateMonth, Day(myDate) AS recordDate,
Year(myDate) AS DateYear, COUNT(record2bit) AS record2bitCount
FROM myTable
WHERE record2bit = 'true'
GROUP BY Month(myDate), Day(myDate), Year(myDate), record2bit
</cfquery>
<!--- Get record bit 3 --->
<cfquery ="Datasource" name="record3q">
SELECT Month(myDate) AS DateMonth, Day(myDate) AS recordDate,
Year(myDate) AS DateYear, COUNT(record3bit) AS record2bitCount,
record3bit
FROM myTable
WHERE record3bit = 'true'
GROUP BY Month(myDate), Day(myDate), Year(myDate), record2bit, record3bit
</cfquery>
<!--- Reformat the generated numbers. --->
<cfloop index = "i" from = "1" to = "#record1q.RecordCount#">
<cfset record1q.record1bitCount[i] = record1q.record1bitCount[i]>
<cfset record1q.recordDate[i] = record1q.DateMonth[i] & "/" & record1q.recordDate[i] & "/" & record1q.DateYear[i]>
</cfloop>
<!--- Reformat the generated numbers. --->
<cfloop index = "i" from = "1" to = "#record2q.RecordCount#">
<cfset record2q.record2bitCount[i] = record2q.record2bitCount[i]>
<cfset record2q.recordDate[i] = record2q.DateMonth[i] & "/" & record2q.recordDate[i] & "/" & record2q.DateYear[i]>
</cfloop>
<!--- Reformat the generated numbers. --->
<cfloop index = "i" from = "1" to = "#record3q.RecordCount#">
<cfset record3q.record2bitCount[i] = record3q.record2bitCount[i]>
<cfset record3q.recordDate[i] = record3q.DateMonth[i] & "/" & record3q.recordDate[i] & "/" & record3q.DateYear[i]>
</cfloop>
<cfchart showlegend="yes"
format="flash"
backgroundColor="white"
xAxisTitle="Date"
yAxisTitle="Activity"
font="Arial"
gridlines=6
showXGridlines="yes"
showYGridlines="yes"
showborder="yes"
show3d="yes"
chartwidth="500" title="Total Views and Shares"
>
<cfchartseries
type="bar"
query="record1q"
valueColumn="record1bitCount"
itemColumn="recordDate"
seriesColor="gray"
paintStyle="plain"
seriesLabel="record1bit">
</cfchartseries>
<cfchartseries
type="bar"
query="record2q"
valueColumn="record2bitCount"
itemColumn="recordDate"
seriescolor="FF9900"
paintStyle="plain"
seriesLabel="record2bit">
</cfchartseries>
<cfchartseries
type="bar"
query="record3q"
valueColumn="record2bitCount"
itemColumn="recordDate"
seriescolor="000099"
paintStyle="plain"
seriesLabel="record3qbit Viewed">
</cfchartseries>
</cfchart>
I know it is a little sloppy but it is a good start. Any help will be appreciated.
Dan, It does make sense. What I had previously was something similar to this:
<!--- Get record bits --->
<cfquery ="Datasource" name="recordq" cachedwithin="#CreateTimeSpan(0, 0, 10, 0)#">
SELECT Month(myDate) AS DateMonth, Day(myDate) AS recordDate,
Year(myDate) AS DateYear, COUNT(record1bit) AS record1bitCount,
COUNT(record2bit) AS record2bitCount, COUNT(record3bit) AS record3bitCount
FROM myTable
WHERE record1bit = 'true'
GROUP BY Month(myDate), Day(myDate), Year(myDate), record1bit, record2bit, record3bit
</cfquery>
The problem with this was that all the records were grouped by date but was not totaled on one date line on the output. It also causes issues with the WHERE statement. I could have record1bit = 'true' but record2bit = 'false'. I have basic SQL skills so I generally gravitate to dealing with the output which is not always the best solution. A SQL solution would be ideal if you had one. Otherwise, grouping the output seems to have me at a roadblock with my ability. If there is no SQL solution and I could use this query, I would be thrilled since it would reduce the traffic from the database. Thanks for your help.
Similar Messages
-
Query to extract HTML tag with data
Hi All,
I have a string.
'<HTML><HEAD>THIS IS HEAD.</HEAD><BODY>THIS IS BODY.<P>THIS IS P1.</P>NIMISH<P>THIS IS P2.</P></BODY></HTML>'
I want to extract a html tag including its opening & closing tab with data as
if i say P1
then the output should be
'<P>THIS IS P1.</P>'
for P2
then the output should be
<P>THIS IS P2.</P>
please help me in writing this query with regular expression
i have tried it as following but it is not giving desired result:
WITH T AS
SELECT
'<HTML><HEAD>THIS IS HEAD.</HEAD><BODY>THIS IS BODY.<P>THIS IS P1.</P>NIMISH<P>THIS IS P2.</P></BODY></HTML>' STR
FROM
DUAL
SELECT REGEXP_SUBSTR(STR, '<P>.+P2.+</P>') FROM T
Thanks & Regards
Nimish GargEdited by: Nimish Garg on May 7, 2012 5:49 PMNimish Garg wrote:
My requirement is to extract a <tag>data</tag> from a HTML/XML string
where data contains any specified value.HTML is not XML.
And that is a critical distinction to make. HTML parsing is horribly complex. XML is quite easy. For HTML you have to code your own parser in PL/SQL. XML can be parsed using the XMLTYPE class/data type in PL/SQL.
So if you need to find a single specific tag in HTML - I would not try to treat it as XML. I may not even try to use regular expressions.
I would do a basic substring search for the start of the tag. Read the data following the tag. Ensure that there are no nested or embedded tags in the data. Until the end tag is read. Because HTML is that much abused - and because that is an accepted norm as parsers used by browsers deals with that abuse without complaining.
Proper HTML is mostly a myth in my experience of "screen scraping" web servers for data extraction as they do not have web services supplying the data. -
Can not see the option Execution with Data Change in the infoprovider?
Hi team,
i am using query designer 3.x, when i go into my bex brodcaster settings and schedule my report
i can not see the option "Execution with Data Change in the infoprovider",
i can only see 2 options
Direct scheduling in background process
create new scheduling
periodic,
is there any setting which i would be able to see the option "Execution with Data Change in the infoprovider"?
kindly assistHi Blusky ,
check the below given link.
http://help.sap.com/saphelp_nw04/Helpdata/EN/ec/0d0e405c538f5ce10000000a155106/frameset.htm
Regards,
Rohit Garg -
Can Not Remove "with" Data from Calendar Event Details
I currently have a Palm Tungsten|E2. For a short time I used to sync it with my work computer; this was before they replaced the computer (lease was up) with a new one where it was locked down and I could not reinstall the Palm desktop. Since then I have been syncing it with my home computer that runs MS Vista. Just recently I have noticed that when I create new Calendar events on my Palm, they all get a new "With:" data line (and a user from my old job) after sync'ing with my home computer. Selecting this "With:" entry brings me to a screen that allows me to select from a list of people I may "Done", "Reply", or "Reply All" to; although selecting either reply only causes a fatal error that requires a soft reset (button on back of machine). Looking at the event through the desktop software shows no data point so that it may be cleaned.
I would like to know why my desktop software is adding this person to a "With:" data point to all new entires I create on the Palm hardware, how do I turn it off and keep it from doing it in the future.
Steve
Post relates to: Tungsten E2
This question was solved.
View Solution.Are you sync'ing the new device to the same username in Palm Desktop as an older device?
If you are, this will cause problems on the new device. When you sync the device, it saves the device settings, 3rd party apps, preferences, etc. in the backup folder in the username folder on the PC. When you sync the new device it copies the contents of the backup folder for the old device to the new device. This will cause corruption in the settings for the new device thus causing erratic behavior of the new device.
The best way to preserve your data is to export the data in each category in Palm Desktop to a seperate folder on your PC.
Create a new folder on your PC somewhere that is convenient. Name it something like Palm Desktop Data. Click on the link below and follow the instructions on that page for the export procedure.
http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=28734
Make sure you select all for the range in the export window.
With the data saved in the folder you created, make a copy of that folder and save to a flash drive, cd-rw or external hard drive.
Anytime you make a change in Palm Desktop, export the data that was changed to that folder and save again to the external media.
With this process you can always import the data back into Palm Desktop anytime you have a problem with the data in Palm Desktop or if your computer/hard drive/device crashes.
Looks like you may need to hard reset your device and rename your backup folder. Go to http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=887 and follow the directions to do a hard reset. Next before you hotsync your data back over you will need to rename your backup folder, to do that go here;
XP
C:\program files\palm or palm one\[hotsync username]\ and rename your backup
folder to backup.old
Vista
Start-->documents\Palm OS Desktop\[hotsync username]\ and rename your backup
folder to backup.old
Then hotsync to your current hotsync name and all your contacts, calendar,
tasks, and memos will come back over.
Show file extensions for XP or Vista
XP
If you can not view file extensions on your PC I would like you to open a
folder go to Tools-->Folder Options--> View (tab) and under show hidden
files and folders uncheck hide file extensions for known file types.
Vista
Open control Panel go to Folder Options--> View (tab) and under show hidden
files and folders uncheck hide file extensions for known file types.
Post relates to: Palm i705 -
Compare data in R/3 with data in a BW Cube after the daily delta loads
Hi Friends,
How can I compare data in R/3 with data in a BW Cube after the daily delta loads? Are there any standard procedures for checking them or matching the number of records?Hi Sunil,
If you want to check the records daily instead of checking the data in R/3 manually ......
You can try this...
If you have staging DSO(level 1) that means whatever data is in source system load it to Staging DSO without any routines or any modifications.
Now load this DSO data to Cube or DSO(level 2) as per your requirement with routines etc.
Now Staging DSO contains Source system data.
Now the level 2 Cube or DSO contains BW data with some modifications.
Now create a Multiprovider based on level 1 and level 2 data targets.
Now create a report on which keyfigures you want to test the data.
In Multiprovider there is a field called 0infoprovider in data packet dimension.
you can drag this infoprovider to the columns and restict your keyfigures with level 1 and level 2 data targets.
In the first column you can see the level 1 DSO data ( source system data),in the 2nd column you can see the BW data.
Now create a formula which gives the diffrence b/n level 1 and level2.
that is R/3 data - BW data.
If the diffrence is zero both R/3 and BW data are same.
if the diffrence is not eqaul to zero check whether any routine is there or not. -
JDBC MS Access--- cannot extract entry with null value with data type Meta
I'm trying to extract a data entry with null value by using JDBC. The database is MS Access.
The question is how to extract null entry with data type memo? The following code works when the label has data type Text, but it throws sqlException when the data type is memo.
Any advice will be appreciated! thanks!
Following are the table description and JDBC code:
test table has the following attributes:
Field name Data Type
name Text
label Memo
table contents:
name label
me null
you gates
Code:
String query = "SELECT name, label FROM test where name like 'me' ";
ResultSet rs = stmt.executeQuery(query);
while (rs.next())
String name = rs.getString("name");
rs.getString("val");
String label = rs.getString("label");
System.out.println("\t"+name+"\t"+label);
catch (SQLException ex)
System.out.println(ex.getSQLState());
System.out.println(ex.getErrorCode());
System.out.println("in sqlexception");
output:
C:\Temp\SEFormExtractor>java DBTest
yet SELECT name, label FROM test
null
0
in sqlexceptionThe question is how to extract null entry with data type memo?Okay, what you need to do is this:
if (rs.getString("val") == null)
// do something
}This way, when it's a null value, you can check it first, and then handle it how you want, rather than getting an exception. -
Cube loaded with data, but unavailable in the query
Hello everyone,
Someone can help me?
I created a new Cube CO-PA for the year 2010, and loaded with data this year. To make sure that the data were correct did a ListCube, with all the filter equal to the query, and indeed the data is loaded properly for this year. And when i run the query with data from the years 2008 and 2009 show me data in my report, but when I run the query for 2010, the query displays an error message saying that "no data".
How is it possible to have the correct data in the Cube, and i can not view the data in the query?
Note: The request in the cube is available to report
Thank you all,
Greetings,
Maria João
30-Março 2010Hello,
I was in trouble because I had not selected the key figures in the multicube : S
After selecting the key figures, I ran the query and it had data.
Thank you for your help.
Sincerely,
Maria Joã -
How to create a report with data using the Crystal Reports for Java SDK
Hi,
How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats. I can create my own report through the following code snippet:
ReportClientDocument boReportClientDocument = new ReportClientDocument();
boReportClientDocument.newDocument();
However, I cannot find a way to add data elements to the report without specifying an RPT file. Is this possible? I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
is there a way to do this through these packages?
com.crystaldecisions.sdk.occa.report.data
com.crystaldecisions.sdk.occa.report.definition
Am I forced to create a RPT file for the different table and column structures I have?
Thank you in advance for any insights.
Ted JenneyHi Rameez,
After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser. I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
<%
try {
ReportClientDocument rcd = new ReportClientDocument();
rcd.newDocument();
// Setup the DB connection
String database_dll = "Sqlsrv32.dll";
String db = "qa_start_2012";
String dsn = "SQL Server";
String userName = "sa";
String pwd = "sa";
// Create the DB connection
ConnectionInfo oConnectionInfo = new ConnectionInfo();
PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
// Set new table logon properties
PropertyBag oPropertyBag2 = new PropertyBag();
oPropertyBag2.put("DSN", dsn);
oPropertyBag2.put("Data Source", db);
// Set the connection info objects members
// 1. Pass the Logon Properties to the main PropertyBag
// 2. Set the Server Description to the new **System DSN**
oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
oPropertyBag1.put("Database DLL", database_dll);
oConnectionInfo.setAttributes(oPropertyBag1);
oConnectionInfo.setUserName(userName);
oConnectionInfo.setPassword(pwd);
// The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
// Add a Database table
String tableName = "Building";
Table oTable = new Table();
oTable.setName(tableName);
oTable.setConnectionInfo(oConnectionInfo);
rcd.getDatabaseController().addTable(oTable, null);
catch(ReportSDKException RsdkEx) {
out.println(RsdkEx);
catch (Exception ex) {
out.println(ex);
%>
Throws the exception
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
String tableName = "Building";
String fieldname = "Building_Name";
Table oTable = new Table();
oTable.setName(tableName);
oTable.setAlias(tableName);
oTable.setQualifiedName(tableName);
oTable.setDescription(tableName) ;
Fields fields = new Fields();
DBField field = new DBField();
field.setDescription(fieldname);
field.setHeadingText(fieldname);
field.setName(fieldname);
field.setType(FieldValueType.stringField);
field.setLength(40);
fields.add(field);
oTable.setDataFields(fields);
oTable.setConnectionInfo(oConnectionInfo);
rcd.getDatabaseController().addTable(oTable, null);
This code succeeds, but it is not clear how to add that database field to a section. If I attempt to call the following:
FieldObject oFieldObject = new FieldObject();
oFieldObject.setDataSourceName(field.getFormulaForm());
oFieldObject.setFieldValueType(field.getType());
// Now add it to the section
oFieldObject.setLeft(3120);
oFieldObject.setTop(120);
oFieldObject.setWidth(1911);
oFieldObject.setHeight(226);
rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
Then I get an error (which is not unexpected)
com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
How do I add one of the table.SetDataFields() to my report to be displayed?
Are there any other pointers or suggestions you may have?
Thank you -
Hi,
One of my user is facing issue in creating new time sheet,
"The time sheet creation failed, because of problems with the project server or with data validations".
This issue is coming to only few members out of 10000 members.
Note: For the same user, can able to do in other machines. only the problem in his machine. Have ran the office diagnostics, but still the problem persists.
Is any add-on's/any settings need to update in IE. Could any one please help me on how to fix this issue?
Many thanks in advance.I would check the compatibility settings in IE etc, or try another browser (chrome, safari etc.)
Ben Howard [MVP] | web |
blog | book -
Problem with Date Picker and wwv_flow_item.date_popup()
I have a Report based on the HTMLDB How-To âBuild Tabular Forms for Multi-Row Operationsâ
This is my code:
select
X.RRIT_UID,
X.DOS,
X.CPT_CODE,
X.MOD,
X.DX_CODE,
X.CHARGES,
X.UNITS
from
(select
htmldb_item.text(1,RRIT_UID) RRIT_UID,
wwv_flow_item.date_popup(2,null,RRIT_DATE_OF_SERVICE) DOS,
htmldb_item.text(4,RRIT_SUBMIT_SERVICE_CODE,6) CPT_CODE,
htmldb_item.text(5,RRIT_SUBMIT_MODIFIER,3) MOD,
htmldb_item.text(6,RRIT_ATT_DIAG_CODE,6) DX_CODE,
htmldb_item.text(7,RRIT_BILLED_CHARGES,9) CHARGES,
htmldb_item.text(8,RRIT_UNITS,3) UNITS
from
RRIT_REPRICE_ITEM
where
RRRR_UID = :P5_RRRR_UID
union all
select
htmldb_item.text(1,null) RRIT_UID,
wwv_flow_item.date_popup(2,null,null) DOS,
htmldb_item.text(4,null,6) CPT_CODE,
htmldb_item.text(5,null,3) MOD,
htmldb_item.text(6,null,6) DX_CODE,
htmldb_item.text(7,null,9) CHARGES,
htmldb_item.text(8,null,3) UNITS
from
dual)
X
My problem is when I run the page and select a date from the Pop-Up calendar I get this error:
Line 10
Error: âopener.document.forms.0.f02.0â is null or not an object
I know it is something to do with data formats and the fact that I do not fully understand the use of wwv_flow_item.date_popup().Hi DK,
It is a WD Java application, Backend is ABAP (MM module).
The UI is input field, where the context attribute type is Date, So its been changed to Date Picker.
The problem is when the user runs the WD application in Portal, The calendar format is being changed for some users. That is for few users the Week starts with Monday and for few users the week starts with Sunday.
I need all the users to have Monday as the First day of the week.
Please let me know, what will be solution for this.
Since I haven't done anything in regard to date, it is a simple Date format.
Thanks & Regards,
Palani -
having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this.
I'm using Lion on an MBP and Numbers is the latest versionMay you give more details about what is wrong with your dates ?
M…oSoft products aren't allowed on my machines but I use LibreOffice which is a clone of Office.
When I export from Numbers to Excel and open the result with LibreOffice, the dates are correctly treated.
To be precise, dates after 01/01/1904 are correctly treated. dates before 01/01/1904 are exported as strings but, as it's flagged during the export process, it's not surprising.
Yvan KOENIG (VALLAURIS, France) mardi 3 janvier 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My iDisk is : http://public.me.com/koenigyvan
Please : Search for questions similar to your own before submitting them to the community
For iWork's applications dedicated to iOS, go to :
https://discussions.apple.com/community/app_store/iwork_for_ios -
Is there a Java utility class to help with data management in a desktop UI?
Is there a Java utility class to help with data management in a desktop UI?
I am writing a UI to configure a network device that will be connected to the serial port of the computer while it is being configured. There is no web server or database for my application. The UI has a large number of fields (50+) spread across 16 tabs. I will write the UI in Java FX. It should run inside the browser when launched, and issue commands to the network device through the serial port. A UI has several input fields spread across tabs and one single Submit button. If a field is edited, and the submit button clicked, it issues a command and sends the new datum to the device, retrieves current value and any errors. so if input field has bad data, it is indicated for example, the field has a red border.
Is there a standard design pattern or Java utility class to accomplish the frequently encountered, 'generic' parts of this scenario? lazy loading, submitting only what fields changed, displaying what fields have errors etc. (I dont want to reinvent the wheel if it is already there). Otherwise I can write such a class and share it back here if it is useful.
someone recommended JGoodies Bindings for Swing - will this work well and in FX?Many thanks for the reply.
In the servlet create an Arraylist and in th efor
loop put the insances of the csqabean in this
ArrayList. Exit the for loop and then add the
ArrayList as an attribute to the session.I am making the use of Vector and did the same thing as u mentioned.I am using scriplets...
>
In the jsp retrieve the array list from the session
and in a for loop step through the ArrayList
retrieving each CourseSectionQABean and displaying.
You can do this in a scriptlet but should also check
out the jstl tags.I am able to remove this problem.Thanks again for the suggestion.
AS -
Problem with DATE in Interactive Report
Hello,
In Interactive Report when I click on the header of any column with DATE datatype, nothing happens due to Javascript error:
Line: 2
Char: 14838
Error: Expected identifier, string or number
Code: 0
Click on any other column works perfectly as well as sorting by DATE column from Action Menu.
I tried to set different format masks for my DATE column and for Application Date Format, but it didn't help.
Finally I found out that this error disappeared when in properties of my DATE column in "List of Values" section I set "Report Filter Date Ranges" = 'Past' instead of 'All'. In this case I get the list with values "Last 5 Years", "Last 2 Years", etc, but not with "Next Hour", "Next 2 Hours", etc...
Can someone help me on this issue, because this functionality might be usefull and also it's not very convinient to change this property for all date columns in all Interactive Report.
By the way, my database version is 9.2.0.5 - maybe it can cause such problem?
Best regards,
VladimirHi Marco,
1) French Canada (fr-ca)
2) This filter works
More informations about the error when I call the function gReport.controls.widget():
<h;div id="apexir_DT" style="text-align: center;" onclick="gReport.controls.widget(this.id)">h;Date de naissance<h;/div>h;
*************POST*************
flowid 48579
p_flow_step_id 5
p_instance 1412541985987586
p_request APXWGT
p_widget_action SORT_WIDGET
p_widget_mod CONTROL
p_widget_name worksheet
x01 5775894815382747091
x02 5775899227924757464
x03 apexir_DT
*************RESPONSE*************
{"dialog":{"id":"1966481623126322611","hide":["apexir_info","apexir_computation"],"coltype":"DATE","filter"
:false,"uv":true,{"dialog":{"uv":true,"row":[{"V":"Failure<br />ORA-20001: get_dbms_sql_cursor error
ORA-00923: FROM keyword not found where expected"}]}}
Louis-Guillaume
Homepage: http://www.insum.ca
Blog: http://insum-apex.blogspot.com -
Performance with dates in the where clause
Performance with dates in the where clause
CREATE TABLE TEST_DATA
FNUMBER NUMBER,
FSTRING VARCHAR2(4000 BYTE),
FDATE DATE
create index t_indx on test_data(fdata);
query 1: select count(*) from TEST_DATA where trunc(fdate) = trunc(sysdate);
query 2: select count(*) from TEST_DATA where fdate between trunc(sysdate) and trunc(SYSDATE) + .99999;
query 3: select count(*) from TEST_DATA where fdate between to_date('21-APR-10', 'dd-MON-yy') and to_date('21-APR-10 23:59:59', 'DD-MON-YY hh24:mi:ss');
My questions:
1) Why isn't the index t_indx used in Execution plan 1?
2) From the execution plan, I see that query 2 & 3 is better than query 1. I do not see any difference between execution plan 2 & 3. Which one is better?
3) I read somewhere - "Always check the Access Predicates and Filter Predicates of Explain Plan carefully to determine which columns are contributing to a Range Scan and which columns are merely filtering the returned rows. Be sceptical if the same clause is shown in both."
Is that true for Execution plan 2 & 3?
3) Could some one explain what the filter & access predicate mean here?
Thanks in advance.
Execution Plan 1:
SQL> select count(*) from TEST_DATA where trunc(fdate) = trunc(sysdate);
COUNT(*)
283
Execution Plan
Plan hash value: 1486387033
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 9 | 517 (20)| 00:00:07 |
| 1 | SORT AGGREGATE | | 1 | 9 | | |
|* 2 | TABLE ACCESS FULL| TEST_DATA | 341 | 3069 | 517 (20)| 00:00:07 |
Predicate Information (identified by operation id):
2 - filter(TRUNC(INTERNAL_FUNCTION("FDATE"))=TRUNC(SYSDATE@!))
Note
- dynamic sampling used for this statement
Statistics
4 recursive calls
0 db block gets
1610 consistent gets
0 physical reads
0 redo size
412 bytes sent via SQL*Net to client
380 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
Execution Plan 2:
SQL> select count(*) from TEST_DATA where fdate between trunc(sysdate) and trunc(SYSDATE) + .99999;
COUNT(*)
283
Execution Plan
Plan hash value: 1687886199
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 9 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 9 | | |
|* 2 | FILTER | | | | | |
|* 3 | INDEX RANGE SCAN| T_INDX | 283 | 2547 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(TRUNC(SYSDATE@!)<=TRUNC(SYSDATE@!)+.9999884259259259259259
259259259259259259)
3 - access("FDATE">=TRUNC(SYSDATE@!) AND
"FDATE"<=TRUNC(SYSDATE@!)+.999988425925925925925925925925925925925
9)
Note
- dynamic sampling used for this statement
Statistics
7 recursive calls
0 db block gets
76 consistent gets
0 physical reads
0 redo size
412 bytes sent via SQL*Net to client
380 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows
Execution Plan 3:
SQL> select count(*) from TEST_DATA where fdate between to_date('21-APR-10', 'dd-MON-yy') and to_dat
e('21-APR-10 23:59:59', 'DD-MON-YY hh24:mi:ss');
COUNT(*)
283
Execution Plan
Plan hash value: 1687886199
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 9 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 9 | | |
|* 2 | FILTER | | | | | |
|* 3 | INDEX RANGE SCAN| T_INDX | 283 | 2547 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(TO_DATE('21-APR-10','dd-MON-yy')<=TO_DATE('21-APR-10
23:59:59','DD-MON-YY hh24:mi:ss'))
3 - access("FDATE">=TO_DATE('21-APR-10','dd-MON-yy') AND
"FDATE"<=TO_DATE('21-APR-10 23:59:59','DD-MON-YY hh24:mi:ss'))
Note
- dynamic sampling used for this statement
Statistics
7 recursive calls
0 db block gets
76 consistent gets
0 physical reads
0 redo size
412 bytes sent via SQL*Net to client
380 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processedHi,
user10541890 wrote:
Performance with dates in the where clause
CREATE TABLE TEST_DATA
FNUMBER NUMBER,
FSTRING VARCHAR2(4000 BYTE),
FDATE DATE
create index t_indx on test_data(fdata);Did you mean fdat<b>e</b> (ending in e)?
Be careful; post the code you're actually running.
query 1: select count(*) from TEST_DATA where trunc(fdate) = trunc(sysdate);
query 2: select count(*) from TEST_DATA where fdate between trunc(sysdate) and trunc(SYSDATE) + .99999;
query 3: select count(*) from TEST_DATA where fdate between to_date('21-APR-10', 'dd-MON-yy') and to_date('21-APR-10 23:59:59', 'DD-MON-YY hh24:mi:ss');
My questions:
1) Why isn't the index t_indx used in Execution plan 1?To use an index, the indexed column must stand alone as one of the operands. If you had a function-based index on TRUNC (fdate), then it might be used in Query 1, because the left operand of = is TRUNC (fdate).
2) From the execution plan, I see that query 2 & 3 is better than query 1. I do not see any difference between execution plan 2 & 3. Which one is better?That depends on what you mean by "better".
If "better" means faster, you've already shown that one is about as good as the other.
Queries 2 and 3 are doing different things. Assuming the table stays the same, Query 2 may give different results every day, but the results of Query 3 will never change.
For clarity, I prefer:
WHERE fdate >= TRUNC (SYSDATE)
AND fdate < TRUNC (SYSDATE) + 1(or replace SYSDATE with a TO_DATE expression, depending on the requirements).
3) I read somewhere - "Always check the Access Predicates and Filter Predicates of Explain Plan carefully to determine which columns are contributing to a Range Scan and which columns are merely filtering the returned rows. Be sceptical if the same clause is shown in both."
Is that true for Execution plan 2 & 3?
3) Could some one explain what the filter & access predicate mean here?Sorry, I can't. -
Help on export sybase iq tables with data and import in another database ?
Help on export Sybase iq 16 tables with data and import into another database ?
Hi Nilesh,
If you have table/index create commands (DDLs), you can create them in Developper and import data using one of methods below
Extract/ Load table
Insert location method : require IQ servers to be entered in interfaces file
Backup/Restore : copy entire database content
If you have not the DDLs, you can generate them using IQ cockpit or SCC.
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01773.1604/doc/html/san1288042631955.html
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01840.1604/doc/html/san1281564927196.html
Regards,
Tayeb.
Maybe you are looking for
-
Ssrs 2008 r2 straight line within a matrix
In an SSRS 2008 R2 new report have placed a matrix on the end of the report for information the user wants to see at the end of the report. The user wants to place a straight line between the different infomation sections in the tablix. Here are the
-
XDK 10.1.0.1.0A Beta and 9.2.0.6.0 production are available online at: http://otn.oracle.com/tech/xml In the 10.1.0.1.0A beta release, extensive enhancements are included for XSLT 2.0, JAXB Class Generator and DOM 3.0 XML support. The new features in
-
Need help how to change LOV query
Hi All, Can some one help me how to use the LOV Query based on responsibility (I am using form personalization) When the user logs in with XX_Payables Super user with say (Responsibility id =500) then the LOV should be Select BA.bank_account_name, BA
-
People, I have uninstalled scribus 1.16 and downloaded and installed the scribus 1.17.pkg.tar.gz But trying to execute it, the following message appears: error while loading shared libraries libssl.so.0.9.7 Cannot open shared object file. No such fil
-
WCM: Operational Class assignment to Technical Objects
Greetings Experts, Gurus and SAP Sages! In WCM, we are able to create an Operational Class to restrict the particular Operational Conditions & Operational Groups that are relevant for the Technical Objects. But I am having difficulty uderstanding the