Date format and XML (XmlType)
Hi allI'm trying to generate XML in PL/SQL.
select xmlelement("Date", sysdate).getClobVal() from dual;
XMLELEMENT("DATE",SYSDATE).GETCLOBVAL()
-------------------------------------------
<Date>2012-07-13</Date>
This is the date format, I was expecting (date format XML standard).And the Documentation of Oracle described:
"The XML schema standard specifies that the dates and timestamps in the XML are in standard formats. Generation of XML in Oracle XML DB functions produce dates XML and timestamps in accordance with this standard. »
When I want to create an XML from a query, I tried this
DECLARE
l_refcursor SYS_REFCURSOR;
l_xmltype xmltype;
l_ctx dbms_xmlgen.ctxHandle;
BEGIN
OPEN l_refcursor FOR select sysdate "Date" from dual;
l_ctx := dbms_xmlgen.newContext (l_refcursor);
dbms_xmlgen.setRowTag (l_ctx, null);
dbms_xmlgen.setRowSetTag (l_ctx, null);
l_xmltype := dbms_xmlgen.getXMLType (l_ctx);
dbms_xmlgen.closeContext (l_ctx);
dbms_output.put_line(l_xmltype.getClobVal());
END;
/
<Date>13-JUL-12</Date>
I was also expecting the date format XML standard, but I get the nls_date_format.Of course I can use to_char and specify the correct date format, or do an alter session (alter session set nls_date_format = 'RRRR-MM-DD';), but I wonder why XMLElement uses the standard and not the dbms_xmlgen.
Or y at - it another way to use the default XML standard?
Gert
Or y at - it another way to use the default XML standard?
You can return to the dbms_xmlquery based on java instead:
SQL> alter session set nls_date_format='rrrrhh24' ---just to show the result is independent from nls_format
/
Session altered.
SQL> declare
l_xmltype xmltype;
l_ctx dbms_xmlquery.ctxhandle;
begin
l_ctx := dbms_xmlquery.newcontext ('select sysdate "Date" from dual');
dbms_xmlquery.setrowtag (l_ctx, null);
dbms_xmlquery.setrowsettag (l_ctx, null);
l_xmltype := xmltype (dbms_xmlquery.getxml (l_ctx));
dbms_xmlquery.closecontext (l_ctx);
dbms_output.put_line (l_xmltype.getclobval ());
end;
/
2012-07-13 22:45:25
PL/SQL procedure successfully completed.
Tags: Database
Similar Questions
-
I'm working on a data model BI Publisher and I try to convert the Period_Name in GL_JE_Lines table to a date format and then return of the year.
The sql below works in 11i, but I can't make it work in Fusion.
to_char (to_date (l. )) period_name , ' MON-RR ' ),'YYYY')
Any ideas?Hi Jennifer,.
To_char (sysdate, 'DDMONYYYY') in BI Publisher does not return a correct results due NLS_DATE_FORMAT/DATE_LANGUAGE settings.
According to the standards of the I18N, NLS_DATE_LANGUAGE in the database is still hardcoded to NUMERIC_DATE_LANGUAGE. NUMERIC_DATE_LANGUAGE 'MY' in a date format mask is an integer, so you see the correct value.
You're not supposed to publish direct SQL with fixΘe format masks (unless it's some sort of canonical format used in internal processing, including the end-user will not be), you should return language digital date to the mid range and then make the formatting of y.
Workaround
Try adjusting the NLS_LANGUAGE in SQL data model to override formatting from of the
Data base and values of the Session, for ex: select to_char (sysdate, 'MON-DD-YYYY', 'NLS_DATE_LANGUAGE = AMERICAN') of double;
I got this Oracle support after lifting a SR.
Thank you
Rahul.
-
Hello
Is there a way to change the default rawValue of a date field. It seems that my default locale (Australia) D/MM/YY. I would like to make it appear as DD MMM YYYY.
I'm also trying to add it to a text field, for inclusion in mid-sentence, once a date has been selected, using the datefield.rawValue. The text field seems to show only in the form YYYY-MM-DD.
Thanks in advance for any help or discussion of this problem.
See you soon,.
Greig
Hello
You can use a model to display the date format in the way that you want.
date{DD-MMMM-YYYY}
To use the date formatting in another area see the formattedValue instead of the rawValue.
var d = datefield.formattedValue;
-
How to recover full date format and time of cursor Variable
Hi gurus,
I'm having this 'cable' question.
When I run this selection (below) of a table (a table with a date data type can be used for testing purposes)
Select max (crt_heure_entree) in the test.var_table_date MAX_DATE
MAX_DATE
-----------------------
21/12/2015-15:33:57
When I run inside a PL/SQL block
Declare
CRS1 DATE;
..
...
Select max (crt_heure_entree) as max_date in crs1 infapp.compte_rendu_traitement;
dbms_output.put_line ('MAX_DATE... » || TO_DATE (crs1,' DD/MM/YYYY HH24:MI:SS'));)
...
...
END;
I get
MAX_DATE
-----------------------
21/12/2015
Problem:
I need to get the full value date and the time to do a select and insert data between call dates and times.
Because the variable retrieves just the date I have problems of constraint violation.
Question:
How can I recover the full date / time format of cursor?
Thanks if you can help.
Format before you print using TO_CHAR
Here is the link for the Format of Date patterns
https://docs.Oracle.com/CD/B28359_01/server.111/b28286/sql_elements004.htm#CDEHIFJA
-
date formats and to_date
Hi all
I'm trying to insert a date with a statement like this
but I get error ORA-01843: not one month validto_date('13-DEC-09', 'dd-mon-yy')
What should I do here?This is probably a question of language:
SQL> alter session set nls_language=italian; Modificata sessione. SQL> select to_date('13-DEC-09', 'dd-mon-yy') 2 from dual; select to_date('13-DEC-09', 'dd-mon-yy') * ERRORE alla riga 1: ORA-01843: not a valid month SQL> alter session set nls_language=english; Session altered. SQL> select to_date('13-DEC-09', 'dd-mon-yy') 2 from dual; TO_DATE(' --------- 13-DEC-09
Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/] -
How to change the date format in the United States to the United Kingdom
my laptop date format changed to English WE that is dd/mm/yyyy. I tried to change it to English UK that is DD/MM/YYYY, but it does not change.
I would appreciate if I could help out the English American date format and change date format English UK as all my accounts work stayed in waiting for the last week.
- Right click on the clock in the task bar, then choose "Adjust Date/time".
- Click Change Date and time...
- Click on change the calendar settings
-
Play with the date format TO_CHAR
Hi all
I'm learning how function TO_CHAR date format and code using the table double, but I had a few difficulties:
How can I place an explicit function TO_CHAR date?SQL> select to_char(sysdate,'dl') test from dual; TEST ----------------------------- Monday, December 20, 2010 SQL> select to_char(sysdate) test from dual; TEST --------- 20-DEC-10 SQL> select sysdate test from dual; TEST --------- 20-DEC-10 SQL> select to_char('20-DEC-10','dl') test from dual; select to_char('20-DEC-10','dl') test from dual * ERROR at line 1: ORA-01722: invalid number
Best regards
ValerieValerie Debonair wrote:
Hi all
I'm learning how function TO_CHAR date format and code using the table double, but I had a few difficulties:SQL> select to_char('20-DEC-10','dl') test from dual; select to_char('20-DEC-10','dl') test from dual * ERROR at line 1: ORA-01722: invalid number
How can I place an explicit function TO_CHAR date?
Oracle converts implicitly your string to a date so that it can convert it to a string using your to_char function. Implicit conversion is based on your NLS_DATE_FORMAT settings, but you can never count on these implicit conversions.
You can be...
SQL> select to_char(to_date('20-DEC-10','DD-MON-RR'),'dl') from dual; TO_CHAR(TO_DATE('20-DEC-10' --------------------------- Monday 20 December 2010
or
SQL> select to_char(date '2010-12-20','dl') from dual; TO_CHAR(DATE'2010-12-20 ----------------------- Monday 20 December 2010
Note that this one used Oracle fixed-date internal format YYYY-MM-DD, so if ever you use this method, you must specify the date string in this format. It also only deals with dates, not the component "hour".
-
Parshing and XML [V 10 G] data extraction
Hi Experts,
I have an XML CD catalog file. I extract the values of the fields in xml format and load it into a table of the same number of columns.
can someone help me how can I extract XML data
Example of XMl
--------------------
<!-edited by XMLSpy®->
<>CATALOG
< CD > < TITLE > Empire Burlesque < / TITLE > < ARTIST > Bob Dylan < / ARTIST > < COUNTRY > USA < / COUNTRIES > < Columbia COMPANY > < / COMPANY > < PRICE > 10.90 < / PRICE > < YEAR > 1985 < / YEAR > < / CD >
< CD > < TITLE > hide your heart < / TITLE > < ARTIST > Bonnie Tyler < / ARTIST > < UK COUNTRY > < / COUNTRIES > < COMPANY > CBS records < / COMPANY > < PRICE > 9.90 < / PRICE > < YEAR > 1988 < / YEAR > < CD >
Greatest Hits < CD > < TITLE > < / TITLE > < ARTIST > Dolly Parton < / ARTIST > < COUNTRY > USA < / COUNTRIES > < COMPANY > RCA < / COMPANY > < PRICE > 9.90 < / PRICE > < YEAR > 1982 < / YEAR > < CD >
< CD > < TITLE > Still you have the blues < / TITLE > < ARTIST > Gary Moore < / ARTIST > < UK COUNTRY > < / COUNTRIES > < COMPANY > Virgin records < / COMPANY > < PRICE > 10.20 < / PRICE > < YEAR > 1990 < / YEAR > < / CD >
Eros < CD > < TITLE > < / TITLE > < ARTIST > Eros Ramazzotti < / ARTIST > < EU COUNTRIES > < / COUNTRIES > < BMG COMPANY > < / COMPANY > < PRICE > 9.90 < / PRICE > < YEAR > 1997 < / YEAR > < / CD
< / CATALOGUE >
Thank you
-----------------
Emmeline
with
xml_source as
(select q' {})
}' the_xmlEmpire Burlesque Bob Dylan U.S.. Columbia 10.90 1985 Hide your heart Bonnie Tyler UK CBS Records 9.90 1988 Greatest Hits Dolly Parton É.-u. RCA 9.90 1982 Always you have the blues Gary Moore UK Virgin records 10.20 1990 Eros Eros Ramazzotti EU BMG 9.90 1997 >of the double
)
Select x.*
of xml_source s.
XMLTable ('/ CATALOGUE/CD ')
by the way of xmltype (s.the_xml)
columns 'TITLE' path of the varchar2 (30) "TITLE."
Path of varchar2 (30) "ARTIST", "ARTIST."
Path varchar2 (5) of 'COUNTRY', 'COUNTRY ', he said.
Path varchar2 (30) "Company" "SOCIETY."
"PRICE' number path"PRICE. "
Path number 'YEAR' 'YEAR '.
) x
TITLE ARTIST COUNTRY COMPANY PRICE YEAR Empire Burlesque Bob Dylan U.S.. Columbia 10.9 1985 Hide your heart Bonnie Tyler UK CBS Records 9.9 1988 Greatest Hits Dolly Parton U.S.. RCA 9.9 1982 Always you have the blues Gary Moore UK Virgin records 10.2 1990 Eros Eros Ramazzotti EUROPEAN UNION BMG 9.9 1997 Concerning
Etbin
-
Date format string SQL Conveting XML
Hi all
I have a question where a date that comes as input to a string format must be inserted into a database is Timestamp. Can someone help me on this...
the date format which I recive is '2008-08-01' where "yyyy-MM-DD" I have to convert it in the format "YYYY-MM-ddTHH" Help with this convert Timestamp would be a great help.Hi Sissi,
Please use the format-dateTime function in xslt and to generate the time portion of the date, use the '00' instead of hh, mm, and ss. This function automatically converts an XML datetime SQL string.The function will look like this - dateTime(YYYY-MM-DDT00:00:00) format.
Concerning
AYUSH -
I created a custom and registered with a specific name date format. However, when I open a new worksheet, my saved format does not appear in the menu drop-down? Am hoping that I don't need to create the same format for each new sheet?
You must save the spreadsheet containing the new date as a model format and use this custom template for each new spreadsheet where you want that this date format personalized at your disposal.
-
Step 1. I choose Chinese (PRC) in the list format (region and language) and set the format of 'YYYY-MM-dd' date, apply. It is ok.
Step 2. I choose English (United States) in the list format (region and language) and set the format of 'YYYY-MM-dd' date, apply. It is ok.
Step 3. I chose the back to Chinese (PRC) in the format list (region and language), format date is reset to "YYYY/M/d", it is not ok for me.
How can I set the format of a two language. ?
Because I use the siemens industry software, when to change language it will read the date format different from the language that is displayed. My client want to see the same format.
I tested under Win XP, it may set the format even in different languages
Hi Jerry,
Thanks for posting the request in Microsoft Community Forums.
It is normal that you can not set the same date format for both languages at the same time. You will need to use the drop-down list to choose a date format customized if necessary.
Hope this information helps.
-
The format of data type in xml editor desktop?
Hi all..
<G_CUSTOMER_TRX_ID>
< INVOICE_NUM> 001201200120< /INVOICE_NUM>
<INVOICE_DATE> 10 May 12< /INVOICE_DATE>
<CUST_NUM> 45532< /CUST_NUM>
BILL <TYPE_NAME>< /TYPE_NAME>
< /G_CUSTOMER_TRX_ID>
<G_CUSTOMER_TRX_ID>
< INVOICE_NUM> 00120 - 1200120 - ABC< /INVOICE_NUM>
<INVOICE_DATE> 10 May 12< /INVOICE_DATE>
<CUST_NUM> 45578< /CUST_NUM>
BILL <TYPE_NAME>< /TYPE_NAME>
< / G_CUSTOMER_TRX_ID >
It's my .xml.
I create template for domain Invoice_Num, Invoice_Date, Cust_Num, Type_Name.
Invoice_Num in the table using type Varchar2 and with the help of ordinary text .rtf.
But, if I try an excerpt with Excel, for invoice_num, I get data - > 1201200120 and 1200120-00120-ABC.
Why not show '0'? I want to Excel output I get data 001201200120 and 1200120-00120-ABC.
Please help me.
Thank you all...
Hello
"Where evere your form invoice_num field is it in rtf just before which form fields simply use =".
and after the use of this form field.
Let me know the status
-
Date formats incompatible of apex between weekly and daily calendar
I use the Apex ajax calendar to view activity. My user has noticed that the date format changes between the weekly and daily life, that is to say the 07/08 (MM/JJ) and 08/07 (JJ/MM) respectively. Is this a bug or is at - there somewhere some control of date format?
I use the following to call pages
Weekly
JavaScript:apex.widget.Calendar.ajax_calendar ('W', 'same'); void (0);
Every day
JavaScript:apex.widget.Calendar.ajax_calendar (', 'same'); void (0);
Thank you
Drew
Request Express 4.2.3.00.08Hello
You can check your calendar template (shared components-> models-> calendar or go to the page that contains the schedule-> tree of shared components-> choose the calendar), if it uses the same date format for weekly view masks and every day? You will see variables substitution as #MM #, #DD # and so on.
Concerning
Patrick
Member of the APEX development team
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf
-
Need a PowerShell Script to list all my stores of data, capacity and VMFS format.
All,
I need a script to list all my stores of data, capacity and VMFS format.
That's what I have so far but its does not give me the results I need.
Get-Datastore - Datacenter MN_PROD | where {$_.} Type - eq "VMFS"} | Select-Object Name,@{N="VMFS version. {E = {$_.Info.Vmfs.Version}}
Try like this
Get-Datastore -Datacenter MN_PROD | where {$_.Type -eq "VMFS"} | Select-Object Name,CapacityGB, @{N="VMFS version";E={$_.FileSystemVersion}}
-
I did a blog in adobe muse and his now adjust it in British Colombia, but I can't seem to change the date format of blog post?
My ideal date format would be / 28, Oct 2015
can anyone help? I don't know that I can handle the {tag_postdate}
You can use something like this in the post or poster list: {tag_blogpostday}, {tag_blogpostmonth}, {tag_blogpostyear}
Maybe you are looking for
-
Please help I'm looking for the dowload 10.10 update my dads computer and I can not find it! Does anyone know where could it have?
-
The execution of the step of the appellant in teststand
Hello When an error occurs during a stage during a sequence, I can use the call of SequenceFilePostStepRuntimeError back to catch the error. But how can I go back to the step which is just triggered the error for retrying, run again? I don't want to
-
Dell AIO926 printer cannot find a driver on my computer dell laptop
tried to set up dell 926 AIO printer but can't find the driver
-
How to burn audio tracks to disc without any silence between titles
I want to know. If I'm trying to burn a cd of titles that are supposed to mix each other, but still have sepparate track numbers, how can I have it skip to the next track without any silence between the two? On Windows Media Player ON Windows Media P
-
Need drivers for HP Pavilion G3660D
Hi guys, I just got from Vista to XP and I was shocked to discover that there are no drivers for this PC XP. Can you guys help out me? I need driver Realtek RTL8139/810 X LAN, 82801 GB/GR/GH Serial ATA Controller, Intel GMA 3100, Coexnant 11258 and a