Timestamp in xquery

Hi All,
How to get current timestamp in xquery.
I am using OSB and created a list file jca adapter. I get a xml data with file names and last modified time when I execute the business service that includes the list file adapter.
I want to compare this timestamp with current system time.
How I can do this ?
Regards,
Abdul

Hi Atheek,
Thanks for your reply.
But the function return 2011-07-28T10:25:04.597-07:00 which is date and time.
I need timestamp which will be a number like below.
<get:lastModifiedTime>1311786146000</get:lastModifiedTime>
Regards,
Abdul

Similar Messages

  • Selective XML Index feature is not supported for the current database version , SQL Server Extended Events , Optimizing Reading from XML column datatype

    Team , Thanks for looking into this  ..
    As a last resort on  optimizing my stored procedure ( Below ) i wanted to create a Selective XML index  ( Normal XML indexes doesn't seem to be improving performance as needed ) but i keep getting this error within my stored proc . Selective XML
    Index feature is not supported for the current database version.. How ever
    EXECUTE sys.sp_db_selective_xml_index; return 1 , stating Selective XML Indexes are enabled on my current database .
    Is there ANY alternative way i can optimize below stored proc ?
    Thanks in advance for your response(s) !
    /****** Object: StoredProcedure [dbo].[MN_Process_DDLSchema_Changes] Script Date: 3/11/2015 3:10:42 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- EXEC [dbo].[MN_Process_DDLSchema_Changes]
    ALTER PROCEDURE [dbo].[MN_Process_DDLSchema_Changes]
    AS
    BEGIN
    SET NOCOUNT ON --Does'nt have impact ( May be this wont on SQL Server Extended events session's being created on Server(s) , DB's )
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
    select getdate() as getdate_0
    DECLARE @XML XML , @Prev_Insertion_time DATETIME
    -- Staging Previous Load time for filtering purpose ( Performance optimize while on insert )
    SET @Prev_Insertion_time = (SELECT MAX(EE_Time_Stamp) FROM dbo.MN_DDLSchema_Changes_log ) -- Perf Optimize
    -- PRINT '1'
    CREATE TABLE #Temp
    EventName VARCHAR(100),
    Time_Stamp_EE DATETIME,
    ObjectName VARCHAR(100),
    ObjectType VARCHAR(100),
    DbName VARCHAR(100),
    ddl_Phase VARCHAR(50),
    ClientAppName VARCHAR(2000),
    ClientHostName VARCHAR(100),
    server_instance_name VARCHAR(100),
    ServerPrincipalName VARCHAR(100),
    nt_username varchar(100),
    SqlText NVARCHAR(MAX)
    CREATE TABLE #XML_Hold
    ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY , -- PK necessity for Indexing on XML Col
    BufferXml XML
    select getdate() as getdate_01
    INSERT INTO #XML_Hold (BufferXml)
    SELECT
    CAST(target_data AS XML) AS BufferXml -- Buffer Storage from SQL Extended Event(s) , Looks like there is a limitation with xml size ?? Need to re-search .
    FROM sys.dm_xe_session_targets xet
    INNER JOIN sys.dm_xe_sessions xes
    ON xes.address = xet.event_session_address
    WHERE xes.name = 'Capture DDL Schema Changes' --Ryelugu : 03/05/2015 Session being created withing SQL Server Extended Events
    --RETURN
    --SELECT * FROM #XML_Hold
    select getdate() as getdate_1
    -- 03/10/2015 RYelugu : Error while creating XML Index : Selective XML Index feature is not supported for the current database version
    CREATE SELECTIVE XML INDEX SXI_TimeStamp ON #XML_Hold(BufferXml)
    FOR
    PathTimeStamp ='/RingBufferTarget/event/timestamp' AS XQUERY 'node()'
    --RETURN
    --CREATE PRIMARY XML INDEX [IX_XML_Hold] ON #XML_Hold(BufferXml) -- Ryelugu 03/09/2015 - Primary Index
    --SELECT GETDATE() AS GETDATE_2
    -- RYelugu 03/10/2015 -Creating secondary XML index doesnt make significant improvement at Query Optimizer , Instead creation takes more time , Only primary should be good here
    --CREATE XML INDEX [IX_XML_Hold_values] ON #XML_Hold(BufferXml) -- Ryelugu 03/09/2015 - Primary Index , --There should exists a Primary for a secondary creation
    --USING XML INDEX [IX_XML_Hold]
    ---- FOR VALUE
    -- --FOR PROPERTY
    -- FOR PATH
    --SELECT GETDATE() AS GETDATE_3
    --PRINT '2'
    -- RETURN
    SELECT GETDATE() GETDATE_3
    INSERT INTO #Temp
    EventName ,
    Time_Stamp_EE ,
    ObjectName ,
    ObjectType,
    DbName ,
    ddl_Phase ,
    ClientAppName ,
    ClientHostName,
    server_instance_name,
    nt_username,
    ServerPrincipalName ,
    SqlText
    SELECT
    p.q.value('@name[1]','varchar(100)') AS eventname,
    p.q.value('@timestamp[1]','datetime') AS timestampvalue,
    p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') AS objectname,
    p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') AS ObjectType,
    p.q.value('(./action[@name="database_name"]/value)[1]','varchar(100)') AS databasename,
    p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') AS ddl_phase,
    p.q.value('(./action[@name="client_app_name"]/value)[1]','varchar(100)') AS clientappname,
    p.q.value('(./action[@name="client_hostname"]/value)[1]','varchar(100)') AS clienthostname,
    p.q.value('(./action[@name="server_instance_name"]/value)[1]','varchar(100)') AS server_instance_name,
    p.q.value('(./action[@name="nt_username"]/value)[1]','varchar(100)') AS nt_username,
    p.q.value('(./action[@name="server_principal_name"]/value)[1]','varchar(100)') AS serverprincipalname,
    p.q.value('(./action[@name="sql_text"]/value)[1]','Nvarchar(max)') AS sqltext
    FROM #XML_Hold
    CROSS APPLY BufferXml.nodes('/RingBufferTarget/event')p(q)
    WHERE -- Ryelugu 03/05/2015 - Perf Optimize - Filtering the Buffered XML so as not to lookup at previoulsy loaded records into stage table
    p.q.value('@timestamp[1]','datetime') >= ISNULL(@Prev_Insertion_time ,p.q.value('@timestamp[1]','datetime'))
    AND p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') ='Commit' --Ryelugu 03/06/2015 - Every Event records a begin version and a commit version into Buffer ( XML ) we need the committed version
    AND p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') <> 'STATISTICS' --Ryelugu 03/06/2015 - May be SQL Server Internally Creates Statistics for #Temp tables , we do not want Creation of STATISTICS Statement to be logged
    AND p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') NOT LIKE '%#%' -- Any stored proc which creates a temp table within it Extended Event does capture this creation statement SQL as well , we dont need it though
    AND p.q.value('(./action[@name="client_app_name"]/value)[1]','varchar(100)') <> 'Replication Monitor' --Ryelugu : 03/09/2015 We do not want any records being caprutred by Replication Monitor ??
    SELECT GETDATE() GETDATE_4
    -- SELECT * FROM #TEMP
    -- SELECT COUNT(*) FROM #TEMP
    -- SELECT GETDATE()
    -- RETURN
    -- PRINT '3'
    --RETURN
    INSERT INTO [dbo].[MN_DDLSchema_Changes_log]
    [UserName]
    ,[DbName]
    ,[ObjectName]
    ,[client_app_name]
    ,[ClientHostName]
    ,[ServerName]
    ,[SQL_TEXT]
    ,[EE_Time_Stamp]
    ,[Event_Name]
    SELECT
    CASE WHEN T.nt_username IS NULL OR LEN(T.nt_username) = 0 THEN t.ServerPrincipalName
    ELSE T.nt_username
    END
    ,T.DbName
    ,T.objectname
    ,T.clientappname
    ,t.ClientHostName
    ,T.server_instance_name
    ,T.sqltext
    ,T.Time_Stamp_EE
    ,T.eventname
    FROM
    #TEMP T
    /** -- RYelugu 03/06/2015 - Filters are now being applied directly while retrieving records from BUFFER or on XML
    -- Ryelugu 03/15/2015 - More filters are likely to be added on further testing
    WHERE ddl_Phase ='Commit'
    AND ObjectType <> 'STATISTICS' --Ryelugu 03/06/2015 - May be SQL Server Internally Creates Statistics for #Temp tables , we do not want Creation of STATISTICS Statement to be logged
    AND ObjectName NOT LIKE '%#%' -- Any stored proc which creates a temp table within it Extended Event does capture this creation statement SQL as well , we dont need it though
    AND T.Time_Stamp_EE >= @Prev_Insertion_time --Ryelugu 03/05/2015 - Performance Optimize
    AND NOT EXISTS ( SELECT 1 FROM [dbo].[MN_DDLSchema_Changes_log] MN
    WHERE MN.[ServerName] = T.server_instance_name -- Ryelugu Server Name needes to be added on to to xml ( Events in session )
    AND MN.[DbName] = T.DbName
    AND MN.[Event_Name] = T.EventName
    AND MN.[ObjectName]= T.ObjectName
    AND MN.[EE_Time_Stamp] = T.Time_Stamp_EE
    AND MN.[SQL_TEXT] =T.SqlText -- Ryelugu 03/05/2015 This is a comparision Metric as well , But needs to decide on
    -- Peformance Factor here , Will take advise from Lance if comparision on varchar(max) is a vital idea
    --SELECT GETDATE()
    --PRINT '4'
    --RETURN
    SELECT
    top 100
    [EE_Time_Stamp]
    ,[ServerName]
    ,[DbName]
    ,[Event_Name]
    ,[ObjectName]
    ,[UserName]
    ,[SQL_TEXT]
    ,[client_app_name]
    ,[Created_Date]
    ,[ClientHostName]
    FROM
    [dbo].[MN_DDLSchema_Changes_log]
    ORDER BY [EE_Time_Stamp] desc
    -- select getdate()
    -- ** DELETE EVENTS after logging into Physical table
    -- NEED TO Identify if this @XML can be updated into physical system table such that previously loaded events are left untoched
    -- SET @XML.modify('delete /event/class/.[@timestamp="2015-03-06T13:01:19.020Z"]')
    -- SELECT @XML
    SELECT GETDATE() GETDATE_5
    END
    GO
    Rajkumar Yelugu

    @@Version : ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
        May 14 2014 18:34:29
        Copyright (c) Microsoft Corporation
        Developer Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
    (1 row(s) affected)
    Compatibility level is set to 110 .
    One of the limitation states - XML columns with a depth of more than 128 nested nodes
    How do i verify this ? Thanks .
    Rajkumar Yelugu

  • How to get the Max value of elements of type datetime

    Hi All ,
    I wanted to get the latest timestamp value ( datatype as datetime) from node list. I have following xml. In this xml, i want to get the modifydate element which has latest timestamp through xquery/xpath, it should return me following result 2011-09-29T17:21:17+10:00
    <CustomerList>
    <CustomerDetails>
    <name> Test 1</name>
    <status>active</status>
    <modifyDate>2011-08-20T17:21:17+10:00</modifyDate>
    </CustomerDetails>
    <CustomerDetails>
    <name> Test 2</name>
    <status>cancel</status>
    <modifyDate>2011-08-29T17:21:17+10:00</modifyDate>
    </CustomerDetails>
    <CustomerDetails>
    <name> Test 3</name>
    <status>active</status>
    <modifyDate>2011-09-29T17:21:17+10:00</modifyDate>
    </CustomerDetails>
    </CustomerList>
    i tried to use the
    //CustomerList/CustomerDetails/modifyDate[not(. <=../preceding-sibling::CustomerList/CustomerDetails/modifyDate) and not(. <=../following-sibling::CustomerList/CustomerDetails/modifyDate)]
    But it is not working on datetime datatype.
    Any help in this regard is much appreciated.
    Regards
    Edited by: user6736659 on Sep 5, 2011 6:15 AM

    Hi,
    The following XQuery should give you what you want :
    max(
    for $i in /CustomerList/CustomerDetails/modifyDate
    return xs:dateTime($i)
    )For instance, using Oracle SQL :
    SQL> var xmldoc varchar2(4000)
    SQL> begin
      2   :xmldoc := '<CustomerList>
      3  <CustomerDetails>
      4  <name> Test 1</name>
      5  <status>active</status>
      6  <modifyDate>2011-08-20T17:21:17+10:00</modifyDate>
      7  </CustomerDetails>
      8 
      9  <CustomerDetails>
    10  <name> Test 2</name>
    11  <status>cancel</status>
    12  <modifyDate>2011-08-29T17:21:17+10:00</modifyDate>
    13  </CustomerDetails>
    14 
    15  <CustomerDetails>
    16  <name> Test 3</name>
    17  <status>active</status>
    18  <modifyDate>2011-09-29T17:21:17+10:00</modifyDate>
    19  </CustomerDetails>
    20  </CustomerList>';
    21  end;
    22  /
    PL/SQL procedure successfully completed
    SQL> select xmlquery('max(
      2   for $i in /CustomerList/CustomerDetails/modifyDate
      3   return xs:dateTime($i)
      4  )'
      5  passing xmltype(:xmldoc)
      6  returning content
      7  )
      8  from dual
      9  ;
    XMLQUERY('MAX(FOR$IIN/CUSTOMER
    2011-09-29T17:21:17.000000+10:00

  • XMLTable default values for timestamp results in ORA-01843: not a valid month

    When I try to provide a default for a timestamp value in the XMLTABLE function, I am greeted with an error - ORA-01843: not a valid month - no matter how I provide that default value. Whether there is a value present in the XML or not is irrelavant for this bug to occur. It appears to be an incomplete fix of bug number 9745897 (thread).
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
      COLUMNS dt timestamp default sysdate) x;
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
      COLUMNS dt timestamp default systimestamp) x;
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
      COLUMNS dt timestamp default to_char(systimestamp, 'YYYY-MM-DD"T"HH24:MI:SS') ) x;
    Edit: A little more followup.
    This works:
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC></DOC>')
      COLUMNS dt date default sysdate) x;
    This also works, except for its just the date, and not the date/time
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC></DOC>')
      COLUMNS dt timestamp default sysdate) x;
    This doesn't work
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC></DOC>')
      COLUMNS dt timestamp default systimestamp) x;
    ORA-01861: literal does not match format string

    Hi,
    First of all, let's check the manual for the DEFAULT clause :
    XMLTABLE SQL/XML Function in Oracle XML DB
    The optional DEFAULT clause specifies the value to use when the PATH expression results in an empty sequence (or NULL). Its expr is an XQuery expression that is evaluated to produce the default value.
    According to the documentation, the DEFAULT clause should specify an XQuery expression.
    However, that is wrong, the actual implementation only expects an expression that resolves to a string, the content is not interpreted.
    So, bottom line is if we don't directly specify a string, the expression will be implicitly converted to one, and we all know how bad things can go when implicit conversions occur, especially when dates or timestamps are involved.
    Now let's focus on how the DEFAULT clause affects the query evaluation.
    When a DEFAULT clause is specified, Oracle rewrites the projection differently and do not use the native xs:dateTime format to convert the value  :
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
      COLUMNS dt timestamp default systimestamp
      ) x
    becomes :
    SELECT CASE EXISTSNODE(VALUE(KOKBF$),'/DOC/DT')
             WHEN 1 THEN CAST(TO_TIMESTAMP(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/DOC/DT')),50,1,2)) AS timestamp )
             ELSE CAST(TO_TIMESTAMP(TO_CHAR(SYSTIMESTAMP(6)),'SYYYY-MM-DD"T"HH24:MI:SSXFF') AS timestamp )
           END  "DT"
    FROM TABLE("SYS"."XQSEQUENCE"(EXTRACT("SYS"."XMLTYPE"('<DOC><DT>2013-08-14T15:08:31</DT></DOC>'),'/DOC'))) "KOKBF$"
    See the red part : it doesn't use the format parameter, so the conversion relies on the session's NLS settings.
    When there's no DEFAULT clause, the TO_TIMESTAMP function uses an explicit format :
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
      COLUMNS dt timestamp --default systimestamp
      ) x
    rewritten to :
    SELECT CAST(
             TO_TIMESTAMP(
               SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/DOC/DT'),0,0,20971520,0),50,1,2)
             , 'SYYYY-MM-DD"T"HH24:MI:SSXFF'
             AS timestamp --default systimestamp
           ) "DT"
    FROM TABLE("SYS"."XQSEQUENCE"(EXTRACT("SYS"."XMLTYPE"('<DOC><DT>2013-08-14T15:08:31</DT></DOC>'),'/DOC'))) "KOKBF$"
    so yes, maybe there's a bug here.
    Edit: A little more followup.
    This works:
    select x.*
    from
    xmltable('/DOC' passing xmltype('<DOC></DOC>')
      COLUMNS dt date default sysdate) x;
    Actually no, it doesn't work. Granted, maybe it doesn't produce any error, but the result is incorrect.
    As explained, the conversion relies on the session NLS (NLS_DATE_FORMAT in this case) :
    SQL> show parameters nls_date_format
    NAME                                 TYPE        VALUE
    nls_date_format                      string      DD/MM/RR
    SQL>
    SQL> select sysdate from dual;
    SYSDATE
    16/08/13
    SQL> select x.*
      2  from
      3  xmltable('/DOC' passing xmltype('<DOC></DOC>')
      4    COLUMNS dt date default sysdate) x;
    DT
    13/08/16
    Oracle first converts SYSDATE to a string using current NLS_DATE_FORMAT, resulting in '16/08/13'
    Then this string is converted to a DATE using the xs:date format 'YYYY-MM-DD' resulting in 13/08/0016 (August 13, 0016) which is incorrect.
    The obvious workaround to this issue is to control how Oracle implicitly converts from string to date/timestamp format :
    SQL> alter session set NLS_TIMESTAMP_FORMAT= 'YYYY-MM-DD"T"HH24:MI:SS';
    Session altered.
    SQL> select x.*
      2  from
      3  xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
      4    COLUMNS dt timestamp default systimestamp
      5    ) x;
    DT
    2013-08-14T15:08:31
    SQL> select x.*
      2  from
      3  xmltable('/DOC' passing xmltype('<DOC></DOC>')
      4    COLUMNS dt timestamp default systimestamp) x;
      COLUMNS dt timestamp default systimestamp) x
    ERROR at line 4:
    ORA-01861: literal does not match format string
    SQL> select x.*
      2  from
      3  xmltable('/DOC' passing xmltype('<DOC></DOC>')
      4    COLUMNS dt timestamp default cast(systimestamp as timestamp)) x;
    DT
    2013-08-16T12:32:58

  • Caching XQuery Result in OSB for Performance Improvement

    Hi,
    I have written a custom XPath function in Java to pick the IP address of the machine and registered the same with Oracle Service Bus 11g.
    In the Proxy Message Flow, the server IP is picked at run time by using XQuery that refers to the Custom Function.
    Now, is there a way to cache this result some where in OSB so that in the subsequent execution, the XQuery will pick the cached value from Cache instead of making a call to Custom Function registered with OSB.
    I'm asking this question to understand if performance optimization is possible here by caching the result.
    Thanks,
    CC

    Hi All,
    Have implemented Java Callout and Custom XPath in the same flow and kept current datetime stamp before and after each of these steps to calculate the difference b/w timestamps thereby finding the execution times of Java Callout and Custom XPath steps (this may not be an elegant way of calculating the execution time of each step in OSB message flow, request someone to suggest the most recommended approach here!) ...
    For a load of 10 users, each submitting 10 requests (total 100 requests), following are the execution times (in milliseconds) collected for 10 requests (Server is not occupied with any other activity at this time):
    Java Callout(milliseconds) |     Custom XPath(milliseconds)
    13 |     1
    4 |     0
    5 |     1
    1 |     2
    0 |     1
    1 |      0
    1 |     0
    1 |     0
    1 |     0
    1 |     2
    Where the value of '0' is appearing, I assume it could be some micro seconds. The difference happens to be zero in some cases as we don't have microsecond level logging.
    Thanks,
    CC
    Edited by: Chandu on 19-Jul-2011 22:02

  • SQL History not sorting by timestamp; new v4 TS format ?

    I was worried that  my SQL History was not accumulating post upgrade, as it did not appear as I expected.
    I typically sort it by descending timestamp, but I'm finding that since installing the 4.0 production version that a different timestamp format on SQL History has taken hold, ignoring the NLS settings that I put in my preferences (which were not the default ones by the way for my territory and language, by the way).  
    I migrated all my settings from the previous installation I had ...sqldev4 ea3.  previous migrations from v3 to v4 ea1 to v4 ea2 to v4 ea3 never disrupted my SQL History.
    Now my recent entries are buried in the SQL History and won't show on top anymore, and the sorting by timestamp seems erratic making it impossible to see a chronological order of SQLs executed before and after the migration.
    Is there a control for formatting the SQL History timestamps or do I need to go spelunking through xml files to alter a setting ?
    Curiously,
    Steve 

    A timestamp found inside one of my older  "history.xml"  files looks like this:
    <timestamp><![CDATA[12/11/13 2:18 PM]]></timestamp>
    A newer one looks like this:
    <timestamp><![CDATA[12/17/13 20:54]]></timestamp>
    It would probably give Xquery fits reconciling the different formats, sorting, eliminating older SQLs in the history according to one's preferences inside SQL Developer 4, etc.
    I'm going back to the last early adopter release just to preserve history and sequence until the tool makers resolve the timestamp and the weird sort order problem.

  • ORA-00939: too many arguments for function using Timezones in xquery

    Running on Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    CREATE TABLE "ORT"."SAMPLE"
       ( "THEDATE" DATE,
    "THETIMESTAMP" TIMESTAMP (6),
    "STARTTIMESTAMP" TIMESTAMP (6) WITH LOCAL TIME ZONE,
    "ENDTIMESTAMP" TIMESTAMP (6) WITH LOCAL TIME ZONE
    REM INSERTING into SAMPLE
    SET DEFINE OFF;
    Insert into SAMPLE (THEDATE,THETIMESTAMP,STARTTIMESTAMP,ENDTIMESTAMP) values (to_date('13-06-10 14:07:52','RR-MM-DD HH24:MI:SS'),to_timestamp('13-06-19 14:27:52.000000000','RR-MM-DD HH24:MI:SS.FF'),to_timestamp('13-06-19 10:34:04.586000000','RR-MM-DD HH24:MI:SS.FF'),to_timestamp('13-06-19 15:05:38.805000000','RR-MM-DD HH24:MI:SS.FF'));
    following query raises ora-00939
    SELECT XMLQUERY('for $v in fn:collection("oradb:/ORT/SAMPLE")
    let $date1 := $v/ROW/STARTTIMESTAMP/text()
    let $date2 := $v/ROW/ENDTIMESTAMP/text()
    return if ($date1 < $date2) then (concat($date1," date is less than ", $date2)) else (concat($date1," date is greater than ", $date2)) ' returning content) from dual;
    ORA-00939: too many arguments for function
    00939. 00000 -  "too many arguments for function"
    *Cause: 
    *Action:
    any ideas?

    Hi Odie,
    Not too familiar with XQuery rewrite, but i suspect by providing this hint, Oracle cannot optimize the query whatsoever.... tried this hint in my actual query and basically hangs.... I will attempt at opening an SR with Oracle...
    the other option i'm looking at is checking the date ranges outside of xquery, and using a mix of xmltable, xmlexists and the SQL XML functions to reconstruct my xml.

  • Xquery string for taking out repeated data

    I receive an xml like this from a service:
    <mov>
    <id>123</id>
    <timestamp>2009-06-15-13.38.50.148244</timestamp>
    <data>some data for id 123</data>
    </mov>
    <mov>
    <id>456</id>
    <timestamp>2009-06-15-15.00.50.148244</timestamp>
    <data>some data</data>
    </mov>
    <mov>
    <id>123</id>
    <timestamp>2009-06-15-21.30.50.123240</timestamp>
    <data>updated data for id 123</data>
    </mov>
    (well, there are around 100 movs in a 300kb xml file)
    I have to update a database table (whose primary key is id) with the received data.
    They aren't suposed to send me repeated <id> values in one xml .. but it is happening once and again, as in the sample above with id=123 , so my merge obviously fails with an oracle error as it is unable to get a consistent set of records for the update.
    Is there any XQuery expression to eliminate in the xmltable the <mov> with the repeated id value?
    Specifically, I want to get rid of the first mov (the oldest one based on timestamp).
    If the timestamp comparison is hard to achieve, getting rid of the prior movs for the same id would do.
    Thanks.

    Hi,
    You could do it in SQL :
    WITH t AS (
    SELECT xmltype('<root>
    <mov>
    <id>123</id>
    <timestamp>2009-06-15-13.38.50.148244</timestamp>
    <data>some data for id 123</data>
    </mov>
    <mov>
    <id>456</id>
    <timestamp>2009-06-15-15.00.50.148244</timestamp>
    <data>some data</data>
    </mov>
    <mov>
    <id>123</id>
    <timestamp>2009-06-15-21.30.50.123240</timestamp>
    <data>updated data for id 123</data>
    </mov>
    </root>') doc
    FROM dual
    SELECT id, tstamp, data
    FROM (
      SELECT id,
             to_timestamp(tstamp,'YYYY-MM-DD-HH24.MI.SS.FF') tstamp,
             data,
             row_number() over( partition by id
                                order by to_timestamp(tstamp,'YYYY-MM-DD-HH24.MI.SS.FF') desc ) rn
      FROM t, XMLTable(
       '/root/mov'
       passing t.doc
       columns
        id         number path 'id',
        tstamp     varchar2(30) path 'timestamp',
        data       varchar2(4000) path 'data'
      ) x
    WHERE rn = 1;With XQuery only, as you've foreseen, it's not easy to deal with timestamps (at least in the format you get them).
    Below, an example retrieving only the last occurrence of each id (your 2nd option) :
    WITH t AS (
    SELECT xmltype('<root>
    <mov>
    <id>123</id>
    <timestamp>2009-06-15-13.38.50.148244</timestamp>
    <data>some data for id 123</data>
    </mov>
    <mov>
    <id>456</id>
    <timestamp>2009-06-15-15.00.50.148244</timestamp>
    <data>some data</data>
    </mov>
    <mov>
    <id>123</id>
    <timestamp>2009-06-15-21.30.50.123240</timestamp>
    <data>updated data for id 123</data>
    </mov>
    </root>') doc
    FROM dual
    SELECT x.id,
           to_timestamp(x.tstamp,'YYYY-MM-DD-HH24.MI.SS.FF') tstamp,
           x.data
    FROM t, XMLTable(
    'for $i in distinct-values($d//mov/id)
      return $d//mov[id=$i][last()]'
    passing t.doc as "d"
    columns
      id      number         path 'id',
      tstamp  varchar2(30)   path 'timestamp',
      data    varchar2(4000) path 'data'
    ) x;Edited by: odie_63 on 27 avr. 2010 12:51

  • Each time I try to synch photos from my Windows 7 PC to my iPad2, iTunes stops working, and the error report says Problem Event Name:     APPCRASH   Application Name:     iTunes.exe   Application Version:     10.3.1.55   Application Timestamp:     4deec35

    Each time I try to synch photos from my Windows7 PC to my iPad2, iTunes stops working and the error message is:
    Problem Event Name:                          APPCRASH
      Application Name:                             iTunes.exe
      Application Version:                           10.3.1.55
      Application Timestamp:                    4deec351
      Fault Module Name:                          ntdll.dll
      Fault Module Version:                        6.1.7601.17514
      Fault Module Timestamp:                 4ce7ba58
      Exception Code:                                  c0000005
      Exception Offset:                                0002e3fb
      OS Version:                                          6.1.7601.2.1.0.768.3
      Locale ID:                                             1033
      Additional Information 1:                  0a9e
      Additional Information 2:                  0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:                  0a9e
      Additional Information 4:                  0a9e372d3b4ad19135b953a78882e789
    I reloaded iTunes 10 (64 bit) successfully, but the problem remains the same.
    Any suggestions?

    I looked in the folder from which I want to synch photos, but there is no such thing as an "ipod photo cache" in that folder, or sub-folders, as suggested in the link which you were nice enough to provide.
    I have also tried removing photos from my iPad2 Photos App, and "iTunes has stopped working" shows up  again as soon as I click on the "Synch photos from" button.

  • Changing of the timestamp in sender file adapter in archive mode

    Hi,
    I have a requirement where in I have to archive a file with timestamp different from that generated by XI.
    Please let me know if this can be done and if so how can we handle the changes to be made to the timestamp in the sender adapter in archive mode.
    regards,
    Srinivas.

    Srinivas,
    Option 1) Create a bat file..to run the perl script you call..
    Perl script..
    #!/usr/bin/perl -w
    print("Starter that you want to change: ");
    chomp($badex = <STDIN>);
    print("Starter that you want added: ");
    chomp($goodex = <STDIN>);
    foreach $file (<$badex*>){
        @fields = split(/$badex/,$file);
        $goodfile = ("$goodex" . "$fields[1]");
        rename("$file","$goodfile");
    Run that on the os
    That should fix it.........
    Option 2) On your local Machine create a java file..add this code to it
    public class Utils
         public static int Randomizer(){
              int randomInt = 0;
              randomInt = (int) (Math.random()*1000);
              return randomInt;
    public static void main(String[] args)
         Randomizer();
    save and compile..
    Create a bat file to add the number returned from the random to your targetFilename
    so it would be something like..
    mv oldFileName Newfilename+randomizer... and also get this command written to a file..helpful later on.........
    Hope that helps
    Regards
    Ravi Raman
    PS:Dont forget the points if helpful

  • Adding Hours To Timestamp Values In A Materialized View

    Is it possible to add x hours to a TIMESTAMP column in a materialized view?
    (I'm using Oracle 10g.)

    In what context?
    DOM@DOM11gR1>CREATE MATERIALIZED VIEW mv1
      2  AS
      3  SELECT SYSTIMESTAMP ts1,SYSTIMESTAMP + 6/24 ts2, SYSTIMESTAMP + INTERVAL '6' HOUR ts3
      4  FROM DUAL;
    Materialized view created.
    DOM@DOM11gR1>desc mv1
    Name                                                              Null?    Type
    TS1                                                                        TIMESTAMP(6) WITH TIME ZONE
    TS2                                                                        DATE
    TS3                                                                        TIMESTAMP(9) WITH TIME ZONE
    DOM@DOM11gR1>select ts1, to_char(ts2,'DD/MM/YYYY HH24:MI:SS') ts2, ts3 from mv1
      2  /
    TS1                                      TS2                 TS3
    15-SEP-09 17.50.44.681271 +01:00         15/09/2009 23:50:44 15-SEP-09 23.50.44.681271000 +01:00
    DOM@DOM11gR1>

  • A Security Weakness When Signing without a Timestamp

    Hi Guys,
    I am exploring the need of timestamping PDF documents using Adobe Acrobat wrt security. I see a lot of signatures made without timestamps and I see an issue here mentioned below. If my assumption is valid then Ideally Adobe Acrobat should strongly mandate to use timestamps with revocation information.
    The scenario:
    A user uses a high trust credential to legitimately sign PDF documents but chooses not to use a Timestamp to avoid costs.  These documents have an embedded signature plus the signer’s certificate chain CRLs and/or OCSP responses (but no trusted timestamp).
    At a point in time (let’s say 1 June 2012) the credential and PIN is stolen.   If the theft is before the end of validity period the credential is of course revoked. However if the theft is of an expired credential it can’t be revoked and most people would not notice and perhaps would not even care.  Let us further assume the thief gains access to a number of old signed documents.  Of course in theory this is not a problem, because these documents are signed and therefore protected and can’t be changed. However the thief now has access to a range of valid CRLs and/or OCSP responses that were properly valid from before the theft and can use them to their advantage.  These documents may even be widely published or perhaps received anyway by an insider thief.
    The thief can use the stolen credential and can sign a document at any date/time of their choosing up to 1 June 2012 (by varying their local system date/time) to one that lies within the validity period of any previous OCSP/ CRL data they have captured. Even though the signature covers the validation data this is all done at what seems like a legitimate time. 
    Trust Threat Analysis:
    A stolen credential and PIN can easily be used at a local desktop time (set to anything you like).  With PDF editing software – no problem for a hacker of course – you can embed a CRL that shows the stolen credential as good during any period up to the revocation or expiry.  The hacker just needs to select a signing date/time that is within a CRL validity period for one of the CRLs they have access to.  The selected CRL is then re-used as part of the signing process on a fraudulent document.
    It is now up to the receiving software to make the right trust decision – and a trusted timestamp should always be used to make a trustworthy historic decision.  If there is no embedded trusted timestamp the receiver software could decide to verify the signature at (a) the current time or (b) the (untrusted) time indicated by the signer.  Any software that uses option (b) and trusts the (untrusted) time in the signature rather than defaulting to current time creates a substantial trust issue.  The whole purpose of using and attaching a valid, trusted signature time stamp is to independently confirm the accurate date/time of (potentially untrusted) third party signing events.  The timestamp cannot be re-used since it covers the signature details.  Any substantial variance in time between the signer’s time and the timestamp time is peculiar but systems should always default to trusting the signature timestamp date/time.
    Ideally PDF signing software used by a signer that fails to obtain a timestamp should not allow the document to be signed.  If the policy is to sign with a long-term signature then the timestamp must be present to confirm the time.  Some software products create confusion by allowing the timestamp to be missed if it cannot be obtained.  This means that a document that should have a life of several months or years should actually be seen to have an issue immediately after certificate revocation or expiry (could be in a few days or months).  Using such software, users will not be aware of the issue until the problem has manifested itself.
    Any Comments?
    Regards,
    Wahaj

    The settings for the warning messages have been removed from the user interface (Bug 513166).
    You need to change the related security.warn_* prefs directly on the <b>about:config</b> page.<br />
    Filter: security.warn
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    *Use the Filter bar at to top of the about:config page to locate a preference more easily.
    *Preferences that have been modified show as bold(user set).
    *Preferences can be reset to the default or changed via the right-click context menu.

  • URGENT HELP NEEDED FOR TimeStamp

    Urgent Millisecond Question....
    I have the Java Code which used to work well in Oracle 8 and Sybase ..
    When I am using it with Oracle 9.2 it creating a problem...
    The code is
    final public JDatetime getJDatetime(int columnIndex) throws SQLException {
         boolean convertb = Util.needConvertTime();
         Timestamp ts=_rs.getTimestamp(columnIndex);
         if(ts==null) return null;
         Date d= new Date(ts.getTime() + (ts.getNanos()/1000000));
         if(convertb) d = Util.ReferenceTZ2Local(d);
         return new JDatetime(d);
    Now in Oracle 8 Say when I insert a
    JDateTime Value as 2003-06-18 16:51:06.89
    and
    When I retrieve is using above getJDatetime
    it get retrieved as
    2003-06-18 16:51:06.0
    Which is ok since Milliseconds are lost....
    Now in Oracle 9
    When I use the convert
    Date d= new Date(ts.getTime() + (ts.getNanos()/1000000));
    It get converted to
    Original Value While Inserting -->TimeStamp in JResultSet->2003-06-18 18:15:56.42
    Date in JResultSet-->Wed Jun 18 18:15:56 GMT 2003
    Date in JResultSet after converting to ReferenceTZ
    Wed Jun 18 18:15:56 GMT 2003
    DateTime in JResultSet after converting to DateTime6/18/03 6:15:56.840 PM
    GMTGETDatetime 6/18/03 6:15:56.840 PM GMT
    so if you see
    Milliseconnd 42 got converted to 840 NanoSeconds
    WHICH IS WRONG
    Can anybody help me with it ??
    Mahesh

    The only Adobe program I know that can edit images is Photoshop.
    If you have troubles with Google software, you need to post in the appropriate Google forum.

  • Loops and system timestamp not synchronized

    Running Labview 8.6.1 on Windows 2000, loops and system timestamp (Windows clock) seem to use different time bases; one second in a loop is not exactly as long as a second in system time. If i run a simple VI as in picture, with a 1-second loop which just prints the system time, the printed timestamp goes faster by about 1ms every 4-5 seconds. The same happens using a Timed loop or a While with a Wait until next ms multiple.
    Why is that? Can i set a loop to match the system time?
    Attachments:
    1sec.png ‏3 KB

    johnsold wrote:
    In the eastern U. S. interconnected power grid the accumulated time is held to within a small fraction of a second when averaged over days.  Over a year the accumulated error is less than parts in 10^12 or better.  The instantaneous frequency can deviate from the nominal 60 Hz by less than 0.1 Hz.
    The system basically uses an integral controller referenced to a NIST atomic clock to force the steady state error to zero.
    Lynn 
    So is that a very technical way of saying "Ben, you are full of Sh#% !"*
    I have not measured the frquency of my AC service in the last three decades or so. I do remember seeing it faster in the summer and slower in the winter. Has it really changed? Silly me thinking that the wide freq input spec I read on wall-warts was there just to handle this variation of freq.
    And to think it has gotten smarter "without a brain".
    Ben
    * I am just trying to catch up what I seem to have missed. The above is all in good humor. No offense intended or taken.
    Message Edited by Ben on 08-03-2009 12:56 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Get millisecond values from timestamp column in v$logmnr_contents

    Hello
    How do we get millisecond values from timestamp column in v$logmnr_contents.
    I tried with following query.
    select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
    it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
    if i query with out FF in time format i get like
    scn timestamp
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    if scn is derived from timestamp with milliseconds, each scn should be different right?More help please

    May be there's an easy way solving your problem, I did it like that:
    CREATE TABLE quota_test (test VARCHAR2(50))
    INSERT INTO quota_test
    VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
    SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
    FROM quota_test
    Result is :
    NORMAL
    update "SCOTT"."NEWTAB1" set a="34" and b="45"      
    CHANGED
    SCOTT.NEWTAB1
    If you didn't understand, I can explain what I wrote

Maybe you are looking for

  • Printing List view/CRM4Mac

    For those of you wanting to print list views with only dates that have events, CRM4Mac allows you to do this for events (no To Do's, yet.) CRM4Mac (Contact Relations Management for Mac) might be worth folks taking a look at: http://www.crm4mac.com/in

  • Can not get access files from Windows 7 to Claims-based file authorization share

    We have AD level 2012R2, DCs running 2012R2 of course, and we have clustered File Server (3 FSNodes running 2012R2). We enabled 2 policies  KDC Support for claim Kerberos support for claim We created 1 claim type in ADAC (For example "Division" Sourc

  • Urgent plz help me......plz

    Am very nem to jsp. am doing my final year project in jsp. I want to retreive value in the textbox depending on the selectino made in the dropdown. in the dropdown menu i retrieve employee id frm backend. n in the textbox i shuld get employee name de

  • Issue with Fusion drive (Late 2012 iMac)

    I have a late 2009 iMac that has been backed up with Time Machine.  I recently picked up a late 2012 iMac with the 1TB Fusion drive.  When I first plugged in my Time Machine drive, I was asked if I'd like to transfer my files over.  I did, and everyt

  • Illustrator CS3: Very Slow Open, Very Slow Save

    Hello all, I just recently have been issues with Illustrator CS3. Up until about a few weeks ago, it had been running flawlessly. Now, whenever I try to open up any EPS or AI, Illustrator will literally take at least a minute to open it. This happens