SetDateFormat in XMLGEN
The setDateFormat method in the
XMLGEN package does not seem to
work correctly. It will fail
on parsing the next date no
matter what the format after being
set, even when set to the default.
Xmlgen.setDateFormat('YYYY-MM-DD HH24:MI:SS')
Will cause an insert in that format
to fail???
scottg
Hello,
The reason you are having this problem is that your date format syntax is wrong (i.e. your mask is wrong). Please refer to the java class SimpleDateFormat documentation. It is there that they give a nice explanation of how the date mask should look like. The XSU uses java representation of the date mask.
visar
ps.: The link below with take you to the documentation I am talking about. Good luck. http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html
Similar Messages
-
I am using xmlgen to generate xml document for a query. setdateformat is not making any sense on the output. Is anybody has idea about this.
Sorry the format is this way
xmlgen.setquerydateformat ('yyyy-MM-dd''T''hh:mm:ss');
v_lob := xmlgen.getxml('select........');
Thanks,
Sudheer -
XMLGEN.SETDATEFORMAT DOES NOT WORK
Hello,
i am trying to set the dtae format to yyyy-MM-dd''T''hh:mm:ss
it does not work and also i tried to use 'yyyy-MM-dd hh:mm:ss'
even this does not work using xmlgen.setdateformat it ignores,
any suggections,
Thanks,
SudheerSorry the format is this way
xmlgen.setquerydateformat ('yyyy-MM-dd''T''hh:mm:ss');
v_lob := xmlgen.getxml('select........');
Thanks,
Sudheer -
I'm getting an error when using insertxml and my xml document has dates in it. I have
set the procedure "setDateFormat" to the
appropriate date mask. I have tried many different date formats and the only way I can get it to work is when there are no dates in the xml document. I have attached a test script and the resulting error.
Thanks in advance
Rodger
declare
xmlString CLOB := null;
rowsp integer;
v_xml_out varchar2(32000);
begin
v_xml_out := '<ORDER_STATUS>
<order_detail>
<ORDS_WEB_ORDER_NBR>WEB-ORD-12345</ORDS_WEB_ORDER_NBR>
<ORDS_WEB_CUSTOMER_NBR>WEB-CUST-12345</ORDS_WEB_CUSTOMER_NBR>
<ORDS_CUSTOMER_NAME>Rodger Winger</ORDS_CUSTOMER_NAME>
<ORDS_COMPANY_ID>MUS</ORDS_COMPANY_ID>
<ORDS_DOC_DATE_TIME>12-Dec-00</ORDS_DOC_DATE_TIME>
<ORDS_DOC_ID>DOC-ID-123</ORDS_DOC_ID>
<ORDS_RMA_NBR>RMA-NBR-123</ORDS_RMA_NBR>
<ORDS_PRODUCT_QTY>100</ORDS_PRODUCT_QTY>
<ORDS_BACKORDERED_QTY>25</ORDS_BACKORDERED_QTY>
<ORDS_SHIPPED_QTY>40</ORDS_SHIPPED_QTY>
<ORDS_RETURN_QTY>10</ORDS_RETURN_QTY>
<ORDS_RETURN_REASON>Return-Reason</ORDS_RETURN_REASON>
<ORDS_REFUND_DISPOSITION>Ref-Disp-1</ORDS_REFUND_DISPOSITION>
<ORDS_LINE_NBR>1</ORDS_LINE_NBR>
<ORDS_SKU>SKU-12345</ORDS_SKU>
<ORDS_STATUS>Status-321</ORDS_STATUS>
<ORDS_SHIP_METHOD_CODE>FEDEX-ON</ORDS_SHIP_METHOD_CODE>
<ORDS_CREATION_DATE></ORDS_CREATION_DATE>
<ORDS_CANCELLED_QTY>3</ORDS_CANCELLED_QTY>
<ORDS_ITEM_AVAILABLE_DATE></ORDS_ITEM_AVAILABLE_DATE>
<ORDS_TRACKING_NBR>ORDS-TRK-NBR-123</ORDS_TRACKING_NBR>
<ORDS_LOT_NBR>ORDS-LOT-NBR-789</ORDS_LOT_NBR>
<ORDS_SERIAL_NBR>ORDS-SRL-NBR-657</ORDS_SERIAL_NBR>
<ORDS_REASON>Order Status Reason</ORDS_REASON>
<ORDS_CONTAINER_NBR>65</ORDS_CONTAINER_NBR>
<ORDS_EXPECTED_ARRIVAL_DATE></ORDS_EXPECTED_ARRIVAL_DATE>
<ORDS_MSG_TRANSACTION_TYPE>ORDERSTATUS</ORDS_MSG_TRANSACTION_TYPE>
<ORDS_CRTNG_MSG_ID>100</ORDS_CRTNG_MSG_ID>
<ORDS_MSG_COMPANY_ID>MUS</ORDS_MSG_COMPANY_ID>
</order_detail>
</ORDER_STATUS>';
DBMS_LOB.CREATETEMPORARY(xmlString,TRUE, DBMS_LOB.SESSION);
DBMS_LOB.WRITEAPPEND (xmlString, length(v_xml_out), v_xml_out);
-- open the lob
dbms_lob.open(xmlString,DBMS_LOB.LOB_READONLY);
-- before inserting , make sure that the case is ignored (since we generated everything with lower case)
xmlgen.resetOptions;
xmlgen.setRowTag('order_detail');
xmlgen.setIgnoreTagCase(xmlgen.IGNORE_CASE);
xmlgen.setDateFormat('DD-MON-YY');
-- insert the XML document
rowsp := xmlgen.insertXML('ords_order_statuses',xmlString);
dbms_output.put_line(' Rows processed = '| | TO_CHAR(rowsp));
-- free the lob
dbms_lob.close(xmlString);
dbms_lob.freetemporary(xmlString);
end;
error message
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: Unparseable date: "12-Dec-00"
ORA-06512: at "XMLOWNER20.XMLGEN", line 114
ORA-06512: at line 61You have to use the date format masks that are defined at:
http://java.sun.com/products/jdk/1.1/docs/api/java.text.SimpleDateFormat.html
which are difference from the standard Oracle date masks.
For dates of the form 12-Dec-00, the mask would be (case-sensitive!):
d-M-yy
null -
Why are results from xmlgen.getxml truncated?
I have a table with 25 rows in it that displays all contents with a SELECT * statement. However, if I wrap this statement in an xmlgen.getxml the result is truncated. I'm sure this is a novice issue, and this novice would appreciate any insight.
Thanks in advance,
Rich
query:
SELECT xmlgen.getxml('SELECT * FROM dbotemp.portfolio') xml from dual
result:
XML
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<PORTFOLIO_ID>187</PORTF
1 row selected.you get a clob and clobs are normely truncated
when you use the statement ins SQL*PLus try: "set long 10000"
and you will see the whole result -
Xmlgen.getxml("select * from table") returns null pointer exception
I am running oracle 8i on solaris server and clinet on windows
NT and i am this select statement
select xmlgen.getxml("select * from table") from dual ,its
returning null pointer exception,i have tried it through
jdbc,even then its returning xml as
<?xml version = '1.0'?>
<ERROR>java.lang.NullPointerException</ERROR>
can any body tell me the error.Help will be really appreciated.I
need an urgent response,if some one can guide me please.
My email is [email protected],if you can give me a quick
response on this email,your effot will be appreciated.
thanks
MasoodWhat is actually throwing the NullPointerException? rs.getMetaData() or table.setModel()?
-
Xmlgen.setQueryDateFormat doesn't work.
xmlgen.setQueryDateFormat(a) doesn't work.
a for example: 'ddMMMyyyy' or 'MM/dd/yyyy HH:mm:ss'
I looked all other Messages in this Forum, but I still get the
error
ORA-00932: inconsistent datatypes
ORA-06512: at "SYS.XMLGEN", line 194
ORA-06512: at line 1
Do you have an suggestions?
Thanks, Thomas.If you uninstall transmission you can reinstall it through application manager
-
Error with PL/SQL xmlGen if unlimited rows
If I run xmlgen server side from pl/sql and I dont specify a limit on the rows I get the following error
xml version=1.0
ERROR
oracle.xml.sql.OracleXMLSQLEception
ORA-00600: internal error code, arguments: [kdlseek-kgbtnscb]
ERROR
If limit the rows it works ok, the generated xml is not that big only about 600 rows
Any ideas on whast the problem
RobI too get the same problem. Has anyone come up with a solution, not a workaround?
SQL> select xmlgen.getXML('select * from dict where table_name like ''%ROLE%''') from dual;
XMLGEN.GETXML('SELECT*FROMDICTWHERETABLE_NAMELIKE''%ROLE%''')
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<TABLE_NAME>DBA_ROLES</T
SQL> select xmlgen.getXML('select * from dict') from dual;
select xmlgen.getXML('select * from dict') from dual
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: ORA-00600: internal error code,
arguments: [kdlseek-kgbtnscb], [], [], [], [], [], [], []
ORA-06512: at "SCOTT.XMLGEN", line 465
ORA-06512: at "SCOTT.XMLGEN", line 456
ORA-06512: at line 1
SQL> select count(*) from dict;
COUNT(*)
851
SQL> describe dict;
Name Null? Type
TABLE_NAME VARCHAR2(30)
COMMENTS VARCHAR2(4000)
SQL>
shared_pool_size = 52428800 # 50MB
large_pool_size = 614400
java_pool_size = 41943040 # 40MB
W2K V5 SP1, 8.1.6 RLSE2 & XSU1.2
Steve.
null -
We are having aproblem calling xmlgen from a job submitted using dbms_job.
We are trying to set up a background job to process new records in a table and create an xml doc and store this in another table.
When the job executes it fails without any specfic reason. I have tried force the job to run from my session using "run" and it also fails. I have tried removing things from the procedure to see what causes the problem and it is specifically the xmlgen.
It is the call to xmlgen specifically that causes the job to fail.
Does anyone have a solution or has anyone used xmlgen inside of a systen job?
Thanks
Rob
nullIf you JavaBean does not use any kind of connection pooling, your site performance is not going to be good. However, you probably don't need to worry about deadlocks on the JSP end if you don't have connection pooling, since you are likely not to have shared objects/variables among the different JSP threads. If you site experiences heavy load, the probablility of your database crashing would be significantly higher if you don't have database connection pooling
-
trying to figure out which jars need to be in my classpath.
Using 1.4.2 I get
911@file:/C:/sgml/NISO/2005/05Std/dtbook121a.dtd
generating document #1
Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ranges/Do
cumentRange
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
etc,
with 1.5 I get
Exception in thread "main" java.lang.NullPointerException
at com.sun.msv.generator.DOM2toSAX2.convertAttributes(Unknown Source)
at com.sun.msv.generator.DOM2toSAX2.onElement(Unknown Source)
at com.sun.msv.generator.DOM2toSAX2.traverse(Unknown Source)
at com.sun.msv.generator.Driver.run(Unknown Source)
at com.sun.msv.generator.Driver.main(Unknown Source)
1. Which jars are needed please?
I currently have
set x=/myjava/xmlgen
set cp=%x%/xmlgen.jar;%x%/msv.jar;%x%/xerces.jar;%x%/xercesImpl.jar
2. Which version of java has it been proven with please?
TIA, DavePFurther information.
Using the provided xerces.jar, recent xmlParserAPIs.jar and java 1.4.2
the error reduces to
java -cp /myjava/xmlgen/xmlgen.jar;/myjava/xmlgen/xmlParserAPIs.jar com.sun.msv.generator.Driver -dtd dtbook121b.dtd -root {}book
parsing a grammar: dtbook121b.dtd
generating document #1
Exception in thread "main" java.lang.NullPointerException
at com.sun.msv.generator.DOM2toSAX2.convertAttributes(Unknown Source)
at com.sun.msv.generator.DOM2toSAX2.onElement(Unknown Source)
at com.sun.msv.generator.DOM2toSAX2.traverse(Unknown Source)
at com.sun.msv.generator.Driver.run(Unknown Source)
at com.sun.msv.generator.Driver.main(Unknown Source)
regards DaveP -
Hi All,
I'm having problems with the XML generation. The problem is that when we try to generate XML using a query, such as:
select xmlgen.getXML('select content_id, locale_id, content from bc_content_local where delete_p = ''0''',1) from dual;
It works fine so long as of the information retrieved by the query is ASCII. But if there are UTF8 characters in there, the
generation of the XML fails.
I wasn't actually getting an error message. It would work and return XML but as soon as the first UTF-8 character was encountered,
the XML just stopped.
Two questions:
1) Does the XML generation support UTF-8? 2)
If it does (I seem to remember hearing that it did) what has to be done so that this
works correctly?
We are using a UTF8 characterset we set during database creation. I have also tried setting up NLS_LANG in the client registrty to american_america.utf8 - but in both client and server I get teh same message.
Database: Oracle 8.1.7 Standard Edition on Sun-Solaris 2.8
Any help greatly appreciated,
Nilendu Misra
[email protected]Ok, I found we have DBMS_XMLQUERY installed on the schema other than SYS too. But when I issue the same statement using this package I get a different error:
SQL> select dbms_xmlquery.getXML('select content_id, locale_id, content
2 from bc_content_local where delete_p = ''0''',1) from dual;
select dbms_xmlquery.getXML('select content_id, locale_id, content
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NullPointerException
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 212
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 220
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 210
ORA-06512: at "SYSTEM.DBMS_XMLQUERY", line 228
ORA-06512: at line 1
I tried searching the XML forum and Metalink but I found most of the reports on this nature of problem are still unanswered.
Thanks in appreciation,
Nilendu
null -
Temp Tablespace Goes Berzerk using XMLGEN
The following procedure seems to maxout my temporary tablespace (2G!!!!)
I use this procedure to pump XML to a client given a sql statement and a few parameters.
I am using the plxmlparser_v1_0_2 release and the XSU12_ver1_2_1 release.
There seems to be some discussion concerning this in other threads but no soloution seems to be forth coming. Any advice?
PS I am also having a problem with XMLGEN returning XML datasets >90k. Methinks the two issues are related.
Regards
James Crockart
[email protected]
procedure createDynamicXML(
sql_string varchar2,
result_name varchar2 default 'results',
row_name varchar2 default 'row',
error_name varchar2 default 'error_results',
rowid_name varchar2 default null,
rowid_col varchar2 default null,
useLowerCase boolean default true,
useNullAttrib boolean default false)
is
no_sql exception;
--XML Variables
xmlString CLOB := null;
amount integer:= 255;
position integer := 1;
charString varchar2(255);
begin
if sql_string is null then
raise no_sql;
end if;
--Set XML preferences
xmlgen.resetOptions;
xmlgen.setErrorTag(error_name);
xmlgen.setRowsetTag(result_name);
xmlgen.setRowTag(row_name);
if rowid_name is not null then
xmlgen.setRowIdAttrName(rowid_name);
end if;
if rowid_col is not null then
xmlgen.setRowIdColumn(rowid_col);
end if;
if useLowerCase then
xmlgen.useLowerCaseTagNames();
end if;
xmlgen.useNullAttributeIndicator(useNullAttrib);
--Set mime header
--owa_util.mime_header('text/xml');
--Generate XML
xmlString := xmlgen.getXML(sql_string);
--Output XML
dbms_lob.open(xmlString,DBMS_LOB.LOB_READONLY);
loop
dbms_lob.read(xmlString,amount,position,charString);
htp.prn(charString);
position := position + amount;
end loop;
dbms_lob.close(xmlString);
dbms_lob.freetemporary(xmlString);
exception
when no_data_found then
dbms_lob.close(xmlString);
dbms_lob.freetemporary(xmlString);
end createDynamicXML;
nullThe user the xml sdk was installed in and its privs is:
CREATE USER "XML" PROFILE "DEFAULT"
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"
ACCOUNT UNLOCK;
grant connect to XML;
grant resource to XML;
grant javauserpriv to XML;
grant javasyspriv to XML;
I suppose I can give the XML user it's own temp tablespace to save the rest of the production environment from going down.
But does not solve the problem :(
-James
null -
Generate XML using package xmlgen
I have the following query:
select employ_id, last_name, first_name, salary from employ;
I need generate xml like this:
<row>
<employ>
<employ_id last_name="Dennis" First_name="david">1</employ>
<salary>6</salary>
</employ>
</row>
How can I get it using xmlgen package? Thanks.
nullNo, you will not be able to do that. The
problem is that the columns of the db table
are mapped to XML elements rather then
attributes. Your best bet at achieving your
goal is that after you get your xml document
from the XSU, you transform it using XSLT.
The Oracle Parser does include the xsl processor.
visar
ps.: Today, when using XSU's java API, you can directly get a DOM tree representation of the XML document, which then you can pass directly to the XSL processor and transform it; unfortunately, the PL/SQL API (i.e. xmlgen) doesn only return a string (i.e. lob) representation of the XML doc. So you have to use the PL/SQL Parser to parse it, get it in the DOM format, and only then can you transform it. The good news is that I was assured that in the future the XMLGEN will have a call to get the XML doc in DOM rep. -
Encoding in XMLGEN or DBMS_XMLQUERY
Is it possible to set the encoding of the XML generated in
either XMLGEN or DBMS_XMLQUERY package?
We're using Oracle 8.1.5 so we're stuck with an older version of
XSU.
TIASo, if I have the following code segment:
query := 'select *
from test_table
where col1 = :bind1
and col2 = :bind2';
queryCtx := DBMS_XMLQuery.newContext(query);
DBMS_XMLQuery.setBindValue(queryCtx, 'bind1', parm1);
DBMS_XMLQuery.setBindValue(queryCtx, 'bind2', parm2);
result := DBMS_XMLQuery.getXML(queryCtx);
DBMS_XMLQuery.closeContext(queryCtx);
Are you saying that I need to call 'xmlgen.clearBindValues' before binding any variables? If so, wouldn't it make more sense to have the method in the DBMS_XMLQuery package also? Why use methods from two different packages to manipulate the data?
Also, Mark, thanks for the link to the viewlet, but I think you probably meant to point to
http://otn.oracle.com/tech/xml/htdocs/XDBDemo1.html
or http://otn.oracle.com/tech/xml/htdocs/XDBDemo2.html
am I correct? -
Using xmlgen in a trigger -HELP
We are trying to use xmlgen in a trigger, actually a insteadOf on a view but that is really secondary.
The problem we have is that xmlgen doesnt seem to work from a trigger or any other background process. There is no reall erro messgae it just fails.
Has anyone used xmlgen from a trgigger??
RobCan't this be done.....
create or replace trigger audit_EMP_DTL
before update or delete or insert
on EMP_DTL
for each row
declare
pragma autonomous_transaction;
v_blockexists number := 0;
no_lock exception;
ReturnExp EXCEPTION;
begin
select count(a.sid) into v_blockexists
from v$session a
where a.sid=(select tab1.sid
from v$lock tab1, v$lock tab2
where tab1.block =1
and tab2.request > 0
and tab1.id1=tab2.id1
and tab1.id2=tab2.id2
if v_blockexists = 0 then
insert into audit_blocks(program_name) values ('No block yet');
commit;
RAISE ReturnExp;
end if;
EXCEPTION
WHEN ReturnExp THEN
NULL;
END;
Maybe you are looking for
-
Income tax depreciation in india
Dear All, How do we adress the income tax depreciation in India. As we know the depreciation treatment for Income tax depreciation is a block concept...how do we adress that... Could any one explain elaborately if possible...short and precise inputs
-
Which upgrade for Late 2009 Mac Pro Currently Running 10.6.8?
I am in a qaundry not knowing the best way to upgrade my machine. I would like to install Adobe Lightroom 5 but can not do it from Snow Leopard. I haven't upgraded because I was concerned about creating a nightmare of problems for myself. I use this
-
I have i phone 4 from verizon and the power button is not working
I have i phone 4 from verizon and the power button isn't working anymore, I bought my i phone 8 months ago. What options do I have and what should I do ?
-
Inbound IDOC error (Name MARA is not in the namespace for generated BW Metaobjects)
Hi everybody, we are currently having some issues with importing idocs into our ERP DEV System and i cannot figure out what the problem could be. I am trying to import an IDOC Type ARTMAS (5) but i keep getting the following error "Name MARA is not i
-
Getting apps from my iPod to my PC
I bought an iPod touch. Then I bought apps. Now, I want to update my OS, but can't because all of my apps will go away. How do I put the apps on my iTunes? or If I re-download the apps, will the app store recognize that I already purchased these apps