30EA2 - UNIT TESTING - Dynamic Value Query truncating time from dates.
So i've been using the SQL Developer Unit Testing facility (very nice by the by) for a bit now and just recently upgraded to the latest beta release (3.0.02.83). It looks like a bug was introduced whereby the dynamic value queries are truncating all the time information from any DATE Data Types.
This causes some serious sadness for my current test cases and for me since i have to revert to the previous beta release :)
Irian wrote:
I noticed that in the new 30EA2 the parameter:
AddVMOption -Doracle.jdbc.mapDateToTimestamp=false has been introduced by default in
[SQLDEveloper_install_dir]/sqldeveloper/bin/sqldeveloper.confmaybe this has something to do with the incorrect date behaviour, try to remove the parameter and check again.That seems to have done the trick.
Many thanks!
Similar Messages
-
Unit test with Dynamic Value Query
Hi,
I am planing a function which should return a table name for a given ROWID. The ROWID will be selected from a view. Now I am trying to setup a unit test which consists of Startup and Teardown Process as well as a Dynamic Value Query. During Startup Process one dataset is inserted in a table which is part of a view definition. The dataset should be selected during Dynamic Value Query. However I am getting the following error message: Unable to run the test because no rows were returned by the dynamic query. Is there the possibility that within a Dynamic Value Query I can't make use of datasets which where inserted by a Startup Process? I am asking because the selection outside the unit testing framework supplies the dataset as expected.
SQL Developer: 3.2.20.09 Build MAIN-09.87
Java: 1.6.0_45
Regards.Dynamic SQL is very tricky. Since you can get the data outside your application extract and test the dynamic SQL as it is generated. When working with dynamic SQL I find it useful to first generate the SQL text as a string and then if necessary store it in a table (CLOB type) for later reference. Because of the uncertainty of obtaining bind variable values later I prefer to hard-code such values into dynamic SQL - possibly slightly less efficient for Oracle at run time but a lot easier to work with when debugging and tuning (again, apart from the built-in inefficiency of not using bind variables) I usually find the overhead of the hard-coded values not too bad and the ability to know the data values at a glance useful. I also find it useful to write dynamic SQL in such a way so that the resulting statement can be pasted in to any normal SQL tool (SQL*PLUS, SQL*Developer) and run without any editing.
There may be some quirk in the generated dynamic SQL preventing it from finding anything.
Good luck. -
BUG? ORA-01461 in Unit Tester when saving a long Dynamic Value Query
I get an ORA-01461 "can bind a LONG value only for insert into a LONG column" error when saving a Test Implementation with a Dynamic Value Query whose length of the SQL statement is roughly 2,000 characters - I'm UNIONing ALL about 30 test case values together, but it seems to be choking on such a long SQL string for some reason....
I am running version Early Adopter Release #2 (2.1.0.63), build MAIN-63.10.
Thoughts?Confirmed.
Bug 9119144: ORA-01461 IN UNIT TESTER WHEN SAVING A LONG DYNAMIC VALUE QUERY (OR OTHER CLOB)
Brian Jeffries
SQL Developer Team -
Best way to spool DYNAMIC SQL query to file from PL/SQL
Best way to spool DYNAMIC SQL query to file from PL/SQL [Package], not SqlPlus
I'm looking for suggestions on how to create an output file (fixed width and comma delimited) from a SELECT that is dynamically built. Basically, I've got some tables that are used to define the SELECT and to describe the output format. For instance, one table has the SELECT while another is used to defined the column "formats" (e.g., Column Order, Justification, FormatMask, Default value, min length, ...). The user has an app that they can use to customize the output...which leaving the gathering of the data untouched. I'm trying to keep this formatting and/or default logic out of the actual query. This lead me into a problem.
Example query :
SELECT CONTRACT_ID,PV_ID,START_DATE
FROM CONTRACT
WHERE CONTRACT_ID = <<value>>Customization Table:
CONTRACT_ID : 2,Numeric,Right
PV_ID : 1,Numeric,Mask(0000)
START_DATE : 3,Date,Mask(mm/dd/yyyy)The first value is the kicker (ColumnOrder) as well as the fact that the number of columns is dynamic. Technically, if I could use SqlPlus...then I could just use SPOOL. However, I'm not.
So basically, I'm trying to build a generic routine that can take a SQL string execute the SELECT and map the output using data from another table to a file.
Any suggestions?
Thanks,
JasonYou could build the select statement within PL/SQL and open it using a cursor variable. You could write it to a file using the package 'UTL_FILE'. If you want to display the output using SQL*Plus, you could have an out parameter as a ref cursor.
-
SUBTRACT TIME FROM DATE & TIME
Hi.
I need FM which will SUBTRACT TIME from DATE & TIME.
Example:
Date = 05.05.2007
Time = 05:00:00
Time_subtract = 48:00:00
Return of FM:
Date = 03.05.2007
Time = 05:00:00
Do you know any FM?
Thanks!Hi, Check these function mod's
SD_DATETIME_DIFFERENCE
HRCM_TIME_PERIOD_CALCULATE
HR_ECM_GET_PERIOD_BETW_DATES
After you execute them in SE37 give the required input and you will get a correct output.
<b>REWARD IF USEFUL</b>
thanks n regards
Dinesh -
Daily max(value) query for time period
I am looking to get the maximum value for every 24 hour period for a month. So for example my date range can be defined by...
select to_date('&date','mm yyyy')-1 + level as DateRange
from dual
connect by level <= '&days'
...where I can provide the first date of the month and number of days in the month or a lesser value if less time is required. So, the results of the above query plus 24 for the range. I thought a some googling would provide me what I needed, but my search came up empty.
I was hoping to do something like this...
select utctime, max(value) from table where utctime between....
Any guidance would be much appreciated!
Thanks!Zewbie wrote:
Sorry about that...Oracle 10.2.0.5
create table x (utctime date,
pointnumber int,
value float)
insert into x values (to_date('02022012 232221','mmddyyyy hh24miss'), 10, 3.245);
insert into x values (to_date('02022012 202202','mmddyyyy hh24miss'), 13, 14.5);
insert into x values (to_date('02024012 103421','mmddyyyy hh24miss'), 10, 23.245);
insert into x values (to_date('02024012 042528','mmddyyyy hh24miss'), 10, 33.245);
insert into x values (to_date('02028012 022321','mmddyyyy hh24miss'), 14, 32.245);
insert into x values (to_date('02028012 205221','mmddyyyy hh24miss'), 10, 2.245);
insert into x values (to_date('02029012 211421','mmddyyyy hh24miss'), 14, 1.4345);
insert into x values (to_date('02029012 082221','mmddyyyy hh24miss'), 10, 3.245);Do you have dates 7000 years in the future, or ido you have typos?
So a query of the above would provide max daily value based on a pointnumber such as 10 for a given period.What are the results you want from the given data?
What role does pointnumber play in this problem?
If you want something like this:
A_DATE POINTNUMBER MAX_VALUE
02-Feb-2012 10 3.245
02-Feb-2012 13 14.5
02-Feb-2012 14
03-Feb-2012 10
03-Feb-2012 13
03-Feb-2012 14for the 2 days starting with February 2, 2012, then you can do this:
WITH days_wanted AS
SELECT DATE '2012-02-02' -- starting date
+ LEVEL - 1 AS a_date
FROM dual
CONNECT BY LEVEL <= 2 -- number of days wanted
SELECT d.a_date
, x.pointnumber
, MAX (x.value) AS max_value
FROM days_wanted d
LEFT OUTER JOIN x PARTITION BY (x.pointnumber)
ON TRUNC (x.utctime) = d.a_date
-- WHERE x.pointnumber = 10 -- If wanted
GROUP BY d.a_date, x.pointnumber
ORDER BY d.a_date, x.pointnumber
; -
Unit Test Generator - VS 2008 (Cannot add oracle data source)
Hi All,
Okay this might just be me (new to ODT for VS) - but If I start VS, go Test -> Add Test.
Create a Database Unit Test.
[Give it some name]
write a query such as select * from <>
add a test checksum condition , and try to configure the checksum condition.. (Hit configure on the properties - under misc).
I go to new connection ...
I only have SQL Server (sqlClient) available. Is the unit test generator/validator something that oracle does not currently yet support?
(Yes the ODT 11i for VS 2008 is installed, can add a data connection to Oracle systems/query oracle in VS - just cannot add a Oracle database connection for unit database tests).
Or has anybody found a way to make this very useful piece of functionality work ?
Best Regards,
DThe same thing happens, If I go File -> Open -> Oracle Database Project Items -> SQL Script.
This comes up as disconnected.
When right click on the new script choose connect, only SQL Server provider is available with no ability to choose a oracle provider (greyed out to choose a diff connection provider).
Prehaps someone has seen this before? -
Trying to pivot based on a dynamically created query which generates XML data
Hi there,
Hope someone can help
I'm trying to pivot row data into a pivot type result set where the records for a given employee are pivoted to a single row.
To do this, I've declared a dynamic query to retrieve the GUID values of the different training course- the actual course names are full of SQL escape characters e.g. ', (,) which I thought might mess up the dynamically generated query
I've got as far as writing
DECLARE
@employeeidsVARCHAR(10)
DECLARE
@coursesVARCHAR(max)
DECLARE
@queryVARCHAR(max)
SELECT
@courses=STUFF((SELECT
DISTINCT[TRAIN_ID]
FROM
[Megapay_IWA].[dbo].[HRS_TRAINING]
FORXMLPATH('')
),2,0,'')+']'
SET
@query=
'SELECT * FROM
( SELECT t.TRAIN_TRAINING,
EMPL_EMPLOYEE_ID
FROM
[Megapay_IWA].[dbo].[HRSTRNDONE] as tc
left join Megapay_IWA.dbo.PAYEMPL as e on tc.TRND_ONRID = e.EMPL_EMPLOYEE_id
left join [Megapay_IWA].[dbo].[HRS_TRAINING] as t on tc.TRND_TRAIN_ID =t.TRAIN_ID
) t
PIVOT (COUNT(EMPL_EMPLOYEE_ID) FOR TRAIN_ID in
+@courses+'))
AS pvt'
EXECUTE
(@query)
which generates a dynamic query along the following lines but how to I update the query to correctly read the train_id values in the xml
SELECT * FROM
( SELECT t.TRAIN_TRAINING,
EMPL_EMPLOYEE_ID
FROM
[Megapay_IWA].[dbo].[HRSTRNDONE] as tc
left join Megapay_IWA.dbo.PAYEMPL as e on tc.TRND_ONRID = e.EMPL_EMPLOYEE_id
left join [Megapay_IWA].[dbo].[HRS_TRAINING] as t on tc.TRND_TRAIN_ID =t.TRAIN_ID
) t
PIVOT (COUNT(EMPL_EMPLOYEE_ID) FOR TRAIN_ID in
<TRAIN_ID>F607BA64-BD24-4C6F-810E-001E7487FB4B</TRAIN_ID><TRAIN_ID>784EF318-628F-407E-8844-0049E3DD8F86</TRAIN_ID><TRAIN_ID>C7F3B365-7E6C-4CDF-9F0C-010207D1E493</TRAIN_ID><TRAIN_ID>7A82C4C1-5A9F-4EB0-9988-018405D3347A</TRAIN_ID><TRAIN_ID>E3FC88F5-AF5F-4D75-816A-02085190FC5C</TRAIN_ID><TRAIN_ID>BEB39D10-7887-494C-ADCC-0254A1514D06</TRAIN_ID><TRAIN_ID>6D870918-CFA1-4ADA-8427-049FF01902AC</TRAIN_ID><TRAIN_ID>61D1B40A-A9B6-4835-82C4-04FDCCAF7E6D</TRAIN_ID><TRAIN_ID>CA6D6B7-5ACA-4BE0-8A08-0EE87F77F10E</TRAIN_ID><TRAIN_ID>F86E6E93-544E-43F5-A97A-10E96834C781</TRAIN_ID><TRAIN_ID>EB898326-705F-4E70-B7BB-119B8953DFA9</TRAIN_ID><TRAIN_ID>491BFC77-0FA9-42C5-A255-11C49AA28CDD</TRAIN_ID><TRAIN_ID>C7A972FB-1E73-41FC-A4EF-12F5811C9853</TRAIN_ID><TRAIN_ID>3FD2CEE3-E85F-4624-87D7-13767D2DB391</TRAIN_ID><TRAIN_ID>F8A784C0-6E56-4769-92D2-1480BCAB2BEA</TRAIN_ID><TRAIN_ID>60D36A51-E642-40A2-A2F7-14D158B59781</TRAIN_ID><TRAIN_ID>67ED29A3-E2AD-42EC-8312-156084C0BB26</TRAIN_ID><TRAIN_ID>64B637B9-CC7D-47C8-9220-15D5FA76E65F</TRAIN_ID><TRAIN_ID>59B5D61C-4228-485D-89EE-185B74E42F3C</TRAIN_ID>
Note I'm also fine with updating the dynamic query to generate a statement that generates a normal where in constraint e.g.
PIVOT (COUNT(EMPL_EMPLOYEE_ID) FOR TRAIN_ID in
('F607BA64-BD24-4C6F-810E-001E7487FB4B','784EF318-628F-407E-8844-0049E3DD8F86')
Thanks
JohnThanks guys, that helped immensely,
For the record here is the slightly modified version [made generic to show the overall principle] that got it working for me in the end
DECLARE @ColumnList VARCHAR(MAX) = '';
DECLARE @query VARCHAR(max);
WITH Data AS (
SELECT columnname
FROM dbo.table
SELECT @ColumnList +='[' + [columnname] +'],'
FROM Data;
SET @ColumnList = STUFF(@ColumnList, 2, 0, '');
SET @ColumnList = LEFT(@ColumnList, LEN(@ColumnList) - 1)
--print @columnlist
SET @query=
'SELECT otherfields, ' +@ColumnList +' FROM
( SELECT otherfields,columnname, datefield
FROM dbo.table
) t
PIVOT (max(datefield) FOR [columnname] in (' +@ColumnList + ')
) AS pvt'
execute (@query) -
Select more than one value at a time from an LOV?
Is it possible to configure an LOV-based text field so more than one value at a time can be chosen from the drop-down LOV list? This is a user requirement for specifying multiple values in an SQL WHERE clause.
Rather several select fields because single returned value is a functional limitation of <select>.
-
How can I build a table with the time values of a timer from a while loop
Hi:
I have a question concerning building a table:
Every 100ms I read a value from a sensor (while loop with a timer). I would like to build a table with the actual time and the concerning value. For example:
0msec 1V
100msec 2V
200msec 3V
300msec 4V
etc.
If I use the Express VI for building a table, I always get the date and time, but I don't need the date and the time is in the following format: HH:MMS, which is nonsensical for me as I can't differentiate within msec. Can I change the format anywhere?
Can I also save the table to a file or even to an Excelsheet? How can I do that?
Thanks for your help!Hi Craig:
thank you very much. To solve the mystery : ) :
I want to drive a stepper motor with a specific frequency. To get the current degree value of the motor I would like to measure the current time (from the beginning of the move on). (With a formula I get the degree value out of the time)
Concurrently I would like to get data from a torque sensor and from a pressure sensor. That's why I asked you about the time and the table. The measurement should start with the movement of the motor. How can I do that? Right now I have different block diagrams (different while loops) (see attachment) and I would like to put them in one.
I haven't done the block diagram for the pressure sensor yet, so there is only the one for the torque sensor and the one for the motor.
I also would like to set a mark in the table when the voltage value of an analog input gets under a specific threshold value. Is that possible?
I'm sorry, I'm a novice in LabVIEW. But maybe you can help me.
Thank you very much!
Steffi
Attachments:
motor.vi 238 KB
sensor.vi 59 KB -
How to get query response time from ST03 via a script ?
Hello People,
I am trying to get average query response time for BW queries with a script (for monitoring/historisation).
I know that this data can be found manually in ST03n in the "BI workload'.
However, I don't know how to get this stat from a script.
My idea is to run a SQL query to get this information, here is the state of my query :
select count(*) from sapbw.rsddstat_olap
where calday = 20140401
and (eventid = 3100 or eventid = 3010)
and steptp = 'BEX3'
The problem is that this query is not returning the same number of navigations as the number shown in ST03n.
Can you help me to set the correct filters to get the same number of navigation as in ST03n ?
Regards.Hi Experts,
Do you have ideas for this SQL query ?
Regards. -
Extracting time from date and adding it to another date.
Dear All,
The values of two fields in my table are as follows:
n_date n_time
12/7/2007 1/1/1970 5:50:23 PM
Both of these fields are of date data type.
How can i add the time from n_time to n_date so that n_date will reflect a date with time added?
The problem is that i want to sort on n_date and i am not getting result when two dates are having same values for n_date but different for n_time.
How can i create a new expression for sorting these values?
Thanks in advance.
Regards,
SameerHi,
Check this.
with data as
( select to_date('12/7/2007','dd/mm/yyyy') as ndate, to_date('1/1/1970 5:50:23','dd/mm/yyyy hh24:mi:ss') ntime from dual)
select ndate + (ntime - trunc(ntime)) from data
Regards
RK -
X6 = "1/5/15 5:16 AM" & NOW ....................difference by Only Time
not date
X6 date and Time will be changing, Its not Constant
Dim myDateTime As DateTime = X6
Dim myDate As String = myDateTime.ToString("dd/MM/yy")
Dim myTime As String = myDateTime.ToString("hh:mm tt")
Dim myDateTime1 As DateTime = Now
Dim myDate1 As String = myDateTime1.ToString("dd/MM/yy")
Dim myTime1 As String = myDateTime1.ToString("hh:mm tt")
Need to use this function to find the Difference between Two Time. due to 12:00 AM isuue
Function XLMod(a, b)
' This replicates the Excel MOD function
XLMod = a - b * Int(a / b)
End Function
Output Required
dim dd = XLMod(myTime - myTime1)
Problem is myTime & myTime1 is String Need to convert them into Time, Later use XLMOD Funtion.Induhar,
As an addendum to this, I thought I'd add this in also: If you have two valid DateTime objects you might consider using a class which I put together a few years ago
shown on a page of my website here.
To use it, just instantiate with two DateTime objects (order doesn't matter, it'll figure it out) and you'll then have access to the public properties. For this example, I'm just showing the .ToString method:
Option Strict On
Option Explicit On
Option Infer Off
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim date1 As DateTime = Now
Dim date2 As DateTime = #1/1/1970 2:35:00 PM#
Dim howOld As New Age(date1, date2)
MessageBox.Show(howOld.ToString, "Age")
Stop
End Sub
End Class
I hope that helps, if not now then maybe at some point in the future. :)
Still lost in code, just at a little higher level.
Thanx frank, can use this in Future.... -
How to use dynamic select query which queries from 3 different table.
Hi All,
I am new to Toplink, i would like to use a named query to select some of the columns from 3 different tables with dynamic where clause.
I have used the following lines. Please tell me how to get code for the dynamic where clause.
First try :
Vector objPersons = (Vector)session.executeQuery("findPersonByGlobalID",Person.class,vQueryArguments);
The above method is not returning the vector or collection.
Second Try:
ReadAllQuery query = new ReadAllQuery(Person.class);
query.useCollectionClass(LinkedList.class);
LinkedList person = (LinkedList) session.executeQuery(query);
The second try is returning the collection but, this fetches all the record from the table.
1. How to query for range of records?
2. How to query from multiple tables for some range. How to use dynamic range values ?
Please reply with your answers or some pointers would help.
Thanks and Regards,
Vijay.BHi,
Did you try using a SQLCall ? It might be able to satisfy you requirements .. :-
Employee employee = (Employee) session.executeSelectingCall(
new SQLCall("SELECT * FROM EMPLOYEE WHERE EMP_ID = 44")
);You can get more information here :-
http://www.oracle.com/technology/products/ias/toplink/doc/1013/MAIN/_html/qrybas004.htm
Regards,
Sandeep -
Pass value at run time from one structure to diffrent structure
hi experts.
i m workin on crm domain and faching problem to pass value from one stucture to another . problem is that i want the output in xml file so i need all the values interm of segment.
initialy i have this structure.
DATA: BEGIN OF struc1 occurs 0,
ST_ORDERADM_H TYPE CRMT_ORDERADM_H_WRKT,
ST_PRICING TYPE CRMT_PRICING_WRKT,
ST_ORGMAN TYPE CRMT_ORGMAN_WRKT,
ST_PARTNER TYPE CRMT_PARTNER_EXTERNAL_WRKT,
END OF struc1.
and using fm CALL FUNCTION 'CRM_ORDER_READ' i got values on this structure at run time.
MOVE LT_ORDERADM_H to STRUC1-ST_ORDERADM_H.
MOVE LT_ORGMAN to STRUC1-ST_ORGMAN.
MOVE LT_PARTNER to STRUC1-ST_PARTNER.
MOVE LT_PRICING to STRUC1-ST_PRICING.
and after that using
try.
CALL TRANSFORMATION id
SOURCE data_node = STRUC1
RESULT XML xmlstring.
CATCH cx_st_error.
endtry.
CLEAR: tab_xstring,
lv_filename,
lv_path,
lv_fullpath,
lv_user_action.
REFRESH: tab_xstring.
lv_bytes = XSTRLEN( xmlstring ).
IF lv_bytes > 0.
lv_xstring = xmlstring.
DO.
APPEND lv_xstring TO tab_xstring.
lv_xcnt = XSTRLEN( lv_xstring ).
IF lv_xcnt > xsize.
lv_xstring = lv_xstring+xsize.
ELSE.
EXIT.
ENDIF.
ENDDO.
now it convert to xml file .
problem is it gives me value of all field associated with standared structure.
but client requirment is that he want only selected values of given structure.
so i think i make a new structure for given value but i m not able to get values in new structure.
thanksHi,
create a structure in se11 with following fields
ST_ORDERADM_H.
ST_ORGMAN.
ST_PARTNER.
ST_PRICING.
for example as STRUCT2.
data : begin of i_struct2 occurs 0.
include structure struct2.
data : end of i_struct2.
MOVE LT_ORDERADM_H to i_STRUCt2-ST_ORDERADM_H.
MOVE LT_ORGMAN to i_STRUCt2-ST_ORGMAN.
MOVE LT_PARTNER to i_STRUCt2-ST_PARTNER.
MOVE LT_PRICING to i_STRUCt2_PRICING.
then
try.
CALL TRANSFORMATION id
SOURCE data_node = i_STRUCt2
RESULT XML xmlstring.
CATCH cx_st_error.
endtry.
Maybe you are looking for
-
I used to be able to press 1 button to get to my Google Home page, but now that I have downloaded the latest version of Mozilla Firefox, the "home page" is now information about Firefox and at the top of my computer, there is a question about securit
-
Using the OIM logger in a Pre-populate adapter
I am having problems getting the logger to show any output from my java code. This same logic works for a scheduled task, but not in a pre-populate adapter. I am even trying to use a logging class that I see is already in the logs. Code snippet: impo
-
Using Photoshop Album tags on iPod
I have uploaded about 7,500 photos form photoshop album on my iPod. It is all in one big directory. How can I organise them using tags as we can with music?
-
Restrict Ordered Items Sold to an Account
Hi, Is there a way to restrict item/s that can be ordered for a particular account ? Also can the restriction be placed on the no of items that can be sold to an account on an order ? Consider 11i and R12 versions. If not available out of box then an
-
Re: Module Pool Type Conversion Error.
Hi, I have used the screen fields quantity parameter of type imseg-erfmg pmeins parameter of type imseg-erfme. while conversion.. i am passing the value lbbes-erfmg to quantity and lbbes-erfme to pmeins when the conversion is done the lbbes-erfmg h