Date format in XML sys.dbms_xmlgen

hello all,
i have posted this question in "general XML " forum also....so please dont mind
i am using following query to generate insert SQL statements
SELECT
'insert into ' || table_name || ' (' || (select rtrim(extract(xmlagg(xmlelement(e, t.column_value.getrootelement() || ',')),'//text()'),',') from table(xmlsequence(t.column_value.extract('ROW/*'))) t) || ') values (' ||
(select dbms_xmlgen.convert(rtrim(extract(xmlagg(xmlelement(e, '''' || t.column_value.extract('//text()') || ''',')),'//text()'),','),1) from table(xmlsequence(t.column_value.extract('ROW/*')))t) || ');' ins_stmt
from user_tables,
table(xmlsequence(dbms_xmlgen.getxmltype('select * from ' || a_TblName ||' WHERE MODIFIEDON >'||a_date).extract('ROWSET/ROW'))) t
where table_name in (select table_name from user_tables where table_name =a_TblName);but when i execute the procedure as
sql> exec   Gen_Insert_Statement('11-jun-2009');
ORA-19202: Error occurred in XML processing
ORA-00904: "JUN": invalid identifier
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
ORA-06512: at "MRILDATA17TEST.GEN_INSERT_STATEMENT", line 22
ORA-06512: at line 2     and if i do this
SQL> exec Gen_Insert_Statement('11-06-2009');
begin Gen_Insert_Statement('11-06-2009'); end;
ORA-01843: not a valid month
ORA-06512: at line 2is there any format to pass date while using XML packages??? i am also not getting in which this issue is occuring??
any suggestion will be appreciable
thanks and regards
VD
Edited by: dixit on Aug 13, 2009 6:15 AM

thanks for not replying

Similar Messages

  • Date format in xml file

    Hi,
    I am relatively new to XML and JSP.I am on a project where i have to transfer data to and from an Oracle 8i database to XML using JSP.everything worked fine except for the follwing:
    the date format in xml is always 'yyyy-mm-dd HH:MM:SS'.
    the datatype is date in oracle and string in jsp.when i try to upload the data in XML to oracle it gives me date format not recognised error.I ve tried using trunc and to_char in the query which fetches records into a recordset in JSP but to no avail.i keep getting the same format.
    Can someone please help with with having the date format as 'dd-mon-yyyy'.
    Thanks a heap for the help
    regards,
    Vinayak

    Hi,
    I ve tried out the solutions suggested by you and tried using java.sql.Timestamp
    as follow:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="oracle.sql.*" %>
    String dateString = rset.getString("installation_dt");
    java.sql.Timestamp date = new java.sql.Timestamp.valueOf(dateString);
    But tomcat throws up the following error
    :104:
    cannot resolve symbol
    symbol : class valueOf
    location: class java.sql.Timestamp
    java.sql.Timestamp date = new java.sql.Timestamp.valueOf(dateString);
    Hope you can help me.
    Thanks a heap
    Regards,
    Vinayak

  • How to change the date format in xml form?

    hi,
    How to change the date format in xml form?
    For example:  11/20/2008 3:00:03 PM    ->   11-20 03:00
    Any opinions greatly appreciated!
    Thanks.
    Edited by: ke wenxing on Dec 2, 2008 8:33 AM

    You could go to System - User Profile - Own Data would take you to the "maintain user profile screen"
    Click the defaults button and change the date format.This changes date format for all the dates in your login.

  • Date format in XML conversion

    Hello,
    I am using oracle8i. The date format is not giving the proper date values in XML conversion..
    create table test(dt date);
    insert into test values(sysdate);
    insert into test values(sysdate);
    insert into test values(sysdate);
    TEST.WORLD> select * from test;
    DT
    28-NOV-04
    28-NOV-04
    28-NOV-04
    set autoprint on
    set long 100000
    set linesize 100000
    set longchunksize 100000
    var g_clob clob
    declare
    l_ctx dbms_xmlquery.ctxType;
    l_clob clob;
    begin
    l_ctx := dbms_xmlquery.newContext('select dt from test');
    dbms_lob.createtemporary(:g_clob,true,dbms_lob.session);
    dbms_xmlquery.setdateformat(l_ctx,'yyyy-mm-dd');
    :g_clob := dbms_xmlquery.getXml(l_ctx);
    end;
    Here is the output . It is dispalying the 03 For the month november.
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <DT>2004-03-28</DT>
    </ROW>
    <ROW num="2">
    <DT>2004-03-28</DT>
    </ROW>
    <ROW num="3">
    <DT>2004-03-28</DT>
    </ROW>
    </ROWSET>

    When you call DBMS_XMLQUERY.SETDATEFORMAT, you must supply the mask using the syntax defined by java.text.SimpleDateFormat.
    You need to use "yyyy-MM-dd".
    In your case, "yyyy-mm-dd", the lower case "mm" is the mask for minutes.

  • Changing date format in XML form!!

    Hi,
    I have created a form by using XML form builder.I have many date fields in the form. I want to change the date format of date field from default MM.DD.YY to DD.MM.YYYY.
    Helpful answer will be appreciated with points.
    Regards,
    Dharam

    Hi Dharam,
    you can change the date format in the KM Layout set as described here:
    https://www.sdn.sap.com/irj/sdn/thread?threadID=240057
    but the XML Forms functionality does not refer to the additional format information set on he property as you can read here:
    https://www.sdn.sap.com/irj/sdn/thread?threadID=105044
    Hope this helps,
    Robert

  • Strange date format from XML

    Hi There!
    We have an XML that we read into an XMLtype - and at a time we want to display it in a normal date type....
    Its formatted as this: '2007-02-20T09:30:47.0Z' (Zero 0) - I guess it means no timezone in some ISO 86* standard
    select TO_date('2007-02-20T09:30:47.0Z','YYYY-MM-DD"T"HH24:MI:SS.??????') from dual;
    I have trie to find a format for reading it ... do you have an idea?
    regards
    Mette

    Sorry, forgot to say that some of the dates in the XML field is in this format
    '2007-02-20T09:30:47+100 ...... (yyyy-mm-dd"T"hh:mi:ssstzhtzm)
    /Mette

  • How to change date format for xml insert to a view

    We want to accept more than one data format in an XML insert using DBMS_XMLSave.insertXML(insCtx,xmlDoc);
    The two formats are
    6/7/2004 10:47:21 - This is working
    2004-06-08-04:00 - This gives the error
    java.text.ParseException: Unparseable date: "2004-06-08-04:00"'

    Make the column datatype VARCHAR2

  • Independently configure date format for XML/JSON serialization

    How do I configure the date format independently for each of my date fields?
    For example, let's say I have a CustomerOrder class with more than 1 java.util.Date fields in it.
    I need to be able to render like this:
    <customerOrder>
    <orderDate>2013-01-04T20:50:42.769Z</orderDate>
    <user>Bob</lastUpdateUser>
    <state>CO</state>
    <estShipDate>2013-01-04</estShipDate>
    </customerOrder>
    So one of the dates may not care about the hh:mm:ss.
    i.e. I cannot format every date the same way.
    Any ideas?
    This is my technology stack:
    - Tomcat 7
    - Jersey 1.16
    - Enunciate 1.26.2
    - Spring 3.1.2
    - Hibernate 4.1.7
    - JPA 2.0.3

    Otis,
    A "java.sql.Date" contains only a date, whereas a "java.sql.Timestamp" contains both date and time. So retrieve the data (from the database) as a "Timestamp" and not as a "Date".
    Perhaps if you'd care to post the relevant part of your code and show what you are getting and what you want to get, I may be able to help you further.
    Here's a small (uncompiled and untested) example:
    Connection conn = // However you get it.
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select sysdate from dual");
    if (rs.next()) {
      Timestamp ts = rs.getTimestamp(1);
    }Good Luck,
    Avi.

  • Date format in XML Forms

    Hi all,
    I already have done my article using XML FORMS. I added into the article the date field that I needed. So, I would like to format the date output in Render List as “dd/mm/yyyy” instead of “mm/dd/yyyy”. It’s possible? Anyone knows how to do it?
    Thanks in advanced,
    Alcides Flach

    Hi,
    By adding in the Additional Metadata parameter the  entry "customFormat=dd.MM.yy", you'll force the display of this property to this format. Look at SAP note 816761 for more info about this.
    Patricio.

  • Date format for XML

    I have a Date object and I want it to be in the below format before I set it into a Calendar
    2009-10-09T17:00:00Z
    Here's my code
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    How do I do that?
    Thanks

    user8742475 wrote:
    Here's my code
    String dateString = "2011-09-08T00:00:00-0700-07:00";
    SimpleDateFormat dfISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    Date dt= dfISO8601.parse(dateString);
    Calendar cal = Calendar.getInstance();
    cal.setTime(dt);
    customObject.setDStartDate(cal); //customObject is a WS object of Oracle CRM On Demand. I downloaded the WSDL and generated the proxy for it. It accepts a Calendar object
    Some possible solutions.
    1. It will also accept something else. I suggest using the SimpleDateFormat to produce a string and use that and nothing else.
    2. It won't accept anything else. Then you are left with the possibility that the WSDL is wrong (somehow) So you find a way to work around it which might include not using the WSDL at all.
    3. Depending on how setDStartDate() works you might be able to create a proxy Calendar class, your own implementation, specifically replacing toString() with a correct format based on SimpleDateFormat.

  • Issue with Date format - ABAP to XML

    Dear Users,
    We are currently facing an issue with the date formats in XML.
    We have a system (.Net), which has a webservice that we are calling for information from SAP. We created a Proxy class in SAP from the WSDL file and have attempted to use the method that gets us required information based on the Timestamp passed from SAP. However, the timestamp that the INPUT structure uses has a data element XSDDATETIME_Z.
    All we can send from SAP is a simple TIMESTAMP, but the .Net system doesn't accept it since it wants the timestamp in XML format i.e. <dd-mm-yyyy>T<hh:mm:ss>Z. SAP documentation says that the field should automatically do conversion from ABAP to XML format, but that doesn't happen. We don't want to build a string from Timestamp in the XML format and send it out since we might surely miss out on the different cases involved.
    Can anyone please suggest a way for us to send the date out in the required XML format?
    Many thanks!

    Hi Vijay,
    Look at the below sample code and it works fine, i guess there is something wrong in your code or conversion, post the actual code if you are still not able figure it out with the below example.
    DATA: l_xml_string TYPE string,
          l_dat_time TYPE xsddatetime_z.
    CALL FUNCTION 'CACS_DATE_GET_TIMESTAMP'
    EXPORTING
       I_DATE                         = sy-datum
       I_TIME                         = sy-uzeit
    IMPORTING
       E_TIMESTAMP                    = l_dat_time
    EXCEPTIONS
       DATE_NOT_FILLED_BUT_TIME       = 1
       DATE_HAS_NO_VALID_FORMAT       = 2
       OTHERS                         = 3.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL TRANSFORMATION id
      SOURCE root = l_dat_time
      RESULT XML l_xml_string.
    IF sy-subrc EQ 0.
    write: l_xml_string.
    ENDIF.
    Regards,
    Chen

  • Passing date format in sys.dbms_xmlgen

    hello all,
    i am using following query to generate insert SQL statements
    SELECT
    'insert into ' || table_name || ' (' || (select rtrim(extract(xmlagg(xmlelement(e, t.column_value.getrootelement() || ',')),'//text()'),',') from table(xmlsequence(t.column_value.extract('ROW/*'))) t) || ') values (' ||
    (select dbms_xmlgen.convert(rtrim(extract(xmlagg(xmlelement(e, '''' || t.column_value.extract('//text()') || ''',')),'//text()'),','),1) from table(xmlsequence(t.column_value.extract('ROW/*')))t) || ');' ins_stmt
    from user_tables,
    table(xmlsequence(dbms_xmlgen.getxmltype('select * from ' || a_TblName ||' WHERE MODIFIEDON >'||a_date).extract('ROWSET/ROW'))) t
    where table_name in (select table_name from user_tables where table_name =a_TblName);but when i execute the procedure as
    sql> exec   Gen_Insert_Statement('11-jun-2009');
    ORA-19202: Error occurred in XML processing
    ORA-00904: "JUN": invalid identifier
    ORA-06512: at "SYS.DBMS_XMLGEN", line 288
    ORA-06512: at line 1
    ORA-06512: at "MRILDATA17TEST.GEN_INSERT_STATEMENT", line 22
    ORA-06512: at line 2     and if i do this
    SQL> exec Gen_Insert_Statement('11-06-2009');
    begin Gen_Insert_Statement('11-06-2009'); end;
    ORA-01843: not a valid month
    ORA-06512: at line 2is there any format to pass date while using XML packages??? i am also not getting in which this issue is occuring??
    any suggestion will be appreciable
    thanks and regards
    VD
    Edited by: dixit on Aug 13, 2009 6:15 AM
    Edited by: dixit on Aug 13, 2009 6:21 AM

    The date issue is coming from
    dbms_xmlgen.getxmltype('select * from ' || a_TblName ||' WHERE MODIFIEDON >'||a_date)It is due to the implicit conversion from the internal Date object type to a String type for display. The format is based off the NLS_DATE_FORMAT so varies from system to system. When dealing with dates, it is always best to use either to_char or to_date to ensure there are no errors in converting from one format to the other. That would include adding to_date with a format mask making it part of your Select SQL statement around a_date, such as to_date(a_date, 'DD-MON-YYYY')
    Also, if you have any dates in the tables that are being queried, you will run into a similar implicit conversion issue. Oracle does not format dates in the proper XML format of YYYY-MM-DD when building XML in this manner as it uses the NLS_DATE_FORMAT. So you cannot guarantee the INSERT statement will work on another DB with a different NLS_DATE_FORMAT.
    As others have asked, why you are trying to build insert statements this way as there is a lot to take into consideration regarding data formats. It seems this has been discussed on the {forum:id=75} forum but that has been some time ago.

  • How to write the oracle data as XML format. (.XML file)

    create or replace procedure pro(p_number )
    is
    cursor c1 is select *from emp where empno=p_number;
    v_file utl_file.file_type;
    begin
    v_file := utl_file.fopen('dirc','filename.txt','w');
    for i in c1 loop
    utl_file.put_line(v_file,i.ename || i.empno ||i.job);
    end loop;
    closef(v_file);
    end;
    Now my client want instead of .txt file he need .xml files
    File should contains xml tags. can any one help regarding this.. with one example.
    How to write the oracle data as XML format. (.XML file)

    hi,
    hope this example will do something....
    SQL> select employee_id, first_name, last_name, phone_number
    2 from employees where rownum < 6
    EMPLOYEE_ID FIRST_NAME LAST_NAME PHONE_NUMBER
    100 Steven King 515.123.4567
    101 Neena Kochhar 515.123.4568
    102 Lex De Haan 515.123.4569
    103 Alexander Hunold 590.423.4567
    104 Bruce Ernst 590.423.4568
    SQL> select dbms_xmlgen.getxml('select employee_id, first_name,
    2 last_name, phone_number from employees where rownum < 6') xml
    3 from dual;
    *<?xml version="1.0"?>*
    *<ROWSET>*
    *<ROW>*
    *<EMPLOYEE_ID>100</EMPLOYEE_ID>*
    *<FIRST_NAME>Steven</FIRST_NAME>*
    *<LAST_NAME>King</LAST_NAME>*
    *<PHONE_NUMBER>515.123.4567</PHONE_NUMBER>*
    *</ROW>*
    *<ROW>*
    *<EMPLOYEE_ID>101</EMPLOYEE_ID>*
    *<FIRST_NAME>Neena</FIRST_NAME>*
    *<LAST_NAME>Kochhar</LAST_NAME>*
    *<PHONE_NUMBER>515.123.4568</PHONE_NUMBER>*
    *</ROW>*
    *<ROW>*
    *<EMPLOYEE_ID>102</EMPLOYEE_ID>*
    *<FIRST_NAME>Lex</FIRST_NAME>*
    *<LAST_NAME>De Haan</LAST_NAME>*
    *<PHONE_NUMBER>515.123.4569</PHONE_NUMBER>*
    *</ROW>*
    *<ROW>*
    *<EMPLOYEE_ID>103</EMPLOYEE_ID>*
    *<FIRST_NAME>Alexander</FIRST_NAME>*
    *<LAST_NAME>Hunold</LAST_NAME>*
    *<PHONE_NUMBER>590.423.4567</PHONE_NUMBER>*
    *</ROW>*
    *<ROW>*
    *<EMPLOYEE_ID>104</EMPLOYEE_ID>*
    *<FIRST_NAME>Bruce</FIRST_NAME>*
    *<LAST_NAME>Ernst</LAST_NAME>*
    *<PHONE_NUMBER>590.423.4568</PHONE_NUMBER>*
    *</ROW>*
    *</ROWSET>*
    ask if you want more assistance.
    thanks.

  • XML Publisher to Excel Report : Date format problem

    Hi,
    I am trying to create an Excel report with XML Publisher. I have an issue with the Date Fomatting.
    In the XML template, I have set the "Date" column in date format. But the excel output report "Date" column returns as "General text" (string) and it is sorted as text, not as date.
    Can anyone please help me out?
    Thanks!!!

    Hi,
    Did this post solve your problem? I have the same issue that I need to solve.
    I have an xsl-fo template with dates in it.
    The dates are in english.
    My excel is setup to use danish.
    When I export to excel it knows the month jan, feb, mar, apr, ... which are the same in danish and english.
    But months where it differs like may (danish maj) the cell is a general text instead of date.
    Is there anyway you can set/transform the date in the xsl-fo template so it does not care about the language in excel?
    Thank you in advance.
    BR Kenneth

  • URGENT: XML-SQL: Error parsing different date formats in the same XML file.

    Hi Everyone,
    I have a big problem while using the XML-SQL utility. I have a XML file with different date formats. I get exception like the one below.
    "oracle.xml.sql.OracleXMLSQLException: 'java.text.ParseException: Unparseable date:"
    And the XML file is :
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Info Key="ID">
         <Insert>
              <ID>1</ID>
              <BookingDate>10.12.2001</BookingDate>
              <OpeningTime>19:16</OpeningTime>
         </Insert>
    </Info>
    I have tried using different setDateFormat which is contrary.
    sav.setDateFormat("d.M.y");
    sav.setDateFormat("H:m:s");
    Can someone help me on the same.
    Thanks in advance.
    Subramanian.

    You might have to describe the columns as varchar then modify the table to the right format.

Maybe you are looking for

  • PDF documents suddenly not opening in Firefox 3.5.6

    I'm running Windows XP and using Adobe Reader 9.2 with Acrobat 6.0 installed. In the last couple of weeks Adobe Reader has suddenly stopped opening some PDF documents (but not all) in Firefox 3.5.6. The error message is attached.  "The Adobe/Acrobat

  • Router conflict with Roadrunner and/or their motorola modem

    I have owned a linksys router for over five years now and about 1 month ago my entire house comprised of 3 desktops one of which is wired directly to the router others are wireless, 4 laptops (wireless), 3 iphones, an xbox 360 (wireless), a ps3 (wire

  • Archiving customized tables

    Hi, I want to archive around 10 tables for the past 30 days.  i  have used the following code to archive for one table. * Internal table to store the records that was retrieved DATA :  BEGIN OF GET_TAB OCCURS 1000.         INCLUDE STRUCTURE ZFIT0056.

  • Did i loose all my data in my external hard drive?

    i just purchased a new i mac and i installed my western digital hard drive to it and i installed leopard. i clicked on the time machine icon and it asked me which drive to use for time machine and i selected the wd drive. then it told me that it woul

  • Can't paste into Dreamweaver CC 2014.1 after opening any browser on Windows 7 system...

    I couldn't paste anything in Design or Code view after updating to Dreamweaver CC 2014.1 this week on my Windows 7 system. I discovered that if I rebooted my computer and opened Dreamweaver without opening any browsers (have tried Chrome, Firefox, IE