DBMS_XSLPROCESSOR.SETPARAM problem
When I try to pass values of global parameters of stylesheet with DBMS_XSLPROCESSOR.SETPARAM I get "ORA-31020: The operation is not allowed, Reason: Invalid XSL Parameter or its Value". Can someone provide me with working example, please?
Database version Oracle XE 11g 11.2.0.2.0
This works for me :
SQL> set serveroutput on
SQL>
SQL> DECLARE
2
3 p dbms_xslprocessor.Processor;
4 s dbms_xslprocessor.Stylesheet;
5
6 xsldoc clob := '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7 <xsl:output method="xml"/>
8 <xsl:param name="test"/>
9 <xsl:template match="/">
10 <result><xsl:value-of select="$test"/></result>
11 </xsl:template>
12 </xsl:stylesheet>';
13
14 xmlresult varchar2(4000);
15
16 BEGIN
17
18 p := dbms_xslprocessor.newProcessor;
19 s := dbms_xslprocessor.newStylesheet(dbms_xmldom.newDOMDocument(xsldoc), null);
20 dbms_xslprocessor.setParam(s, 'test', '"Hello!"');
21
22 dbms_xslprocessor.processXSL(p, s, dbms_xmldom.newDOMDocument('<dummy/>'), xmlresult);
23
24 dbms_xslprocessor.freeStylesheet(s);
25 dbms_xslprocessor.freeProcessor(p);
26
27 dbms_output.put_line(xmlresult);
28
29 END;
30 /
<?xml version="1.0" encoding="utf-8"?>
<result>Hello!</result>
PL/SQL procedure successfully completed
Similar Messages
-
Dbms_xslprocessor package problems in PL/SQL
Hi all :)
I was wondering if anyone has any ideas about this problem I'm having:
When using the dbms_xslprocessor in PL/SQL, I consistently get dropped connections when trying to either transform a document, or search a document via XPath. So, for instance, if I call dbms_xslprocessor.selectSingleNode('XPATH'), the connection will drop out with the following error (I'm calling a stored procedure here):
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Similar problems happen on XMLType.transform(stylesheet).
I've only managed to have this happen when transforming or searching documents that are not in the default (i.e., xmlns="") namespace, but I can't get rid of the namespace (too much other code is relying on it being there).
What's even stranger is that the XSLPROCESSOR package works, but DBMS_XSLPROCESSOR package does not. Unfortunately, the XSLPROCESSOR package doesn't seem to handle namespaces well, and inserts seemingly random namespace declarations in the transformation results (for instance, on the root element, it puts in "xmlns:xmlns='http://www.w3.org/2000/xmlns/'") or redeclares namespaces on nodes that already have that namespace defined for them by their parents. Namespace prefixes, too.
Does anybody have any ideas as to what this might be?
Thanks in advance,
ConstantineI should also mention that I'm ABSOLUTELY sure that the stylesheets I'm using for transformation are correct as of XSLT ver. 1.0 -- multiple external processors (Xalan and MSXML, specifically) give the correct result on the same stylesheet.
-
Dbms_xslprocessor problems in PL/SQL
Hi all :)
-- This is a cross-posting of a question I placed on the XMLDB forum, but there seems to be more activity here
-- Sorry about the duplicate
I was wondering if anyone has any ideas about this problem I'm having:
When using the dbms_xslprocessor in PL/SQL, I consistently get dropped connections when trying to either transform a document, or search a document via XPath. So, for instance, if I call dbms_xslprocessor.selectSingleNode('XPATH'), the connection will drop out with the following error (I'm calling a stored procedure here):
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Similar problems happen on XMLType.transform(stylesheet).
I've only managed to have this happen when transforming or searching documents that are not in the default (i.e., xmlns="") namespace, but I can't get rid of the namespace (too much other code is relying on it being there).
What's even stranger is that the XSLPROCESSOR package works, but DBMS_XSLPROCESSOR package does not. Unfortunately, the XSLPROCESSOR package doesn't seem to handle namespaces well, and inserts seemingly random namespace declarations in the transformation results (for instance, on the root element, it puts in "xmlns:xmlns='http://www.w3.org/2000/xmlns/'") or redeclares namespaces on nodes that already have that namespace defined for them by their parents. Namespace prefixes, too.
I should mention that I'm absolutely sure the stylesheet is correct. External processors like MSXML and Xalan produce correct results.
Does anybody have any ideas as to what this might be?
Thanks in advance,
Constantinewhat version of the XDK are you using ?
Version of the javaparser ? -
Problem with setting oracle type parameter in viewobject query
Hi There,
I am facing a problem with JDev1013. I have a view that has JDBC positional parameters that are supposed to be in parameters for function like:
SELECT x.day, x.special_exact_period_only
FROM (
SELECT x.day, x.special_exact_period_only
FROM (
SELECT
x.day,
rb.special_exact_period_only
FROM TABLE (
RentabilityPkg.findMarkerSlots(
'start',
? /* dchannel */,
NULL,
? /* resorts */,
'special',
NULL,
? /* code */,
NULL,
TRUNC(SYSDATE),
TRUNC(SYSDATE + 365 * 2),
NULL
) x
JOIN resourcebase rb USING (rentabilitymanager_id)
UNION
SELECT
x.day,
rb.special_exact_period_only
FROM TABLE (
RentabilityPkg.findMarkerSlots(
'start',
? /* dchannel */,
NULL,
? /* resorts */,
'composition',
NULL,
? /* code */,
NULL,
TRUNC(SYSDATE),
TRUNC(SYSDATE + 365 * 2),
NULL
) x
JOIN resourcebase rb USING (rentabilitymanager_id)
)x
ORDER BY x.day
) x
WHERE ROWNUM <= 30now the JDBC positional parameters take our custom defined list type defined as:
CREATE TYPE NumberList AS TABLE OF NUMBER;
we are setting the parameter in the views with the help of oracle.sql.ARRAY class like:
* Set parameters.
public void setParams(Integer dchannelId, Integer[] resorts, String specialCode)
try {
System.out.println(this.getClass() + ".setParams()");
ARRAY arrParam1 = ((NWSApplicationModule)getApplicationModule()).toSQLNumberList(Arrays.asList(resorts));
ARRAY arrParam2 = ((NWSApplicationModule)getApplicationModule()).toSQLNumberList(Arrays.asList(resorts));
System.out.println("arrParam1 - " + arrParam1);
System.out.println("arrParam1 - " + arrParam1);
System.out.println(this.getClass() + " ARRAY - " + arrParam1.getArray());
System.out.println(this.getClass() + " -- " + arrParam1.length());
System.out.println("arrParam2 - " + arrParam2);
System.out.println("arrParam2 - " + arrParam2);
System.out.println(this.getClass() + " ARRAY - " + arrParam2.getArray());
System.out.println(this.getClass() + " -- " + arrParam2.length());
Object[] params =
{ dchannelId,
arrParam1,
specialCode,
dchannelId,
arrParam2,
specialCode
setWhereClauseParams(params);
System.out.println("DONE WITH " + this.getClass() + ".setParams()");
catch(Exception ex)
ex.printStackTrace(System.out);
}the toSQLNumberList() method is defined in our App module baseclass as follows:
public ARRAY toSQLNumberList(Collection coll)
debug("toSQLNumberList()");
DBTransaction txn = (DBTransaction)getTransaction();
debug("txn - " + txn + " : " + txn.getClass());
return NWSUtil.toSQLNumberList(coll, getConnection(txn));
public static ARRAY toSQLNumberList(Collection c, Connection connection)
//printTrace();
debug("toSQLNumberList()");
try
ArrayDescriptor numberList = ArrayDescriptor.createDescriptor("NUMBERLIST", connection);
NUMBER[] elements = new NUMBER[c == null ? 0 : c.size()];
if (elements.length > 0 )
Iterator iter = c.iterator();
for (int i = 0; iter.hasNext(); i++)
elements[i] = new NUMBER(iter.next().toString());
return new ARRAY(numberList, connection, elements);
catch (Exception ex)
ex.printStackTrace();
return null;
protected Connection getConnection(DBTransaction dbTransaction)
//return null;
debug("Inside getConnection()");
CallableStatement s = null;
try
* Getting Conenction in BC4J is dirty but its better
* as otherwise we might end up coding with connections
* and the Transaction Integrety will be
s = dbTransaction.createCallableStatement("BEGIN NULL; END;", 0);
debug("DOING s.getConnection()...");
Connection conn = s.getConnection();
debug("DONE WITH s.getConnection()...");
/*try
throw new Exception("TEST");
catch (Exception ex)
ex.printStackTrace(System.out);
debug("conn CLASS - " + conn.getClass());
return conn;
catch (Exception ex)
ex.printStackTrace();
return null;
finally
try { s.close(); }
catch (Exception ex) {}
}Whenever we try setting the parameters in view using setParams() and use this view to set the model of a java control it thorws the following exception :
[2006-10-10 12:34:48,797 AWT-EventQueue-0 ERROR] JBO-28302: Piggyback write error
oracle.jbo.PiggybackException: JBO-28302: Piggyback write error
at oracle.jbo.common.PiggybackOutput.getPiggybackStream(PiggybackOutput.java:185)
at oracle.jbo.common.JboServiceMessage.marshalRefs(JboServiceMessage.java:267)
at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:343)
at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:316)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2283)
at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7509)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:474)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
at RemoteAMReservation_StatefulSessionBeanWrapper906.doMessage(RemoteAMReservation_StatefulSessionBeanWrapper906.java:286)
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
at oracle.jbo.common.SvcMsgResponseValues.writeObject(SvcMsgResponseValues.java:116)
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
at oracle.jbo.common.PiggybackOutput.getPiggybackStream(PiggybackOutput.java:173)
at oracle.jbo.common.JboServiceMessage.marshalRefs(JboServiceMessage.java:267)
at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:343)
at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:316)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2283)
at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7509)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:474)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
at RemoteAMReservation_StatefulSessionBeanWrapper906.doMessage(RemoteAMReservation_StatefulSessionBeanWrapper906.java:286)
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)This is a typical interaction between 2 server-side components (view-object and app module). Now the question is why is this exception thrown? Any answers?
This application is one that we have migrated from 904 to 1013 and are trying to get it running in 3-tier.
Regards,
AnupamSorry I missed out some semicolons, the script follws:
-- The following TABLE was created to simulate the issue
CREATE TABLE TEST_OBJECT
ASSET_ID NUMBER,
OBJECT_ID NUMBER,
NAME VARCHAR2(50)
INSERT INTO TEST_OBJECT VALUES(1,1,'AAA');
INSERT INTO TEST_OBJECT VALUES(2,2,'BBB');
INSERT INTO TEST_OBJECT VALUES(3,3,'CCC');
COMMIT;
SELECT * FROM TEST_OBJECT;
-- The following TYPES was created to simulate the issue
CREATE OR REPLACE
TYPE DUTYRESULTOBJECTTAB AS TABLE OF DUTYRESULTOBJECT;
CREATE OR REPLACE
type DutyResultObject as object
( ASSET_ID number,
OBJECT_ID number,
NAME varchar2(150)
-- The following PACKAGE N FUNCTION was created to simulate the issue
CREATE OR REPLACE PACKAGE TESTOBJECTPKG
IS
FUNCTION OBJECTSEARCH(P_RESOURCE IN NUMBERLIST) RETURN DUTYRESULTOBJECTTAB;
END;
CREATE OR REPLACE PACKAGE BODY TESTOBJECTPKG
IS
FUNCTION OBJECTSEARCH(P_RESOURCE IN NUMBERLIST) RETURN DUTYRESULTOBJECTTAB
IS
BULKDUTYRESULTOBJECTTAB DUTYRESULTOBJECTTAB;
BEGIN
SELECT DUTYRESULTOBJECT(ASSET_ID, OBJECT_ID, NAME)
BULK COLLECT INTO BULKDUTYRESULTOBJECTTAB
FROM TEST_OBJECT;
RETURN BULKDUTYRESULTOBJECTTAB;
END;
END;
[\code] -
Problem in XML Parsing via oracle procedure...
Hi,
I wrote one oracle procedure for xml parsing.
I have one valid xml file which has "encode UTF-8". The XML file contains some comments also. While we are parsing the xml file at that time it is not parse successfully and also it is not giving any error. After the following line it is skip rest of the codes(lines).
dbms_xmlparser.parseclob(l_parser, l_clob);
At the end of the xml file there are some comments which is like "<!-- abc --> ".
When I am changing the "encode UTF-8 to ISO-88596-1" & removing the comments which wrote on bottom of the file then its working fine, but the files which we are getting from the system is contains the encode UTF-8 and we don't want to preprocess on that xml files. Even if we will do that via shell script or perl script then it will be overhead to the system and in a single stroke our system will parse more than 5k xml files, so if we will do some preprocess on it, it will take some more time approx 1-2 minutes extra.
So, If someone knows any solution of this problem, then please guide & help me on this.
My xml file structure is as follows:-
<?xml version="1.0" encoding="UTF-8"?>
<mcd xmlns:HTML="http://www.w3.org/TR/REC-xml">
<child>
<child1>32.401 V5.5</child1>
<child2>ZoneGate</child2>
</child>
<mc>
<newid>
<id>12</id>
</newid>
<mindex>
<date>20111102180000</date>
<mt>abc1</mt>
<mt>abc2</mt>
<mvalue>
<r>val_1</r>
<r>val_2</r>
</mvalue>
</mindex>
</mc>
</mcd>
<!--
ALARM STATUS
morning 10
afternoon 14
evening 18
night 22
-->
<!--
PARAM:EID = 1
PARAM:GId = 3
PARAM:GSId = 0
--!>
And my oracle procedure is as follows:-
create or replace procedure loadXMLtotable(dir_name IN varchar2, xmlfile IN varchar2) AS
-- Defining the variables
ecode NUMBER;
emesg VARCHAR2(200);
l_bfile BFILE;
l_clob CLOB;
l_dest_offset INTEGER:=1;
l_src_offset INTEGER:=1;
l_Char_set_id NUMBER := NLS_CHARSET_ID('UTF8');
l_lang_context INTEGER := dbms_lob.default_lang_ctx;
l_warning INTEGER;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl1 dbms_xmldom.DOMNodeList;
l_nl2 dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
node1 dbms_xmldom.DOMNode;
colid integer ; -- column id used for identifying which column it belongs.
l_xmltype XMLTYPE;
sub_xmltype XMLTYPE;
num_nodes number;
l_index PLS_INTEGER;
l_subIndex PLS_INTEGER;
starttime Date;
temp_datatime VARCHAR(25);
columnname varchar2(300);
columnvalue varchar2(300);
-- creating a Type which is a type of "test_hem" table RowType, which I created in SVN server
TYPE tab_type IS TABLE OF test_hem%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
-- Passing the xmlfile and virtual directory name which we gave at the time of directory creation
l_bfile := BFileName('MY_FILES', xmlfile);
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
--dbms_lob.loadFromFile(dest_lob => l_clob,
-- src_lob => l_bfile,
-- amount => dbms_lob.getLength(l_bfile));
dbms_lob.loadclobfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile),
l_dest_offset, l_src_offset, l_Char_set_id, l_lang_context, l_warning);
dbms_lob.close(l_bfile);
-- make sure implicit date conversions are performed correctly
dbms_session.set_nls('NLS_DATE_FORMAT','''YYYY-MON-DD HH24:MI:SS''');
dbms_output.put_line('Date format set');
-- Create a parser.
l_parser := dbms_xmlparser.newParser;
dbms_output.put_line('output 1');
-- Parse the document and create a new DOM document.
dbms_xmlparser.parseclob(l_parser, l_clob);
dbms_output.put_line(' passed parsing');
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_output.put_line(' passed getdocument');
-- Free resources associated with the CLOB and Parser now they are no longer needed.
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
-- Get a list of all the EMP nodes in the document using the XPATH syntax.
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/child');
-- Loop through the list and create a new record in a tble collection
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
l_n := dbms_xmldom.item(l_nl1, cur_sel);
t_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
dbms_xslprocessor.valueOf(l_n,'child1/text()',t_tab(t_tab.last).country);
-- putting the state and vendorname into the table rowtype
dbms_xslprocessor.valueOf(l_n,'child2/text()',t_tab(t_tab.last).state);
END LOOP;
-- getting the version and putting into the table rowtype
l_n := dbms_xslprocessor.selectSingleNode(dbms_xmldom.makeNode(l_doc),'//mcd/mc/newid/id');
dbms_xslprocessor.valueOf(l_n,'id/text()',t_tab(t_tab.last).id);
-- selecting the nodes whose starting tag is "mindex"
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/mc/mindex');
-- checking the total number of nodes whose starting through "mi"
num_nodes := dbms_xmldom.getLength(l_nl1);
l_index := 1;
-- For loop to iterate the nodes.
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
-- whole current node is selected and storing into the node1 variable
node1 := dbms_xmldom.item(l_nl1, cur_sel);
-- setting the xmltype as AL32UTF8
l_xmltype := xmltype(l_bfile, nls_charset_id('AL32UTF8'));
-- if selecting parent node containing the mt child node then only proceed else skip that parent node.
IF (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r') > 0) Then
-- fetch the datatime, convert it into to_date format and store it into table rowtype
temp_datatime := dbms_xslprocessor.valueOf(node1, 'date/text()');
t_tab(t_tab.last).data_time := to_char(to_date(temp_datatime, 'YYYYMmcDHH24MISS'));
l_subIndex := 1;
while (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt[' || l_subIndex || ']') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r['|| l_subIndex || ']') > 0 ) LOOP
-- getting mt and corresponging mvalue/r values
dbms_xslprocessor.valueOf(node1,'mt[' || l_subIndex || ']/text()',columnname);
dbms_xslprocessor.valueOf(node1,'mvalue/r[' || l_subIndex || ']/text()',columnvalue);
l_subIndex := l_subIndex + 1;
-- getting the column to which this mapping belongs.
select columnid into colid from abc_table where columnname=name;
CASE colid
WHEN 1 THEN t_tab(t_tab.last).col1 := columnvalue;
WHEN 2 THEN t_tab(t_tab.last).col2 := columnvalue;
WHEN 3 THEN t_tab(t_tab.last).col3 := columnvalue;
ELSE dbms_output.put_line('No column mapping for counter ' || columnname) ;
END CASE; -- end of case statement.
END LOOP;
-- Insert data into the real table from the table collection.
FORALL i IN t_tab.first .. t_tab.last
INSERT INTO test_hem VALUES t_tab(i);
END IF;
l_index := l_index + 1;
COMMIT;
END LOOP;
commit;
EXCEPTION
WHEN OTHERS THEN
ecode := SQLCODE;
emesg := SQLERRM;
dbms_output.put_line(TO_CHAR(ecode) || '-' || emesg);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;Sorry Odie,
I am new to this site as well as PL/SQL. I am giving additional details which you had mentioned in your last comments.
our Oracle Database version is "10.2.0.4.0"
The structure of target table Instrument_Details is as follows:
Create table Instrument_Details (
instrument_id Integer Primary Key,
provider_name Varchar2(32),
version_number Varchar2(32),
location_id Integer,
installation_date Date,
granularity Integer,
time_out Integer );
Note:- Here test_hem is alias of Instrument_details.
Here instrument_id is a primary key.
provider_name contains the child2 xml tag value.
version_number contains the child1 xml tag value.
location_id contains the newid/id value which is map to other table which fetching the location name corresponding to the location_id.
installation_date contains the date xml tag value.
Now we have created one mapping tables where we mapped the xml tag values "mt" with table column name means "abc1 = granularity", "abc2 = time_out" in that table.
these table column value are written under mvalue xml tag.
_Our Database Character set is_:-
NLS_CHARACTERSET WE8ISO8859P1
Now as you suggest me to format your code. I am writing the xml code and procedure code again.
My xml file structure is as follows:-
<?xml version="1.0" encoding="UTF-8"?>
<mcd xmlns:HTML="http://www.w3.org/TR/REC-xml">
<child>
<child1>32.401 V5.5</child1>
<child2>ZoneGate</child2>
</child>
<mc>
<newid>
<id>12</id>
</newid>
<mindex>
<date>20111102180000</date>
<mt>abc1</mt>
<mt>abc2</mt>
<mvalue>
<r>val_1</r> -- here val_1 and val_2 are numeric values
<r>val_2</r>
</mvalue>
</mindex>
</mc>
</mcd>
<!--
ALARM STATUS
morning 10
afternoon 14
evening 18
night 22
-->
<!--
PARAM:EID = 1
PARAM:GId = 3
PARAM:GSId = 0
--!> And my oracle procedure is as follows:-
create or replace procedure loadXMLtotable(dir_name IN varchar2, xmlfile IN varchar2) AS
-- Defining the variables
ecode NUMBER;
emesg VARCHAR2(200);
l_bfile BFILE;
l_clob CLOB;
l_dest_offset INTEGER:=1;
l_src_offset INTEGER:=1;
l_Char_set_id NUMBER := NLS_CHARSET_ID('UTF8');
l_lang_context INTEGER := dbms_lob.default_lang_ctx;
l_warning INTEGER;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl1 dbms_xmldom.DOMNodeList;
l_nl2 dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
node1 dbms_xmldom.DOMNode;
colid integer ; -- column id used for identifying which column it belongs.
l_xmltype XMLTYPE;
sub_xmltype XMLTYPE;
num_nodes number;
l_index PLS_INTEGER;
l_subIndex PLS_INTEGER;
starttime Date;
temp_datatime VARCHAR(25);
columnname varchar2(300);
columnvalue varchar2(300);
-- creating a Type which is a type of "Instrument_Details" table RowType, which I created in SVN server
TYPE tab_type IS TABLE OF Instrument_Details%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
-- Passing the xmlfile and virtual directory name which we gave at the time of directory creation
l_bfile := BFileName('MY_FILES', xmlfile);
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
--dbms_lob.loadFromFile(dest_lob => l_clob,
-- src_lob => l_bfile,
-- amount => dbms_lob.getLength(l_bfile));
dbms_lob.loadclobfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile),
l_dest_offset, l_src_offset, l_Char_set_id, l_lang_context, l_warning);
dbms_lob.close(l_bfile);
-- make sure implicit date conversions are performed correctly
dbms_session.set_nls('NLS_DATE_FORMAT','''YYYY-MON-DD HH24:MI:SS''');
dbms_output.put_line('Date format set');
-- Create a parser.
l_parser := dbms_xmlparser.newParser;
dbms_output.put_line('output 1');
-- Parse the document and create a new DOM document.
dbms_xmlparser.parseclob(l_parser, l_clob);
*-- Below lines are skipping....*
dbms_output.put_line(' passed parsing');
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_output.put_line(' passed getdocument');
-- Free resources associated with the CLOB and Parser now they are no longer needed.
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
-- Get a list of all the EMP nodes in the document using the XPATH syntax.
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/child');
-- Loop through the list and create a new record in a tble collection
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
l_n := dbms_xmldom.item(l_nl1, cur_sel);
t_tab.extend;
-- Use XPATH syntax to assign values to he elements of the collection.
dbms_xslprocessor.valueOf(l_n,'child1/text()',t_tab(t_tab.last).country);
-- putting the state and vendorname into the table rowtype
dbms_xslprocessor.valueOf(l_n,'child2/text()',t_tab(t_tab.last).state);
END LOOP;
-- getting the version and putting into the table rowtype
l_n := dbms_xslprocessor.selectSingleNode(dbms_xmldom.makeNode(l_doc),'//mcd/mc/newid/id');
dbms_xslprocessor.valueOf(l_n,'id/text()',t_tab(t_tab.last).id);
-- selecting the nodes whose starting tag is "mindex"
l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//mcd/mc/mindex');
-- checking the total number of nodes whose starting through "mi"
num_nodes := dbms_xmldom.getLength(l_nl1);
l_index := 1;
-- For loop to iterate the nodes.
FOR cur_sel IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
-- whole current node is selected and storing into the node1 variable
node1 := dbms_xmldom.item(l_nl1, cur_sel);
-- setting the xmltype as AL32UTF8
l_xmltype := xmltype(l_bfile, nls_charset_id('AL32UTF8'));
-- if selecting parent node containing the mt child node then only proceed else skip that parent node.
IF (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r') > 0) Then
-- fetch the datatime, convert it into to_date format and store it into table rowtype
temp_datatime := dbms_xslprocessor.valueOf(node1, 'date/text()');
t_tab(t_tab.last).data_time := to_char(to_date(temp_datatime, 'YYYYMmcDHH24MISS'));
l_subIndex := 1;
while (l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mt[' || l_subIndex || ']') > 0 and l_xmltype.Existsnode('//mcd/mc/mindex[' || l_index || ']/mvalue/r['|| l_subIndex || ']') > 0 ) LOOP
-- getting mt and corresponging mvalue/r values
dbms_xslprocessor.valueOf(node1,'mt[' || l_subIndex || ']/text()',columnname);
dbms_xslprocessor.valueOf(node1,'mvalue/r[' || l_subIndex || ']/text()',columnvalue);
l_subIndex := l_subIndex + 1;
-- getting the column to which this mapping belongs.
select columnid into colid from abc_table where columnname=name;
CASE colid
WHEN 1 THEN t_tab(t_tab.last).col1 := columnvalue;
WHEN 2 THEN t_tab(t_tab.last).col2 := columnvalue;
WHEN 3 THEN t_tab(t_tab.last).col3 := columnvalue;
ELSE dbms_output.put_line('No column mapping for counter ' || columnname) ;
END CASE; -- end of case statement.
END LOOP;
-- Insert data into the real table from the table collection.
FORALL i IN t_tab.first .. t_tab.last
INSERT INTO test_hem VALUES t_tab(i);
END IF;
l_index := l_index + 1;
COMMIT;
END LOOP;
commit;
EXCEPTION
WHEN OTHERS THEN
ecode := SQLCODE;
emesg := SQLERRM;
dbms_output.put_line(TO_CHAR(ecode) || '-' || emesg);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;Thanks in advance for your help... -
Problem with loading XML file from directory.
Hello everyone.
*1)* I have directory defined by DBA. I have read, write privileges. I can read file from this directory using UTL_FILE, I can create file in this directory using UTL_FILE. I tried many times and it does not seem to be any problems.
*2)* I have very simple XML table (with just one column of xmltype). I can insert into this column using:
insert into temp_xml values (
Xmltype ('<something></something>')
*3)* When executing
insert into temp_xml values (
Xmltype (
bfilename('XML_LOCATION', 'sample.xml'),
nls_charset_id('AL16UTF8')
I'm receiving an error:
Error report:
SQL Error: ORA-22288: file or LOB operation FILEOPEN failed
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at "SYS.XMLTYPE", line 287
ORA-06512: at line 1
22288. 00000 - "file or LOB operation %s failed\n%s"
*Cause: The operation attempted on the file or LOB failed.
*Action: See the next error message in the error stack for more detailed
information. Also, verify that the file or LOB exists and that
the necessary privileges are set for the specified operation. If
the error still persists, report the error to the DBA.
*4)* Previously I was receiving more descriptive errors like permission denied, file not exists etc. This time there is no clear description apart from "file or LOB operation %s failed\n%s". I'm sure I can access this file in this directory (I used UTL_FILE to dbms_output the content).
Any help would be greatly appreciated.
Regards
Marcin JankowskiHi Marcin,
Welcome to the forums.
One very important thing with Oracle XML : please always give your database version, all four digits (e.g. 10.2.0.4).
Does the directory resides on the same machine as the database? Which OS?
Does any of the following work ?
DECLARE
v_lob CLOB;
v_file BFILE;
BEGIN
v_file := BFILENAME('XML_LOCATION','sample.xml');
DBMS_LOB.createtemporary(v_lob, true);
DBMS_LOB.fileopen(v_file);
DBMS_LOB.loadfromfile(v_lob, v_file, DBMS_LOB.getlength(v_file));
INSERT INTO temp_xml VALUES( xmltype(v_lob) );
DBMS_LOB.fileclose(v_file);
DBMS_LOB.freetemporary(v_lob);
END;
DECLARE
v_lob CLOB;
BEGIN
v_lob := DBMS_XSLPROCESSOR.read2clob('XML_LOCATION', 'sample.xml', nls_charset_id('AL16UTF8'));
INSERT INTO temp_xml VALUES( xmltype(v_lob) );
END;
/ -
Error with dbms_xslprocessor.clob2file
Hi all!
I am experiencing an error with this command
dbms_xslprocessor.clob2file(v_xml,'DIR','1.xml');
where:
v_xml is a clob ( it is well formed and with data)
DIR is the directory where i want to output the data, it has beeen created with: EXECUTE IMMEDIATE 'create or replace directory DIR ' ||' as ' || '''D:\XMLFILES''';
and i don't have any error in this command
1.xml is the name of the file.
The errors i get when i execute that command are the following:
ORA-29283 invalid file operation
ORA-06512 at "SYS.UTL_FILE" line 451
ORA-29283 invalid file operation
ORA-06512 at "XDB.DBMS_XSlPROCESSOR" line 58
ORA-06512 at "DBA_TEST.PRUEBA_TEST" line 106
ORA-06512 at line 2
thx in advance!!!Hi, excuse me for taking so long time to respond, but yesterday i had a mayor issue to solve, but now i am again with this problem.
I'm gonna put some more code.
The database is in another location, and i want to write the data in a local drive, so maybe this is important for the code.
I will put the full code so maybe there is something else important here:
CREATE OR REPLACE PROCEDURE DBA_TEST.PRUEBA_TEST AS
v_select VARCHAR2(2000);
v_ctx DBMS_XMLGen.ctxHandle;
v_xml CLOB;
v_more BOOLEAN := TRUE;
xmldoc dbms_xmldom.DOMDocument;
DIR VARCHAR2(200);
v_DIR VARCHAR2(200);
BEGIN
EXECUTE IMMEDIATE 'create or replace directory DIR ' ||' as ' || '''D:\XMLFILES''';
v_DIR := DIR;
v_select := ' select nombre, direccion, dni from clientes where anio = 2009';
v_ctx := DBMS_XMLGen.newContext(v_select);
DBMS_XMLGen.setRowsetTag(v_ctx, 'rec_decla');
DBMS_XMLGen.setRowTag(v_ctx, '');
v_xml := DBMS_XMLGen.GetXML(v_ctx);
DBMS_XMLGen.closeContext(v_ctx);
dbms_xslprocessor.clob2file(v_xml,v_DIR,'1.xml');
DBMS_LOB.FREETEMPORARY(v_xml);
END;
Remeber that the data are in another location, no local, and i need to output these xml in the D:\XMLFILES directory.
I tried to grant permisions
GRANT READ, WRITE ON DIRECTORY TO DBA_USER
, but it said that i can't give permision to itself..
maybe there is another way to write these files witout using:
dbms_xslprocessor.clob2file(v_xml,v_DIR,'1.xml');
but i would like to use it.
Thx all!!! -
Problem setting properties using TTC-Pro
I am using TrackThemColors-Pro for Windows with Director MX
2004.
[www.smoothware.com]
When I try to set the video settings in code, or open the
video settings dialogue, the video input hangs. I have tried 4
different capture cards, 3 different cameras etc.
I have emailed Danny about this, but no reply so I guess it
isnt supported anymore.
When trying this it hangs
SetParams(TrackObj,input,hue,saturation,brightness,contrast,sharpness
, standard)
(of course substitute the variables for numbers).
Anyone else have this problem, or know when this function
should be called?
ThanksJoe,
Can you give us the details of your Sequence, your Source Footage and then the specs. of your computer?
Thanks, and good luck,
Hunt -
Problems with quotes when using processXSL...
Hi!
I need some help solving a problem with getting processXSL to output the quote (") character in a text file.
(Oracle Release 9.2.0.6.0)
CREATE TABLE tmp_lob(tmp_clob clob);
SET SCAN OFF
DECLARE
l_xml_doc dbms_xmldom.DOMDocument;
l_xsl_doc dbms_xmldom.DOMDocument;
l_file CLOB;
l_xsl_pro dbms_xslprocessor.Processor;
l_xsl dbms_xslprocessor.Stylesheet;
BEGIN
l_xsl_doc := dbms_xmldom.newDOMDocument(xmltype.createXML(
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:variable name="qt" select="'"'"/>
<xsl:template match="//WORD">
<xsl:value-of select="concat($qt,.,$qt)"/>
</xsl:template>
</xsl:stylesheet>')
l_xml_doc := dbms_xmldom.newDOMDocument(xmltype.createXML(
'<DOCUMENT>
<WORD>Hello World</WORD>
</DOCUMENT>')
l_xsl := dbms_xslprocessor.newStylesheet(l_xsl_doc, null);
l_xsl_pro := dbms_xslprocessor.newProcessor;
dbms_xslprocessor.processXSL(l_xsl_pro, l_xsl, l_xml_doc, l_file);
dbms_xslprocessor.freeProcessor(l_xsl_pro);
INSERT INTO tmp_lob(tmp_clob)
VALUES (l_file);
COMMIT;
END;
SELECT * FROM tmp_lob;
TMP_CLOB
Hello World
Desired output is "Hello World" (with the quotes)!
FYI...
SELECT *
FROM nls_database_parameters
WHERE parameter LIKE '%CHARACTERSET%'
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P1
NLS_NCHAR_CHARACTERSET AL16UTF16
Can anyone help?
Thanks,
Nick
Message was edited by:
nbeerDoes this help...
SQL> set define off
SQL> select xmltransform(xmltype('<Foo><WORD>Hello World</WORD></Foo>'),xmltype('<xsl:stylesheet ver
sion="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2 <xsl:output method="text" encoding="UTF-8"/>
3 <xsl:template match="//WORD">
4 <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
5 </xsl:template>
6 </xsl:stylesheet>')) from dual
7 /
XMLTRANSFORM(XMLTYPE('<FOO><WORD>HELLOWORLD</WORD></FOO>'),XMLTYPE('<XSL:STYLESH
"Hello World"
SQL> set define off
SQL> select extractValue(xmltransform(xmltype('<Foo><WORD>Hello World</WORD></Foo>'),xmltype('<xsl:s
tylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2 <xsl:output method="text" encoding="UTF-8"/>
3 <xsl:template match="//WORD">
4 <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
5 </xsl:template>
6 </xsl:stylesheet>')),'/text()') from dual
7 /
EXTRACTVALUE(XMLTRANSFORM(XMLTYPE('<FOO><WORD>HELLOWORLD</WORD></FOO>'),XMLTYPE(
"Hello World"
SQL> -
Dbms_xslprocessor and namespaces
I'm using dbms_xslprocessor to transform xml to xml (well, more specifically, xml to rss)
My source document looks something like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<feed xmlns:xa="http://host:port/portal/pls/portal/portal.wwsrc_app_xml.get_ctm_xsd">
<title>News News and More News</title>
<link>http://host:port/portal/pls/portal/</link>
<description><![CDATA[interesting news from around the world]]></description>
<base_url>http://host:port/portal/pls/portal/url/item/</base_url>
<copyright_year>2007</copyright_year>
<contact>[email protected]</contact>
<publish_date>Wed, 25 Jul 2007 12:25 -0400</publish_date>
<item>
<guid>2BC6636E56F7092AE0440003BA91D789</guid>
<display_name>News Story</display_name>
<publish_date>Fri, 16 Mar 2007 09:56 -0400</publish_date>
<description><![CDATA[including a >hyperlink in the description]]></description>
<xa:JohnsPageGroup_StoryPlacement>A</xa:JohnsPageGroup_StoryPlacement><xa:JohnsPageGroup_PhotoURL>2D4524A81D985FECE0440003BA91D789</xa:JohnsPageGroup_PhotoURL>
<category>Unassigned</category>
</item>
... and so on...
My XSLT (for the sake of discussion here... loaded as a varchar2):
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<rss version="2.0" xmlns:xa="http://host:port/portal/pls/portal/portal.wwsrc_app_xml.get_ctm_xsd">
<channel>
<title>
<xsl:value-of select="feed/title"/>
</title>
<link>
<xsl:value-of select="feed/link"/>
</link>
<language>en</language>
<copyright>Medical College of Georgia <xsl:value-of select="feed/copyright_year"/>
</copyright>
<managingEditor><xsl:value-of select="feed/contact"/></managingEditor>
<pubDate><xsl:value-of select="feed/publish_date"/></pubDate>
<image>
<title>Medical College of Georgia</title>
<url>http://www.mcg.edu/images/mcg100.gif</url>
<link>http://www.mcg.edu</link>
</image>
<xsl:for-each select="feed/item">
<item>
<title>
<xsl:value-of select="display_name"/>
</title>
<description>
<xsl:value-of select="description"/>
</description>
<link>
<xsl:value-of select="/feed/base_url" /><xsl:value-of select="guid"/>
</link>
<category>
<xsl:value-of select="category"/>
</category>
<guid>
<xsl:value-of select="/feed/base_url" /><xsl:value-of select="guid"/>
</guid>
<xsl:for-each select="xa:*">
<xsl:copy><xsl:apply-templates select="." /></xsl:copy>
</xsl:for-each>
</item>
</xsl:for-each>
</channel>
</rss>
</xsl:template>
</xsl:stylesheet>
Really, nothing fancy going on here (and relatively new to XSL folks, so constructive criticism is appreciated)... however...
The transformed content does not include the namespace attribute, nor do any of the source elements in the "xa" namespace appear in the output... e.g.
<rss version="2.0">
<channel>
<!-- snipped -->
<item>
<title>News Story</title>
<description>including a hyperlink in the description</description>
<link>http://mcgps10.mcg.edu:7784/portal/pls/portal/url/item/2BC6636E56F7092AE0440003BA91D789</link>
<category>Unassigned</category>
<guid>http://mcgps10.mcg.edu:7784/portal/pls/portal/url/item/2BC6636E56F7092AE0440003BA91D789</guid>
</item>
... etc....
When I run this transform in another environment--say, the NetBeans IDE--I get the expected output ("xmlns:xa=..." appears in the "rss" element, and "xa" elements appear below the "item" element).
What am I missing?
Thanks for the help.
-JohnI think I've traced this problem to how my original XML document was formed. I was actually using DBMS_XMLDOM to build the document, but when creating the text nodes, I couldn't specify a namespace for them, so I just called the element (for example) "xa:JohnsPageGroup_StoryPlacement".
Would the XSL processor see this DOM structure as I intended it?
Does 9.2 have a way to specify namespace when creating nodes. Am I hosed?
-John -
Number 0.124 is written into file using dbms_xslprocessor.CLOB2File
Number 0.124 is written into file using dbms_xslprocessor.CLOB2File.
i have done dbmds_output and checked in the Clob content the value appears as .124 but in the file it appears as 124
Please help me to rectify this problem
Edited by: 796208 on Oct 7, 2010 4:55 AMYou shouldn't have the problem. Show some test cases.
SQL> CREATE TABLE test_clob (id NUMBER,clob_col CLOB);
Table created.
SQL> DECLARE
2 v_clob_locator CLOB;
3 v_clob CLOB;
4 BEGIN
5 INSERT INTO test_clob
6 VALUES
7 (1, EMPTY_CLOB())
8 RETURNING clob_col INTO v_clob_locator;
9 v_clob := 'This is test line
10 and it coniatns 0.124 and it seems that
11 .124 is not showing.';
12 dbms_lob.append(v_clob_locator, v_clob);
13 COMMIT;
14 END;
15 /
PL/SQL procedure successfully completed.
SQL> set long 10000
SQL> SELECT * FROM test_clob;
ID
CLOB_COL
1
This is test line
and it coniatns 0.124 and it seems that
.124 is not showing.
SQL> DECLARE
2 v_clob CLOB;
3 BEGIN
4 SELECT CLOB_COL INTO v_clob
5 FROM test_clob
6 WHERE id=1;
7 DBMS_XSLPROCESSOR.clob2file(v_clob,'TEST_DIR','clobtest.txt',0);
8 END;
9 /
PL/SQL procedure successfully completed.
SQL>
C:\>type clobtest.txt
This is test line
and it coniatns 0.124 and it seems that
.124 is not showing.
C:\>The only thing is the last parameter (Character set id). -
Problem in get streaming attachment in client side
Dear friends,
I am trying to create a client program which received a streaming attachment.
i am using Jdeveloper-- Id ,Oc4j-- application server,Ubuntu---Os.
i think i have a problem in---
Vector params = new Vector();
params.addElement(new Parameter("atts", oracle.webservices.attachments.Attachments.class, atts, null));
call.setParams(params);
those lines.
i am geting these errors----
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Serializer found to serialize a 'oracle.webservices.attachments.Attachments' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=java.lang.IllegalArgumentException: No Serializer found to serialize a 'oracle.webservices.attachments.Attachments' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
at org.apache.soap.rpc.Call.invoke(Call.java:308)
at etrans.TripBean.a.ClientGateWay.caller(ClientGateWay.java:64)
at etrans.TripBean.a.ClientProgram.main(ClientProgram.java:10)
when i comment this
//params.addElement(new Parameter("atts", oracle.webservices.attachments.Attachments.class, atts, null));
--------- i am geting errors
ava.lang.Exception: Expected request attachments
at etrans.TripBean.a.ClientGateWay.caller(ClientGateWay.java:78)
at etrans.TripBean.a.ClientProgram.main(ClientProgram.java:10)
please help.Hello,
How did you get this code generated?
Did you write all by hand or you are generating a proxy?
Can you send me the full code, client and server at tugdual[dot]grall[at]oracle[dot]com. ?
Regards
Tugdual Grall -
Problem in generating the output
Hi,
I am new to Oracle XML.I'm using Oracle 10g(10.1 - 10.2) as my backend DB. I have the code below. Its purpose is to display the following values:
for id_number:
1
2
for first_name:
JOHN
MICHAEL
CREATE OR REPLACE procedure parse_CLOB1 as
l_clob CLOB := '';
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_cnl dbms_xmldom.DOMNodeList;
l_inl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_childNode dbms_xmldom.DOMNode;
l_icnode dbms_xmldom.DOMNode;
l_default_path VARCHAR2(33) := '/EMPLOYEE_REC/EMPLOYEES/RECORD';
l_temp VARCHAR2(500) := '';
l_value VARCHAR2(500) := '';
begin
l_clob := '<EMPLOYEE_REC>
<DEPARTMENT>104</DEPARTMENT>
<EMPLOYEES>
<RECORD>
<ID_NUMBER>1</ID_NUMBER>
<FIRST_NAME>JOHN</FIRST_NAME>
</RECORD>
<RECORD>
<ID_NUMBER>2</ID_NUMBER>
<FIRST_NAME>MICHAEL</FIRST_NAME>
</RECORD>
</EMPLOYEES>
</EMPLOYEE_REC>';
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),l_default_path);
FOR c IN 0 .. (dbms_xmldom.getLength(l_nl) - 1)
LOOP
l_n := dbms_xmldom.item(l_nl, c);
l_cnl := dbms_xmldom.getchildnodes(l_n);
l_childnode := dbms_xmldom.item(l_cnl, c);
l_temp := dbms_xmldom.getnodename(l_childnode);
dbms_output.put_line('The value of the inner element is: '||l_temp);
-- get the value of the inner node
l_inl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),l_default_path||'/'||l_temp);
for d in 0 .. (dbms_xmldom.getLength(l_inl) - 1)
loop
l_icnode := dbms_xmldom.item(l_inl, c);
l_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_icnode));
dbms_output.put_line(l_value);
end loop;
end loop;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('FAIL');
dbms_output.put_line(sqlerrm);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
end parse_CLOB1;
My problem is that I'm getting the wrong output below:
The value of the inner element is: ID_NUMBER
1
1
The value of the inner element is: FIRST_NAME
MICHAEL
MICHAEL
Can you help me about this?
Thanks,
JunHi,
I already found the cause. I still use the variable c in my inner loop which is supposed to be d
Regards,
Jun -
Dbms_xslprocessor oracle R2 10.2
Someone knows the differences between Oracle db 10.1 and 10.2 in dbms_xslprocessor?.
This pck works ok in 10.1 but in 10.2 the system show up an error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00240: element-start tag is not well formed
Do you know if exist a difference on this pck between the oracle versions?
Thanks.
Diego.
Edited by: DIEG0 on 25-feb-2009 10:20Hello,
Check following document on metalink
Doc ID: 6952870.8 see if this resolves your problem (bug related).
Regards -
Problem after i changed computer name
dear friends
I have changed my server name where oracle is running. I have problem with the application to connect the oracle and i have problem with enterprise manager also can any one help me how to resolve it. and tell me what are all steps need for me to fix this problem.Hello mr.Maran
While running EMCA i have this error plz help me to resolve and tell me what is that error in log...
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.ParamsManager setFlag
CONFIG: Flag 'db' set to true
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.ParamsManager setParam
CONFIG: Setting param: ORACLE_HOME value: D:\oracle\product\10.2.0\db_2
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.EMConfig isEMConfigured
CONFIG: isEMConfigured for DB: ORCL
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.ParamsManager getParam
CONFIG: No value was set for the parameter ORACLE_HOSTNAME.
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.ClusterUtil getLocalNode
CONFIG: Cluster.isCluster: false. Skip call to getLocalNode
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.ClusterUtil getLocalNode
CONFIG: isLocalNodeDone: true localNode: null
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.DBControlUtil isDBConsoleConfigured
CONFIG: Sid: ORCL Host: IME-DBS1.imeco.com Node: null OH: D:\oracle\product\10.2.0\db_2 isDBC: false
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.ParamsManager getParam
CONFIG: No value was set for the parameter ORACLE_HOSTNAME.
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.ClusterUtil getLocalNode
CONFIG: isLocalNodeDone: true localNode: null
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.CentralAgentUtil isCentralAgentConfigured
CONFIG: Sid: ORCL Host: IME-DBS1.imeco.com Node: null OH: D:\oracle\product\10.2.0\db_2 agentHome: null isCentral: false
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.OUIInventoryUtil setOUILoc
CONFIG: Setting oracle.installer.oui_loc to D:\oracle\product\10.2.0\db_2\oui
Sep 16, 2009 10:09:24 AM oracle.sysman.emcp.util.OUIInventoryUtil setOUILoc
CONFIG: Setting oracle.installer.oui_loc to D:\oracle\product\10.2.0\db_2\oui
Sep 16, 2009 10:09:25 AM oracle.sysman.emcp.util.CentralAgentUtil getCentralAgentHomeAndURL
CONFIG: Central Agent home and URL: {}
Sep 16, 2009 10:09:25 AM oracle.sysman.emcp.EMConfig finalize
CONFIG: finalize() called for EMConfig
Maybe you are looking for
-
1yr 6 mnths support experience in ABAP/can i take test?
hai guys, i have ABAP support exp of 18 mnths..can i take certificaiton test? wat is my test code?(too confused...i am working on SAP ECC 6.0) .. and i found few smaple qs..i feel BAPIS OO are asked too heavily.. where can i prepare for them??? and
-
How to manage non-SAP objects types with SAP Netweaver ?
I would like to know how it is possible to integrate into the SAP software configuration managment tools (NWDI CTS, CTS+...) non-SAP objects like shell scripts or SQL requests ? These shell scripts are, for example: - external host scheduler jobs - g
-
Sync error after update to 3.1
After updating to 3.1, I am now receiving the following error. The iphone .... cannot be synced An unknown error occurred (-39) Any ideas?
-
Searching mailbox with mobile device
Hi. A user is trying to search his mailbox with his mobile device. The phone is configured to only sync 3 days back so he "continues" the search on the server with the phone. The problem is that the phone only finds content which is 2 months old or n
-
Blocking GET Requests.....
Hi there, I have a chat program that works fine. At present the client applet is making requests at every 2 sec. to the servlet for getting new messages. The servlet on the other end responds with the message (if any) or responds as a string "no_new_