Problem using byte indexed pixel format in setPixels method of PixelWriter
I try to construct a byte array and set it to a WritableImage using PixelWriter's setPixels method.
If I use an RGB pixel format, it works. If I use a byte-indexed pixel format, I get an NPE.
The stride etc should be fine if I'm not mistaken.
java.lang.NullPointerException
at com.sun.javafx.image.impl.BaseByteToByteConverter.<init>(BaseByteToByteConverter.java:45)
at com.sun.javafx.image.impl.General$ByteToByteGeneralConverter.<init>(General.java:69)
at com.sun.javafx.image.impl.General.create(General.java:44)
at com.sun.javafx.image.PixelUtils.getB2BConverter(PixelUtils.java:223)
at com.sun.prism.Image$ByteAccess.setPixels(Image.java:770)
at com.sun.prism.Image.setPixels(Image.java:606)
at javafx.scene.image.WritableImage$2.setPixels(WritableImage.java:199)
Short, self-contained example here:
import java.nio.ByteBuffer;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelFormat;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class IndexedColorTestApp extends Application {
public static void main(String[] args) {
launch(args);
@Override
public void start(Stage primaryStage) {
BorderPane borderPane = new BorderPane();
Scene scene = new Scene(borderPane, 600, 1100);
primaryStage.setScene(scene);
ImageView imageView = new ImageView();
borderPane.setCenter(imageView);
primaryStage.show();
int imageWidth = 200;
int imageHeight = 200;
WritableImage writableImage = new WritableImage(imageWidth, imageHeight);
// this works
byte[] rgbBytePixels = new byte[imageWidth * imageHeight * 3];
PixelFormat<ByteBuffer> byteRgbFormat = PixelFormat.getByteRgbInstance();
writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
byteRgbFormat, rgbBytePixels, 0, imageWidth * 3);
imageView.setImage(writableImage);
// this throws an NPE in setPixels()
byte[] indexedBytePixels = new byte[imageWidth * imageHeight];
int[] colorPalette = new int[256];
PixelFormat<ByteBuffer> byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
byteIndexedFormat, indexedBytePixels, 0, imageWidth);
imageView.setImage(writableImage);
}If there's no solution, maybe someone knows a workaround? We chose to use indexed format because of data size / performance reasons.
Edited by: Andipa on 01.03.2013 10:52
You have found a platform bug, file it against the Runtime project at => http://javafx-jira.kenai.com with your sample code and a link back to this forum question.
Byte indexed pixel formats seem like a feature which was never completely (or perhaps even hardly at all) implemented to me.
The PixelFormat type your failed case is using is (PixelFormat.Type.BYTE_INDEXED):
PixelFormat<ByteBuffer> byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
System.out.println(byteIndexedFormat.getType());These are the valid PixelFormat types =>
http://docs.oracle.com/javafx/2/api/javafx/scene/image/PixelFormat.Type.html
BYTE_BGRA
The pixels are stored in adjacent bytes with the non-premultiplied components stored in order of increasing index: blue, green, red, alpha.
BYTE_BGRA_PRE
The pixels are stored in adjacent bytes with the premultiplied components stored in order of increasing index: blue, green, red, alpha.
BYTE_INDEXED
The pixel colors are referenced by byte indices stored in the pixel array, with the byte interpreted as an unsigned index into a list of colors provided by the PixelFormat object.
BYTE_RGB
The opaque pixels are stored in adjacent bytes with the color components stored in order of increasing index: red, green, blue.
INT_ARGB
The pixels are stored in 32-bit integers with the non-premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.
INT_ARGB_PRE
The pixels are stored in 32-bit integers with the premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.As the native pixel format for a WritableImage is not the same as the pixel format you are using, the JavaFX platform needs to do a conversion by reading the pixels in one format and writing them in another format. To do this it must be able to determine a PixelGetter for your PixelFormat (the PixelGetter is an internal thing, not public API).
And here is the source the determines the PixelGetter for a given PixelFormat type:
http://hg.openjdk.java.net/openjfx/8/master/rt/file/06afa65a1aa3/javafx-ui-common/src/com/sun/javafx/image/PixelUtils.java
119 public static <T extends Buffer> PixelGetter<T> getGetter(PixelFormat<T> pf) {
120 switch (pf.getType()) {
121 case BYTE_BGRA:
122 return (PixelGetter<T>) ByteBgra.getter;
123 case BYTE_BGRA_PRE:
124 return (PixelGetter<T>) ByteBgraPre.getter;
125 case INT_ARGB:
126 return (PixelGetter<T>) IntArgb.getter;
127 case INT_ARGB_PRE:
128 return (PixelGetter<T>) IntArgbPre.getter;
129 case BYTE_RGB:
130 return (PixelGetter<T>) ByteRgb.getter;
131 }
132 return null;
133 }As you can see, the BYTE_INDEXED format is not handled and null is returned instead . . . this is the source of your NullPointerException.
Similar Messages
-
Using Y8/Y16 pixel format in LabVIEW through DirectShow
I am trying to use Y8 or Y16 pixel format (also called Mono8 or Mono16) on a FireWire camera through DirectShow. However, these formats always showed up as unknown in NI-MAX's "Video Mode" drop down menu. Interestingly, "Snap" worked properly and images were acquired correctly using these two formats in NI-MAX.
I am a bit puzzled why they showed up as unkown. Could this be an issue with camera's own DirectShow filter?
Has any one else used Y8 or Y16 pixel formats successfully in NI-MAX on a FireWire camera? How were they listed in "Video Mode" menu?
Thanks in advance.Hi,
The list of DirectShow pixel formats that IMAQdx knows about comes from the list Microsoft defines here:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd407353(v=vs.85).aspx
Looking at the uncompressed RGB list (includes monochrome as well) and note that there are no 16-bit monochome formats in that list. The only true "grayscale" formats (those where DirectShow does not give us an RGB color image) are RGB1, RGB4, and RGB8. Any other formats will be translated by DirectShow to an RGB image.
Essentially if your camera is returning an image format that is not listed in Microsoft's defined list of GUIDs, it will show up as "Unknown" and IMAQdx will expect it to be an RGB image. DirectShow will convert the image using whatever filters you have installed to that format.
Eric -
Hi all,
i'm using Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 on Windows.
I created this table
create table PERSISTENT_COMPOSITION
COMPOSITION_ID NUMBER(19) not null,
XML_CONTENT SYS.XMLTYPE not null,
)and filled it with more or less 1.000.000 records (that si 1.000.000 xml document loaded into XML_CONTENT).
Then first of all i tested it with a simple query just like the following:
SELECT *
FROM PERSISTENT_COMPOSITION t
WHERE existsNode(t.xml_content, '/composition/archetype_details/archetype_id[value="openEHR-EHR-COMPOSITION.composition_test.v1"]') = 1;obtaining the expected result: 50,000 records found.
Now, in order to improve query performances, i created a CTXXPATH index as follows:
CREATE INDEX IDX#COMP_CTXXPATH ON PERSISTENT_COMPOSITION(XML_CONTENT) INDEXTYPE IS CTXSYS.CTXXPATH;Then i tested the new performances using exactly the same query shown above...and here comes the problem: the query returns NO RESULT! No record was found! I looked at the query execution plan and it uses the created index IDX#COMP_CTXXPATH...but no record could be found...
I thought it could be a matter of namespace: in fact loaded xml documents have a xmlns set and so i changed the query as follows:
SELECT *
FROM persistent_composition t
WHERE existsNode(t.xml_content,
'/composition/archetype_details/archetype_id[value="openEHR-EHR-COMPOSITION.composition_test.v1"]',
'xmlns="http://this.is.an.xmlns.url.org/v1"') = 1and surprise: i obtained my 50,000 results just like before BUT, looking at the query execution plan, the IDX#COMP_CTXXPATH index HASN'T BEEN USED!!!
I really don't understand why using the IDX#COMP_CTXXPATH i get no result....can someone help me?
Thank you very much
P.S: i tried using ANALYZE (both on index and on table), CTX_DDL.sync_index and CTX_DDL.optimize_index but got no result..
Edited by: user11295548 on 29-giu-2009 5.47Besides following Mark's advice, and I could be mistaken regarding this in combination with domain indexes, you should NOT use ANALYZE anymore in a Oracle 10 environment. Instead use DBMS_STATS. Its more flexible.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4005.htm#SQLRF01105
Note:
Do not use the COMPUTE and ESTIMATE clauses of ANALYZE to collect optimizer statistics.
These clauses are supported for backward compatibility.
Instead, use the DBMS_STATS package, which lets you collect statistics in parallel,
collect global statistics for partitioned objects, and fine tune your statistics collection
in other ways. The optimizer, which depends upon statistics, will eventually use only
statistics that have been collected by DBMS_STATS.
See PL/SQL Packages and Types Reference for more information on the
DBMS_STATS package. You must use the ANALYZE statement (rather than
DBMS_STATS) for statistics collection not related to the cost-based optimizer, such as:
- To use the VALIDATE or LIST CHAINED ROWS clauses
- To collect information on freelist blocks -
Problem using byte[] against clolumn of typ euniqueidentifier in MS SqlServer
Hello,
I'm actually evaluating Kodo 3.1.2.
I've got a class with attribute of type byte[] I would like to map to column
of type uniqueidentifier in SQLServer.
When I run my test code, I get the following exception :
813 INFO [main] kodo.jdbc.JDBC - Using dictionary class
"kodo.jdbc.sql.SQLServerDictionary" (Microsoft SQL Server 8.0.534 ,i-net
OPTA 2000 5.02).
907 INFO [main] kodo.MetaData - Parsing metadata resource
"file:/W:/root/KodoSimple/bin/test/package.jdo".
1422 INFO [main] kodo.jdbc.Schema - Reading table information for schema
name "null", table name "agent".
kodo.jdbc.meta.MappingInfoNotFoundException: The "column"
attribute/extension for field "test.Agent.id" names a column "agtid" in
table "AGENT" whose type (UNKNOWN(-11)) is not compatible with the type of
the field (BLOB).
at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:134)
at
kodo.jdbc.meta.ColumnFieldMapping.fromMappingInfo(ColumnFieldMapping.java:11
6)
at
kodo.jdbc.meta.ByteArrayFieldMapping.fromMappingInfo(ByteArrayFieldMapping.j
ava:55)
at
kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider
..java:160)
at
kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:429)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.jav
a:911)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.jav
a:891)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.jav
a:666)
at
kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvider.java
:89)
at
kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:3
64)
at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:307)
at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:162)
at kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:150)
at
kodo.runtime.PersistenceManagerImpl.makePersistentInternal(PersistenceManage
rImpl.java:1905)
at
kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.ja
va:1858)
at test.Testeur.main(Testeur.java:34)
I've found a workaround which consists in desactivating type verification
using kodo.jdbc.SchemaFactory=dynamic
My questions are :
is this the good way to achieve what I want to do ?
could you support the uniqueidentfier column type ?
Best regards,
DomWe'll try to be more flexible with unknown types in the next patch
release. Thanks for the report. And yes, disabling validation with the
dynamic schema factory is a reasonable solution for now. -
i am trying to cut and paste from a program, IEP DIRECT, and normally on my PC I have no problems; however, when using my MAC the formatting gets all mixed up
If you refer to this
https://www.iepdirect.com/iepdotnet/hub/index.html
then they have an issue with mac version.
At a first glance, their website is optimized for Windows only, it displays badly in Safari, perhaps it would be better in Firefox or other browser. -
Problem using two function based indexes at once!
Hello Oracle!
I've got problems using two function based indexes on geometries at once.
The problem occures, when I use a spatial join between two geometries both using function based indexes.
The test case:
CREATE TABLE quad (centroid NUMBER);
CREATE TABLE points (no NUMBER, point MDSYS.SDO_GEOMETRY);
CREATE OR REPLACE FUNCTION getQuad (centroid NUMBER) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC IS
BEGIN
RETURN MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(centroid-5,centroid-5,centroid+5,centroid-5,centroid+5,centroid+5,centroid-5,centroid+5,centroid-5,centroid-5));
END;
INSERT INTO USER_SDO_GEOM_METADATA VALUES('quad','tiedge.getQuad(centroid)',MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', -100, 100, .0000001), MDSYS.SDO_DIM_ELEMENT('Y', -100, 100, .0000001)),NULL);
CREATE INDEX quad_idx on quad(getQuad(centroid)) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
INSERT INTO quad VALUES (0);
INSERT INTO quad VALUES (5);
INSERT INTO quad VALUES (10);
INSERT INTO points VALUES (1, MDSYS.SDO_GEOMETRY(1001,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(4,4)));
ALTER SESSION SET QUERY_REWRITE_INTEGRITY=TRUSTED;
ALTER SESSION SET QUERY_REWRITE_ENA[i]Long postings are being truncated to ~1 kB at this time.hi there,
For a better audience for this question, I'd look at the database forum.
guys on that will be a lot more familiar with FBIs
thanks
Barry -
Problem: Problem
is occurring in docx format; it is not printing “New Line” character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.
Environment: -
Operating
System:
Windows XP SP2/7
Language:
C#
MS
Office Version: - MS Office 2007/2010/2013
Problem
Description: -
We
havedocx
file with new line character, and we are processing this file in IFilter for extracting text, and it is giving output with concatenation of lines.
Docx
file format (Sample.docx)
Test this music
Word processing
Testing docx file
Output:
- Test this music Word processing Testing docx file
Requirement:
- We
have requirement to get following text in particular format with New Line from docx because client is using docx format only.
Test this music
Word processing
Testing docx file
Attempt:
We have tried a lot after changing IFilter configuration,
but it is not giving required output. Then we saved same file in doc format (Sample.doc), which is giving required output.
Because it is application specific problem, kindly
assist to resolve issue on priority. We are sharing IFilter paths for extracting text for doc and docx.
Doc Filter Location: - %systemroot%\system32\OffFilt.dll
Docx Filter Location: - <Drive>:\PROGRA~1\COMMON~1\MICROS~1\Filters\offfiltx.dll
Code Snippet for setting property of filter
internal static IFilter LoadAndInitIFilter(string fileName, string extension)
IFilter filter
= LoadIFilter(extension);
if (filter
== null)
return null;
IPersistFile persistFile
= (filter as IPersistFile);
if (persistFile
!= null)
persistFile.Load(fileName, 0);
IFILTER_FLAGS flags;
IFILTER_INIT iflags
=
IFILTER_INIT.CANON_HYPHENS
|
IFILTER_INIT.CANON_PARAGRAPHS
|
IFILTER_INIT.CANON_SPACES
|
IFILTER_INIT.APPLY_INDEX_ATTRIBUTES
|
IFILTER_INIT.HARD_LINE_BREAKS
|
IFILTER_INIT.FILTER_OWNED_VALUE_OK;
if (filter.Init(iflags,
0, IntPtr.Zero, out flags)
==IFilterReturnCode.S_OK)
return filter;
Marshal.ReleaseComObject(filter);
return null;
Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we would be really
thankful.Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we
would be really thankful. -
i have downloaded OS X Yosemite using recovery from boot but while installing error occuring showing unable to extract essential.pkg so can't install. problem is i have already formatted my drive and dont have any os right now. only the downloaded new os x yosemite in the os x base system. please help
Please try again after taking each of the following steps that you haven't already taken.
Step 1
Reset your computer’s PRAM.
Step 2
If your model has user-replaceable memory, and you've upgraded the memory modules, reinstall the original memory and see whether there's any improvement. Be careful not to touch the gold contacts. Clean them with a mild solvent such as rubbing alcohol. Aftermarket memory must exactly match the technical specifications of the machine.
Step 3
Back up all data to at least two different storage devices, if you haven't already done so. One backup is not enough to be safe. The backups can be made with Time Machine or with Disk Utility. Preferably both.
Erase and install OS X. This operation will destroy all data on the startup volume, so you had be better be sure of the backups.
Step 4
Make a "Genius" appointment at an Apple Store, or go to another authorized service provider to have the machine tested. -
HT1819 'Byte-Range' request error, but no problems using Advanced menu
On Windows Vista PC, latest iTunes update:
No trouble subscribing to podcast feed using Advanced menu. iTunes will even update/load new episodes, but I receive 'byte-range' request error when submitting podcast feed to the directory.
Is it normal to be able to use the advanced menu option, but not be able to submit the same feed to the podcast directory?
PS: No trouble subscribing to same feed with Banshee media player using ubuntu Natty Narwhal. All podcast artwork and information intact.I'm afraid you've fallen over a requirement that Apple has recently introduced. The iPhone plays podcasts by using 'byte-range requests', which means calling for part of the file at a time rather than the whole thing. Unfortunately some servers don't support this, and there were an increasing number of complaints that podcasts which worked elsewhwere weren't working on an iPhone.
So Apple are now making the ability to handle this a condition of submission. Evidently your server doesn't support this, so all you can do is to ask them whether they can implement it. If not, you will have to find another hosting service - ask about this before committing yourself, and if they say no, or don't know what it is, find another host. -
Use of Index, Histograms, etc
Hi all,
We're using Oracle 9.2.04.
I have a table with 500000 rows.
So I have a query that returns only 30242 for a month, like:
SELECT * FROM T1
WHERE TO_CHAR(DT, 'MM/YYYY') = TO_CHAR(ADD_MONTHS(SYSDATE, -1), 'MM/YYYY')
I have a index for this column:
CREATE INDEX IND_T1_DT_FMT ON T1 (TO_CHAR(DT, 'MM/YYYY'))
TABLESPACE TBS_SOME_USER;
There are statistics for this table.
Looking the table data, I have the following distribution:
Qty MON/YY %
1 Feb-09 0.000219142
99 Apr-09 0.021695016
38439 May-09 8.42358314
98231 Jun-09 21.52649641
1 Jul-06 0.000219142
139959 Jul-09 30.6708362
1 Aug-02 0.000219142
1 Aug-07 0.000219142
141362 Aug-09 30.97829184
30242 Sep-09 6.62727962
7990 1.750941213But when a perform the query (that returns 30242 rows - 6.63% of table):
SELECT * FROM T1
WHERE TO_CHAR(DT, 'MM/YYYY') = TO_CHAR(ADD_MONTHS(SYSDATE, -1), 'MM/YYYY')
Oracle uses FTS:
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=432 Card=45633 Bytes
=3011778)
1 0 TABLE ACCESS (FULL) OF 'T1' (Cost=432 Card=45633 Bytes
=3011778)
So, Oracle should not use the index in this case?
Is there any way to gather statistics for this table with a index based function?
Something like this:
EXECUTE DBMS_STATS.GATHER_TABLE_STATS(ownname => 'U1',
tabname => 'T1', method_opt => 'FOR COLUMNS TO_CHAR(DT, ''MM/YYYY'')',
cascade => true, degree => 4);
How can I create histograms for this case?
Or other solution, like Partition?
thank you very much!!!!Always treat dates like dates.
This
SELECT * FROM T1
WHERE TO_CHAR(DT, 'MM/YYYY') = TO_CHAR(ADD_MONTHS(SYSDATE, -1), 'MM/YYYY')Should be more like this:
SELECT * FROM T1
WHERE DT BETWEEN TRUNC(ADD_MONTHS(SYSDATE,-1),'MM') AND TRUNC(SYSDATE,'MM')-1 ;Then you should index DT.
But, should this query use the index?
Touch and go at 6.63%.
Give it a go using dates as dates and see if it makes a difference.
Is there a problem with the performance of the FTS? -
Problem using existsnode from view
I am having a problem using existsnode from a view. I am currently using 10.2.0.3
example
CREATE OR REPLACE VIEW XML_PERSON_ASSOCIATION
(PERSON)
AS
select
xmlelement("Person",
xmlforest(
extractvalue(value(p),'/Person/PersonID') "PersonID",
extractvalue(value(p),'/Person/Prefix') "Prefix",
extractvalue(value(p),'/Person/FirstName') "FirstName",
extractvalue(value(p),'/Person/MiddleName') "MiddleName",
extractvalue(value(p),'/Person/LastName') "LastName",
extractvalue(value(p),'/Person/Suffix') "Suffix",
extractvalue(value(p),'/Person/PreferredName') "PreferredName",
extractvalue(value(p),'/Person/Gender') "Gender",
extractvalue(value(p),'/Person/PrimaryLanguage') "PrimaryLanguage",
extractvalue(value(p),'/Person/RecordStatus') "RecordStatus",
extractvalue(value(p),'/Person/ImportedDate') "ImportedDate",
(select
xmlagg(
xmlelement("Association",
xmlforest(
extractvalue(value(oa),'/OrganizationPersonAssoc/Name') "Name",
extractvalue(value(ot),'/OrganizationType/OrganizationID') "OrganizationID",
extractvalue(value(ot),'/OrganizationType/Type') "OrganizationType",
extractvalue(value(a),'/Association/Role') "Role",
extractvalue(value(a),'/Association/RecordStatus') "RecordStatus",
extractvalue(value(oa),'/OrganizationPersonAssoc/ImportedDate') "ImportedDate"
xmlelement("PersonTypes",
extract(value(per),'/Person/PersonTypes/PersonType')
xmlelement("Addresses",
extract(value(a),'/Association/Addresses/Address')
xmlelement("ContactMechanisms",
extract(value(a),'/Association/ContactMechanisms/ContactMechanism')
from org_person_assoc oa,
table(xmlsequence(extract(value(oa),'/OrganizationPersonAssoc/OrganizationTypes/OrganizationType'))) ot,
table(xmlsequence(extract(value(ot),'/OrganizationType/Associations/Association'))) a,
table(xmlsequence(extract(value(a),'/Association/Persons/Person'))) per
where extractvalue(value(per),'/Person/PersonID') = extractvalue(value(p),'/Person/PersonID')
) "Associations"
) person
from person p
/When I run the following statment
select person
from xml_person_association o
where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1;
I get no records returned. Now if I used the extract function and use the same path that's in the existsnode clause I get a record returned.
select extract(person,'/Person/Associations/Association')
from xml_person_association o
where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1;
<Association>
<Name>TEST DATA</Name>
<OrganizationID>30097</OrganizationID>
</Association>
If I run the same style of existsnode statment against a table directly instead of a view I am not required to use an extract caluse that has the same path that is used in the existsnode clause.
Thanks for the help.
Message was edited by:
mdrakeTesting in 11g I get
SQL>
SQL>
SQL> set echo on
SQL> spool testcase.log
SQL> --
SQL> connect sys/ as sysdba
Enter password:
Connected.
SQL> set define on
SQL> set timing on
SQL> --
SQL> define USERNAME = XDBTEST
SQL> --
SQL> def PASSWORD = XDBTEST
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user XDBTEST cascade
User dropped.
Elapsed: 00:00:09.42
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to XDBTEST identified by XDBTEST
Grant succeeded.
Elapsed: 00:00:00.03
SQL> grant create any directory, drop any directory to &USERNAME
2 /
old 1: grant create any directory, drop any directory to &USERNAME
new 1: grant create any directory, drop any directory to XDBTEST
Grant succeeded.
Elapsed: 00:00:00.00
SQL> grant alter session, create view to &USERNAME
2 /
old 1: grant alter session, create view to &USERNAME
new 1: grant alter session, create view to XDBTEST
Grant succeeded.
Elapsed: 00:00:00.00
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
User altered.
Elapsed: 00:00:00.00
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> alter session set events ='19027 trace name context forever, level 0x800'
2 /
Session altered.
Elapsed: 00:00:00.00
SQL> var xmlText1 clob
SQL> var xmlText2 clob
SQL> var xmlSchema clob
SQL> var schemaURL varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'mcs.xsd';
3 :xmlSchema :=
4 '<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Shaun (PPD Inc) --> <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xdb=
"http://xmlns.oracle.com/xdb" elementFormDefault="qualified" xdb:storeVarrayAsTable="true">
5 <s:element name="Organization" type="Organization" xdb:defaultTable="ORG"/>
6 <s:element name="Person" type="Person" xdb:defaultTable="PERSON"/>
7 <s:element name="OrganizationPersonAssoc" type="Organization" xdb:defaultTable="ORG_PERSON_ASSOC"/>
8 <s:complexType name="Organization" xdb:SQLType="Organization">
9 <s:sequence minOccurs="0">
10 <s:element name="Name" type="s:string" nillable="true"/>
11 <s:element name="LongName" type="s:string" nillable="true"/>
12 <s:element name="Description" type="s:string" nillable="true"/>
13 <s:element name="FWANumber" type="s:string" nillable="true"/>
14 <s:element name="GUID" type="s:string" nillable="true"/>
15 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
16 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
17 <s:element name="RecordStatus" type="s:string" nillable="true"/>
18 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
19 <s:element name="OrganizationTypes" type="ArrayOfOrganizationType" minOccurs="0"/>
20 <s:element name="OrganizationSynonyms" type="ArrayOfOrganizationSynonym"/>
21 <s:element name="ImportedDate" type="s:date"/>
22 </s:sequence>
23 </s:complexType>
24 <s:complexType name="ArrayOfOrganizationType" xdb:SQLType="ArrayOfOrganizationType">
25 <s:sequence minOccurs="0">
26 <s:element name="OrganizationType" type="OrganizationType" minOccurs="0" maxOccurs="unbounded"/>
27 </s:sequence>
28 </s:complexType>
29 <s:complexType name="OrganizationType" xdb:SQLType="OrganizationType">
30 <s:sequence minOccurs="0">
31 <s:element name="OrganizationID" type="s:string"/>
32 <s:element name="Type" type="s:string" nillable="true"/>
33 <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
34 <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
35 <s:element name="SiteEstablishmentStatus" type="s:string" nillable="true"/>
36 <s:element name="SiteEstablishmentStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
37 <s:element name="IPFNumber" type="s:int"/>
38 <s:element name="DUNSNumber" type="s:int"/>
39 <s:element name="GUID" type="s:string" nillable="true"/>
40 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
41 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
42 <s:element name="RecordStatus" type="s:string" nillable="true"/>
43 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
44 <s:element name="LegacyCodes" type="ArrayOfLegacyCode" minOccurs="0"/>
45 <s:element name="Addresses" type="ArrayOfAddress" minOccurs="0"/>
46 <s:element name="ContactMechanisms" type="ArrayOfContactMechanism" minOccurs="0"/>
47 <s:element name="Associations" type="ArrayOfAssociation" minOccurs="0"/>
48 </s:sequence>
49 </s:complexType>
50 <s:complexType name="ArrayOfLegacyCode" xdb:SQLType="ArrayOfLegacyCode">
51 <s:sequence minOccurs="0">
52 <s:element name="LegacyCode" type="LegacyCode" minOccurs="0" maxOccurs="unbounded"/>
53 </s:sequence>
54 </s:complexType>
55 <s:complexType name="LegacyCode" xdb:SQLType="LegacyCode">
56 <s:sequence minOccurs="0">
57 <s:element name="Code" type="s:string" nillable="true"/>
58 <s:element name="NetworkID" type="s:string"/>
59 <s:element name="GUID" type="s:string" nillable="true"/>
60 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
61 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
62 <s:element name="RecordStatus" type="s:string" nillable="true"/>
63 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
64 </s:sequence>
65 </s:complexType>
66 <s:complexType name="ArrayOfAddress" xdb:SQLType="ArrayOfAddress">
67 <s:sequence minOccurs="0">
68 <s:element name="Address" type="Address" minOccurs="0" maxOccurs="unbounded"/>
69 </s:sequence>
70 </s:complexType>
71 <s:complexType name="Address" xdb:SQLType="Address">
72 <s:sequence minOccurs="0">
73 <s:element name="StreetName1" type="s:string" nillable="true"/>
74 <s:element name="StreetName2" type="s:string" nillable="true"/>
75 <s:element name="StreetName3" type="s:string" nillable="true"/>
76 <s:element name="StreetName4" type="s:string" nillable="true"/>
77 <s:element name="CityName" type="s:string" nillable="true"/>
78 <s:element name="CityGUID" type="s:string" nillable="true"/>
79 <s:element name="CityCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
80 <s:element name="CityLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
81 <s:element name="CityRecordStatus" type="s:string" nillable="true"/>
82 <s:element name="CityRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
83 <s:element name="StateName" type="s:string" nillable="true"/>
84 <s:element name="StateGUID" type="s:string" nillable="true"/>
85 <s:element name="StateCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
86 <s:element name="StateLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
87 <s:element name="StateRecordStatus" type="s:string" nillable="true"/>
88 <s:element name="StateRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
89 <s:element name="CountryName" type="s:string" nillable="true"/>
90 <s:element name="CountryCode" type="s:string" nillable="true"/>
91 <s:element name="CountryGUID" type="s:string" nillable="true"/>
92 <s:element name="CountryCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
93 <s:element name="CountryLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
94 <s:element name="CountryRecordStatus" type="s:string" nillable="true"/>
95 <s:element name="CountryRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
96 <s:element name="ZipPostalCode" type="s:string" nillable="true"/>
97 <s:element name="GUID" type="s:string" nillable="true"/>
98 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
99 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
100 <s:element name="RecordStatus" type="s:string" nillable="true"/>
101 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
102 <s:element name="Type" type="s:string" nillable="true"/>
103 <s:element name="TypeOtherSpecify" type="s:string" nillable="true"/>
104 <s:element name="InternalOffice" type="s:string" nillable="true"/>
105 <s:element name="MailStopCode" type="s:string" nillable="true"/>
106 <s:element name="PreferredFlag" type="s:string" nillable="true"/>
107 <s:element name="ActiveFromDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
108 <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
109 <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
110 </s:sequence>
111 </s:complexType>
112 <s:complexType name="ArrayOfContactMechanism" xdb:SQLType="ArrayOfContactMechanism">
113 <s:sequence minOccurs="0">
114 <s:element name="ContactMechanism" type="ContactMechanism" minOccurs="0" maxOccurs="unbounded"/>
115 </s:sequence>
116 </s:complexType>
117 <s:complexType name="ContactMechanism" xdb:SQLType="ContactMechanism">
118 <s:sequence minOccurs="0">
119 <s:element name="ContactType" type="s:string" nillable="true"/>
120 <s:element name="ContactTypeOtherSpecify" type="s:string" nillable="true"/>
121 <s:element name="ContactValue" type="s:string" nillable="true"/>
122 <s:element name="ContactAreaCode" type="s:string" nillable="true"/>
123 <s:element name="ContactCountryCallingCode" type="s:int"/>
124 <s:element name="ContactTollFreeFlag" type="s:string" nillable="true"/>
125 <s:element name="ContactGUID" type="s:string" nillable="true"/>
126 <s:element name="ContactCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
127 <s:element name="ContactLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
128 <s:element name="ContactRecordStatus" type="s:string" nillable="true"/>
129 <s:element name="ContactRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
130 <s:element name="Role" type="s:string" nillable="true"/>
131 <s:element name="PhoneExtension" type="s:string" nillable="true"/>
132 <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
133 <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
134 <s:element name="ActiveFromDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
135 <s:element name="GUID" type="s:string" nillable="true"/>
136 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
137 <s:element name="ModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
138 <s:element name="PreferredFlag" type="s:string" nillable="true"/>
139 <s:element name="RecordStatus" type="s:string" nillable="true"/>
140 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
141 </s:sequence>
142 </s:complexType>
143 <s:complexType name="ArrayOfAssociation" xdb:SQLType="ArrayOfAssociation">
144 <s:sequence minOccurs="0">
145 <s:element name="Association" type="Association" minOccurs="0" maxOccurs="unbounded"/>
146 </s:sequence>
147 </s:complexType>
148 <s:complexType name="Association" xdb:SQLType="Association">
149 <s:sequence minOccurs="0">
150 <s:element name="Role" type="s:string" nillable="true"/>
151 <s:element name="GUID" type="s:string" nillable="true"/>
152 <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
153 <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
154 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
155 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
156 <s:element name="RecordStatus" type="s:string" nillable="true"/>
157 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
158 <s:element name="Addresses" type="ArrayOfAddress" minOccurs="0"/>
159 <s:element name="ContactMechanisms" type="ArrayOfContactMechanism" minOccurs="0"/>
160 <s:element name="Persons" type="ArrayOfPerson" minOccurs="0"/>
161 </s:sequence>
162 </s:complexType>
163 <s:complexType name="ArrayOfPerson" xdb:SQLType="ArrayOfPerson">
164 <s:sequence minOccurs="0">
165 <s:element name="Person" type="Person" minOccurs="0" maxOccurs="unbounded"/>
166 </s:sequence>
167 </s:complexType>
168 <s:complexType name="Person" xdb:SQLType="Person">
169 <s:sequence minOccurs="0">
170 <s:element name="PersonID" type="s:int"/>
171 <s:element name="Prefix" type="s:string" nillable="true"/>
172 <s:element name="FirstName" type="s:string" nillable="true"/>
173 <s:element name="MiddleName" type="s:string" nillable="true"/>
174 <s:element name="LastName" type="s:string" nillable="true"/>
175 <s:element name="Suffix" type="s:string" nillable="true"/>
176 <s:element name="PreferredName" type="s:string" nillable="true"/>
177 <s:element name="Gender" type="s:string" nillable="true"/>
178 <s:element name="PrimaryLanguage" type="s:string" nillable="true"/>
179 <s:element name="GUID" type="s:string" nillable="true"/>
180 <s:element name="RecordStatus" type="s:string" nillable="true"/>
181 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
182 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
183 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
184 <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
185 <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
186 <s:element name="PersonDegrees" type="ArrayOfPersonDegree" minOccurs="0"/>
187 <s:element name="PersonSpecialties" type="ArrayOfPersonSpecialty" minOccurs="0"/>
188 <s:element name="PersonTypes" type="ArrayOfPersonType" minOccurs="0"/>
189 <s:element name="Addresses" type="ArrayOfAddress" minOccurs="0"/>
190 <s:element name="ContactMechanisms" type="ArrayOfContactMechanism" minOccurs="0"/>
191 <s:element name="ImportedDate" type="s:date"/>
192 </s:sequence>
193 </s:complexType>
194 <s:complexType name="ArrayOfPersonDegree" xdb:SQLType="ArrayOfPersonDegree">
195 <s:sequence minOccurs="0">
196 <s:element name="PersonDegree" type="PersonDegree" minOccurs="0" maxOccurs="unbounded"/>
197 </s:sequence>
198 </s:complexType>
199 <s:complexType name="PersonDegree" xdb:SQLType="PersonDegree">
200 <s:sequence minOccurs="0">
201 <s:element name="Code" type="s:string" nillable="true"/>
202 <s:element name="Major" type="s:string" nillable="true"/>
203 <s:element name="ListingOrder" type="s:int"/>
204 <s:element name="GUID" type="s:string" nillable="true"/>
205 <s:element name="RecordStatus" type="s:string" nillable="true"/>
206 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
207 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
208 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
209 </s:sequence>
210 </s:complexType>
211 <s:complexType name="ArrayOfPersonSpecialty" xdb:SQLType="ArrayOfPersonSpecialty">
212 <s:sequence minOccurs="0">
213 <s:element name="PersonSpecialty" type="PersonSpecialty" minOccurs="0" maxOccurs="unbounded"/>
214 </s:sequence>
215 </s:complexType>
216 <s:complexType name="PersonSpecialty" xdb:SQLType="PersonSpecialty">
217 <s:sequence minOccurs="0">
218 <s:element name="Name" type="s:string" nillable="true"/>
219 <s:element name="GUID" type="s:string" nillable="true"/>
220 <s:element name="RecordStatus" type="s:string" nillable="true"/>
221 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
222 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
223 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
224 </s:sequence>
225 </s:complexType>
226 <s:complexType name="ArrayOfPersonType" xdb:SQLType="ArrayOfPersonType">
227 <s:sequence minOccurs="0">
228 <s:element name="PersonType" type="PersonType" minOccurs="0" maxOccurs="unbounded"/>
229 </s:sequence>
230 </s:complexType>
231 <s:complexType name="PersonType" xdb:SQLType="PersonType">
232 <s:sequence minOccurs="0">
233 <s:element name="Type" type="s:string" nillable="true"/>
234 <s:element name="GUID" type="s:string" nillable="true"/>
235 <s:element name="RecordStatus" type="s:string" nillable="true"/>
236 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
237 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
238 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
239 <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
240 <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
241 </s:sequence>
242 </s:complexType>
243 <s:complexType name="ArrayOfOrganizationSynonym" xdb:SQLType="ArrayOfOrganizationSynonym">
244 <s:sequence minOccurs="0">
245 <s:element name="OrganizationSynonym" type="OrganizationSynonym" minOccurs="0" maxOccurs="unbounded"/>
246 </s:sequence>
247 </s:complexType>
248 <s:complexType name="OrganizationSynonym" xdb:SQLType="OrganizationSynonym">
249 <s:sequence minOccurs="0">
250 <s:element name="Name" type="s:string" nillable="true"/>
251 <s:element name="GUID" type="s:string" nillable="true"/>
252 <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
253 <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
254 <s:element name="RecordStatus" type="s:string" nillable="true"/>
255 <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
256 </s:sequence>
257 </s:complexType>
258 </s:schema>';
259 :xmltext1 :=
260 '<?xml version="1.0" encoding="WINDOWS-1252"?> <Person xsi:noNamespaceSchemaLocation="mcs.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
:xsi="http://www.w3.org/2001/XMLSchema-instance">
261 <PersonID>100448</PersonID>
262 <Prefix/>
263 <FirstName>John</FirstName>
264 <MiddleName/>
265 <LastName>Doe</LastName>
266 <Suffix/>
267 <PreferredName/>
268 <Gender/>
269 <PrimaryLanguage xsi:nil="true"/>
270 <GUID>ffff-ffff-ffff</GUID>
271 <RecordStatus>Active</RecordStatus>
272 <RecordStatusDate>2007-04-29T00:11:50.750000-04:00</RecordStatusDate>
273 <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
274 <LastModifiedDate>2007-04-29T00:11:50.770000-04:00</LastModifiedDate>
275 <QCDoneStatus>Yes</QCDoneStatus>
276 <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
277 <PersonDegrees>
278 <PersonDegree>
279 <Code>B.S.</Code>
280 <Major xsi:nil="true"/>
281 <ListingOrder>1</ListingOrder>
282 <GUID>d01bbcfd-9d48-47bf-818d-9957b907a664</GUID>
283 <RecordStatus>Active</RecordStatus>
284 <RecordStatusDate>2006-10-05T10:48:04.430000-04:00</RecordStatusDate>
285 <CreatedDate>2006-10-05T10:48:06.520000-04:00</CreatedDate>
286 <LastModifiedDate>2006-10-05T10:48:06.520000-04:00</LastModifiedDate>
287 </PersonDegree>
288 </PersonDegrees>
289 <PersonSpecialties/>
290 <PersonTypes>
291 <PersonType>
292 <Type>Resource Personnel</Type>
293 <GUID>3049ddcd-3590-4fd9-a534-e2cea5b82c09</GUID>
294 <RecordStatus>Active</RecordStatus>
295 <RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate>
296 <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
297 <LastModifiedDate>2007-04-29T00:11:50.817000-04:00</LastModifiedDate>
298 <QCDoneStatus>Yes</QCDoneStatus>
299 <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
300 </PersonType>
301 </PersonTypes>
302 <Addresses/>
303 <ContactMechanisms/>
304 <ImportedDate>2007-04-30</ImportedDate>
305 </Person>';
306 :xmltext2 :=
307 '<?xml version="1.0" encoding="WINDOWS-1252"?> <OrganizationPersonAssoc xsi:noNamespaceSchemaLocation="mcs.xsd" xmlns:xsd="http://www.w3.org/2001
/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
308 <Name>Org Name Office</Name>
309 <LongName>Long Name</LongName>
310 <Description xsi:nil="true"/>
311 <FWANumber xsi:nil="true"/>
312 <GUID>dddd-dddd</GUID>
313 <CreatedDate>2006-05-18T18:59:01.500000-04:00</CreatedDate>
314 <LastModifiedDate>2006-05-18T18:59:01.500000-04:00</LastModifiedDate>
315 <RecordStatus>Active</RecordStatus>
316 <RecordStatusDate>2006-05-18T18:59:01.500000-04:00</RecordStatusDate>
317 <OrganizationTypes>
318 <OrganizationType>
319 <OrganizationID>30097</OrganizationID>
320 <Type>Agency</Type>
321 <QCDoneStatus>Yes</QCDoneStatus>
322 <QCDoneStatusDate>2006-05-18T18:59:01.513000-04:00</QCDoneStatusDate>
323 <SiteEstablishmentStatus xsi:nil="true"/>
324 <SiteEstablishmentStatusDate>0001-01-01T00:00:00.000000-05:00</SiteEstablishmentStatusDate>
325 <IPFNumber>0</IPFNumber>
326 <DUNSNumber>0</DUNSNumber>
327 <GUID>cfe9e9e0-68a3-45c9-81c0-74848523133b</GUID>
328 <CreatedDate>2006-05-18T18:59:01.513000-04:00</CreatedDate>
329 <LastModifiedDate>2006-05-18T18:59:01.513000-04:00</LastModifiedDate>
330 <RecordStatus>Active</RecordStatus>
331 <RecordStatusDate>2006-05-18T18:59:01.513000-04:00</RecordStatusDate>
332 <Associations>
333 <Association>
334 <Role>Employee</Role>
335 <GUID>9a9a9a-ababab</GUID>
336 <QCDoneStatus>Yes</QCDoneStatus>
337 <QCDoneStatusDate>2006-06-13T01:29:09.030000-04:00</QCDoneStatusDate>
338 <CreatedDate>2006-06-13T01:29:09.030000-04:00</CreatedDate>
339 <LastModifiedDate>2006-07-25T15:27:23.783000-04:00</LastModifiedDate>
340 <RecordStatus>Active</RecordStatus>
341 <RecordStatusDate>2006-06-13T01:29:09.030000-04:00</RecordStatusDate>
342 <Addresses>
343 <Address>
344 <StreetName1>123 Front St.</StreetName1>
345 <StreetName2 xsi:nil="true"/>
346 <StreetName3 xsi:nil="true"/>
347 <StreetName4 xsi:nil="true"/>
348 <CityName>City</CityName>
349 <CityGUID>234234</CityGUID>
350 <CityCreatedDate>2006-05-08T20:06:45.143000-04:00</CityCreatedDate>
351 <CityLastModifiedDate>2006-05-08T20:06:45.143000-04:00</CityLastModifiedDate>
352 <CityRecordStatus>Active</CityRecordStatus>
353 <CityRecordStatusDate>2006-05-08T20:06:45.143000-04:00</CityRecordStatusDate>
354 <StateName>New York</StateName>
355 <StateGUID>9fd469e1-4d4a-4f38-9def-50038e5ecca2</StateGUID>
356 <StateCreatedDate>2006-04-22T16:09:35.830000-04:00</StateCreatedDate>
357 <StateLastModifiedDate>2006-04-22T16:09:35.830000-04:00</StateLastModifiedDate>
358 <StateRecordStatus>Active</StateRecordStatus>
359 <StateRecordStatusDate>2006-04-22T16:09:35.830000-04:00</StateRecordStatusDate>
360 <CountryName>United States</CountryName>
361 <CountryCode>USA</CountryCode>
362 <CountryGUID>532d35dd-3a49-408a-a416-20c41e9c7997</CountryGUID>
363 <CountryCreatedDate>2006-04-22T15:30:47.000000-04:00</CountryCreatedDate>
364 <CountryLastModifiedDate>2006-04-22T15:30:47.000000-04:00</CountryLastModifiedDate>
365 <CountryRecordStatus>Active</CountryRecordStatus>
366 <CountryRecordStatusDate>2006-04-22T15:30:47.000000-04:00</CountryRecordStatusDate>
367 <ZipPostalCode>12345</ZipPostalCode>
368 <GUID>b2414fa9-7375-4d26-8d76-89a6915d6751</GUID>
369 <CreatedDate>2006-06-13T01:29:09.030000-04:00</CreatedDate>
370 <LastModifiedDate>2006-07-29T23:45:17.670000-04:00</LastModifiedDate>
371 <RecordStatus>Active</RecordStatus>
372 <RecordStatusDate>2006-06-13T01:29:09.030000-04:00</RecordStatusDate>
373 <Type>Office</Type>
374 <TypeOtherSpecify/>
375 <InternalOffice></InternalOffice>
376 <MailStopCode/>
377 <PreferredFlag>Yes</PreferredFlag>
378 <ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
379 <QCDoneStatus>Yes</QCDoneStatus>
380 <QCDoneStatusDate>2006-06-13T01:29:09.030000-04:00</QCDoneStatusDate>
381 </Address>
382 </Addresses>
383 <ContactMechanisms>
384 <ContactMechanism>
385 <ContactType>Phone</ContactType>
386 <ContactTypeOtherSpecify xsi:nil="true"/>
387 <ContactValue>555-5555</ContactValue>
388 <ContactAreaCode>555</ContactAreaCode>
389 <ContactCountryCallingCode>1</ContactCountryCallingCode>
390 <ContactTollFreeFlag xsi:nil="true"/>
391 <ContactGUID>123</ContactGUID>
392 <ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
393 <ContactLastModifiedDate>2007-02-23T16:36:10.260000-05:00</ContactLastModifiedDate>
394 <ContactRecordStatus>Active</ContactRecordStatus>
395 <ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
396 <Role>Business</Role>
397 <PhoneExtension/>
398 <QCDoneStatus>Yes</QCDoneStatus>
399 <QCDoneStatusDate>2006-06-13T01:29:09.047000-04:00</QCDoneStatusDate>
400 <ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
401 <GUID>321</GUID>
402 <CreatedDate>2006-06-13T01:29:09.047000-04:00</CreatedDate>
403 <ModifiedDate>2006-07-29T23:53:03.323000-04:00</ModifiedDate>
404 <PreferredFlag>Yes</PreferredFlag>
405 <RecordStatus>Inactive</RecordStatus>
406 <RecordStatusDate>2006-07-29T23:53:03.393000-04:00</RecordStatusDate>
407 </ContactMechanism>
408 <ContactMechanism>
409 <ContactType>Email</ContactType>
410 <ContactTypeOtherSpecify xsi:nil="true"/>
411 <ContactValue>[email protected]</ContactValue>
412 <ContactAreaCode xsi:nil="true"/>
413 <ContactCountryCallingCode>0</ContactCountryCallingCode>
414 <ContactTollFreeFlag xsi:nil="true"/>
415 <ContactGUID>ddd</ContactGUID>
416 <ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
417 <ContactLastModifiedDate>2006-06-13T01:29:09.047000-04:00</ContactLastModifiedDate>
418 <ContactRecordStatus>Active</ContactRecordStatus>
419 <ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
420 <Role>Business</Role>
421 <PhoneExtension xsi:nil="true"/>
422 <QCDoneStatus>Yes</QCDoneStatus>
423 <QCDoneStatusDate>2006-06-13T01:29:09.063000-04:00</QCDoneStatusDate>
424 <ActiveFromDate>2006-06-13T01:29:09.063000-04:00</ActiveFromDate>
425 <GUID>111</GUID>
426 <CreatedDate>2006-06-13T01:29:09.063000-04:00</CreatedDate>
427 <ModifiedDate>2006-06-13T01:29:09.063000-04:00</ModifiedDate>
428 <PreferredFlag>Yes</PreferredFlag>
429 <RecordStatus>Active</RecordStatus>
430 <RecordStatusDate>2006-06-13T01:29:09.063000-04:00</RecordStatusDate>
431 </ContactMechanism>
432 </ContactMechanisms>
433 <Persons>
434 <Person>
435 <PersonID>100448</PersonID>
436 <Prefix/>
437 <FirstName>John</FirstName>
438 <MiddleName/>
439 <LastName>Doe</LastName>
440 <Suffix/>
441 <PreferredName/>
442 <Gender/>
443 <PrimaryLanguage xsi:nil="true"/>
444 <GUID>123</GUID>
445 <RecordStatus>Active</RecordStatus>
446 <RecordStatusDate>2007-04-29T00:11:50.750000-04:00</RecordStatusDate>
447 <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
448 <LastModifiedDate>2007-04-29T00:11:50.770000-04:00</LastModifiedDate>
449 <QCDoneStatus>Yes</QCDoneStatus>
450 <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
451 <PersonTypes>
452 <PersonType>
453 <Type>Resource Personnel</Type>
454 <GUID>3049ddcd-3590-4fd9-a534-e2cea5b82c09</GUID>
455 <RecordStatus>Active</RecordStatus>
456 <RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate>
457 <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
458 <LastModifiedDate>2007-04-29T00:11:50.817000-04:00</LastModifiedDate>
459 <QCDoneStatus>Yes</QCDoneStatus>
460 <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
461 </PersonType>
462 </PersonTypes>
463 </Person>
464 </Persons>
465 </Association>
466 </Associations>
467 </OrganizationType>
468 </OrganizationTypes>
469 <ImportedDate>2007-04-30</ImportedDate>
470 </OrganizationPersonAssoc>
471 ';
472 end;
473 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaURL => :schemaURL
5 ,schemaDoc => :xmlSchema
6 ,local => TRUE
7 ,genBean => false
8 ,genTypes => TRUE
9 ,genTables => TRUE
10 ,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
11 );
12 end;
13 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:03.67
SQL> insert into Person values ( xmltype (:xmltext1))
2 /
1 row created.
Elapsed: 00:00:00.07
SQL> insert into org_person_assoc values ( xmltype (:xmltext2))
2 /
1 row created.
Elapsed: 00:00:00.03
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.00
SQL> CREATE OR REPLACE VIEW XML_PERSON_ASSOCIATION
2 (PERSON)
3 AS
4 select
5 xmlelement("Person",
6 xmlforest(
7 extractvalue(value(p),'/Person/PersonID') "PersonID",
8 extractvalue(value(p),'/Person/Prefix') "Prefix",
9 extractvalue(value(p),'/Person/FirstName') "FirstName",
10 extractvalue(value(p),'/Person/MiddleName') "MiddleName",
11 extractvalue(value(p),'/Person/LastName') "LastName",
12 extractvalue(value(p),'/Person/Suffix') "Suffix",
13 extractvalue(value(p),'/Person/PreferredName') "PreferredName",
14 extractvalue(value(p),'/Person/Gender') "Gender",
15 extractvalue(value(p),'/Person/PrimaryLanguage') "PrimaryLanguage",
16 extractvalue(value(p),'/Person/RecordStatus') "RecordStatus",
17 extractvalue(value(p),'/Person/ImportedDate') "ImportedDate",
18 (select
19 xmlagg(
20 xmlelement("Association",
21 xmlforest(
22 extractvalue(value(oa),'/OrganizationPersonAssoc/Name') "Name",
23 extractvalue(value(ot),'/OrganizationType/OrganizationID') "OrganizationID",
24 extractvalue(value(ot),'/OrganizationType/Type') "OrganizationType",
25 extractvalue(value(a),'/Association/Role') "Role",
26 extractvalue(value(a),'/Association/RecordStatus') "RecordStatus",
27 extractvalue(value(oa),'/OrganizationPersonAssoc/ImportedDate') "ImportedDate"
28 ),
29 xmlelement("PersonTypes",
30 extract(value(per),'/Person/PersonTypes/PersonType')
31 ),
32 xmlelement("Addresses",
33 extract(value(a),'/Association/Addresses/Address')
34 ),
35 xmlelement("ContactMechanisms",
36 extract(value(a),'/Association/ContactMechanisms/ContactMechanism')
37 )
38 )
39 )
40 from org_person_assoc oa,
41 table(xmlsequence(extract(value(oa),'/OrganizationPersonAssoc/OrganizationTypes/OrganizationType'))) ot,
42 table(xmlsequence(extract(value(ot),'/OrganizationType/Associations/Association'))) a,
43 table(xmlsequence(extract(value(a),'/Association/Persons/Person'))) per
44 where extractvalue(value(per),'/Person/PersonID') = extractvalue(value(p),'/Person/PersonID')
45 ) "Associations"
46 )
47 ) person
48 from person p
49 /
View created.
Elapsed: 00:00:00.06
SQL> set autotrace on explain
SQL> --
SQL> set long 10000 pages 0 lines 150
SQL> --
SQL> select person
2 from xml_person_association o
3 where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1
4 /
<Person><PersonID>100448</PersonID><FirstName>John</FirstName><LastName>Doe</LastName><RecordStatus>Active</RecordStatus><ImportedDate>2007-04-30</Imp
ortedDate><Associations><Association><Name>Org Name Office</Name><OrganizationID>30097</OrganizationID><OrganizationType>Agency</OrganizationType><Rol
e>Employee</Role><RecordStatus>Active</RecordStatus><ImportedDate>2007-04-30</ImportedDate><PersonTypes><PersonType>
<Type>Resource Personnel</Type>
<GUID>3049ddcd-3590-4fd9-a534-e2cea5b82c09</GUID>
<RecordStatus>Active</RecordStatus>
<RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate>
<CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
<LastModifiedDate>2007-04-29T00:11:50.817000-04:00</LastModifiedDate>
<QCDoneStatus>Yes</QCDoneStatus>
<QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
</PersonType>
</PersonTypes><Addresses><Address>
<StreetName1>123 Front St.</StreetName1>
<StreetName2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<StreetName3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<StreetName4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<CityName>City</CityName>
<CityGUID>234234</CityGUID>
<CityCreatedDate>2006-05-08T20:06:45.143000-04:00</CityCreatedDate>
<CityLastModifiedDate>2006-05-08T20:06:45.143000-04:00</CityLastModifiedDate>
<CityRecordStatus>Active</CityRecordStatus>
<CityRecordStatusDate>2006-05-08T20:06:45.143000-04:00</CityRecordStatusDate>
<StateName>New York</StateName>
<StateGUID>9fd469e1-4d4a-4f38-9def-50038e5ecca2</StateGUID>
<StateCreatedDate>2006-04-22T16:09:35.830000-04:00</StateCreatedDate>
<StateLastModifiedDate>2006-04-22T16:09:35.830000-04:00</StateLastModifiedDate>
<StateRecordStatus>Active</StateRecordStatus>
<StateRecordStatusDate>2006-04-22T16:09:35.830000-04:00</StateRecordStatusDate>
<CountryName>United States</CountryName>
<CountryCode>USA</CountryCode>
<CountryGUID>532d35dd-3a49-408a-a416-20c41e9c7997</CountryGUID>
<CountryCreatedDate>2006-04-22T15:30:47.000000-04:00</CountryCreatedDate>
<CountryLastModifiedDate>2006-04-22T15:30:47.000000-04:00</CountryLastModifiedDate>
<CountryRecordStatus>Active</CountryRecordStatus>
<CountryRecordStatusDate>2006-04-22T15:30:47.000000-04:00</CountryRecordStatusDate>
<ZipPostalCode>12345</ZipPostalCode>
<GUID>b2414fa9-7375-4d26-8d76-89a6915d6751</GUID>
<CreatedDate>2006-06-13T01:29:09.030000-04:00</CreatedDate>
<LastModifiedDate>2006-07-29T23:45:17.670000-04:00</LastModifiedDate>
<RecordStatus>Active</RecordStatus>
<RecordStatusDate>2006-06-13T01:29:09.030000-04:00</RecordStatusDate>
<Type>Office</Type>
<TypeOtherSpecify/>
<InternalOffice/>
<MailStopCode/>
<PreferredFlag>Yes</PreferredFlag>
<ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
<QCDoneStatus>Yes</QCDoneStatus>
<QCDoneStatusDate>2006-06-13T01:29:09.030000-04:00</QCDoneStatusDate>
</Address>
</Addresses><ContactMechanisms><ContactMechanism>
<ContactType>Phone</ContactType>
<ContactTypeOtherSpecify xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ContactValue>555-5555</ContactValue>
<ContactAreaCode>555</ContactAreaCode>
<ContactCountryCallingCode>1</ContactCountryCallingCode>
<ContactTollFreeFlag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ContactGUID>123</ContactGUID>
<ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
<ContactLastModifiedDate>2007-02-23T16:36:10.260000-05:00</ContactLastModifiedDate>
<ContactRecordStatus>Active</ContactRecordStatus>
<ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
<Role>Business</Role>
<PhoneExtension/>
<QCDoneStatus>Yes</QCDoneStatus>
<QCDoneStatusDate>2006-06-13T01:29:09.047000-04:00</QCDoneStatusDate>
<ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
<GUID>321</GUID>
<CreatedDate>2006-06-13T01:29:09.047000-04:00</CreatedDate>
<ModifiedDate>2006-07-29T23:53:03.323000-04:00</ModifiedDate>
<PreferredFlag>Yes</PreferredFlag>
<RecordStatus>Inactive</RecordStatus>
<RecordStatusDate>2006-07-29T23:53:03.393000-04:00</RecordStatusDate>
</ContactMechanism>
<ContactMechanism>
<ContactType>Email</ContactType>
<ContactTypeOtherSpecify xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ContactValue>[email protected]</ContactValue>
<ContactAreaCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ContactCountryCallingCode>0</ContactCountryCallingCode>
<ContactTollFreeFlag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ContactGUID>ddd</ContactGUID>
<ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
<ContactLastModifiedDate>2006-06-13T01:29:09.047000-04:00</ContactLastModifiedDate>
<ContactRecordStatus>Active</ContactRecordStatus>
<ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
<Role>Business</Role>
<PhoneExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<QCDoneStatus>Yes</QCDoneStatus>
<QCDoneStatusDate>2006-06-13T01:29:09.063000-04:00</QCDoneStatusDate>
<ActiveFromDate>2006-06-13T01:29:09.063000-04:00</ActiveFromDate>
<GUID>111</GUID>
<CreatedDate>2006-06-13T01:29:09.063000-04:00</CreatedDate>
<ModifiedDate>2006-06-13T01:29:09.063000-04:00</ModifiedDate>
<PreferredFlag>Yes</PreferredFlag>
<RecordStatus>Active</RecordStatus>
<RecordStatusDate>2006-06-13T01:29:09.063000-04:00</RecordStatusDate>
</ContactMechanism>
</ContactMechanisms></Association></Associations></Person>
Elapsed: 00:00:00.42
Execution Plan
Plan hash value: 95656148
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 18040 | 9 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 10096 | | |
| 2 | TABLE ACCESS BY INDEX ROWID | SYS_NT32zHSpCZQ9ynComtqqKsrw== | 1 | 10096 | 2 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | SYS_C009300 | 1 | | 2 (0)| 00:00:01 |
| 4 | SORT AGGREGATE | | 1 | 48284 | | |
| 5 | TABLE ACCESS BY INDEX ROWID | SYS_NTjbkXqKq3S96fbEOM3Qs5Gg== | 1 | 48284 | 2 (0)| 00:00:01 |
|* 6 | INDEX RANGE SCAN | SYS_C009296 | 1 | | 2 (0)| 00:00:01 |
| 7 | SORT AGGREGATE | | 1 | 28187 | | |
| 8 | TABLE ACCESS BY INDEX ROWID| SYS_NTm2nBfKKNSGm6hs2e1Z0w/A== | 1 | 28187 | 2 (0)| 00:00:01 |
|* 9 | INDEX RANGE SCAN | SYS_C009297 | 1 | | 2 (0)| 00:00:01 |
| 10 | SORT AGGREGATE | | 1 | 13910 | | |
| 11 | NESTED LOOPS | | 1 | 13910 | 6 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 1 | 8131 | 5 (0)| 00:00:01 |
| 13 | NESTED LOOPS | | 1 | 4097 | 4 (0)| 00:00:01 |
|* 14 | TABLE ACCESS FULL | SYS_NT7Erd/G5iSPWX9w20Z5cNRg== | 1 | 43 | 3 (0)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID | SYS_NTQWY/m3uES5GM7AByRclr8A== | 1 | 4054 | 1 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | SYS_C009310 | 1 | | 0 (0)| 00:00:01 |
|* 17 | TABLE ACCESS BY INDEX ROWID | SYS_NTTiDHMvB7RbSEfNxho66yQg== | 1 | 4034 | 1 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | SYS_C009314 | 1 | | 0 (0)| 00:00:01 |
| 19 | TABLE ACCESS BY INDEX ROWID | ORG_PERSON_ASSOC | 1 | 5779 | 1 (0)| 00:00:01 |
|* 20 | INDEX UNIQUE SCAN | SYS_C009320 | 1 | | 0 (0)| 00:00:01 |
|* 21 | FILTER | | | | | |
| 22 | TABLE ACCESS FULL | PERSON | 1 | 18040 | 3 (0)| 00:00:01 |
| 23 | NESTED LOOPS | | | | | |
| 24 | NESTED LOOPS | | 1 | 5893 | 6 (0)| 00:00:01 |
| 25 | NESTED LOOPS | | 1 | 2125 | 5 (0)| 00:00:01 |
| 26 | NESTED LOOPS | | 1 | 93 | 4 (0)| 00:00:01 |
|* 27 | TABLE ACCESS FULL | SYS_NT7Erd/G5iSPWX9w20Z5cNRg== | 1 | 43 | 3 (0)| 00:00:01 |
|* 28 | TABLE ACCESS BY INDEX ROWID| SYS_NTQWY/m3uES5GM7AByRclr8A== | 1 | 50 | 1 (0)| 00:00:01 |
|* 29 | INDEX UNIQUE SCAN | SYS_C009310 | 1 | | 0 (0)| 00:00:01 |
|* 30 | TABLE ACCESS BY INDEX ROWID | SYS_NTTiDHMvB7RbSEfNxho66yQg== | 1 | 2032 | 1 (0)| 00:00:01 |
|* 31 | INDEX UNIQUE SCAN | SYS_C009314 | 1 | | 0 (0)| 00:00:01 |
|* 32 | INDEX UNIQUE SCAN | SYS_C009320 | 1 | | 0 (0)| 00:00:01 |
| 33 | TABLE ACCESS BY INDEX ROWID | ORG_PERSON_ASSOC | 1 | 3768 | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - access("NESTED_TABLE_ID"=:B1)
6 - access("NESTED_TABLE_ID"=:B1)
9 - access("NESTED_TABLE_ID"=:B1)
14 - filter("SYS_NC_TYPEID$" IS NOT NULL AND "PersonID"=:B1)
15 - filter("SYS_NC_TYPEID$" IS NOT NULL)
16 - access("NESTED_TABLE_ID"="SYS_ALIAS_1"."SYS_NC0002700028$")
17 - filter("SYS_NC_TYPEID$" IS NOT NULL)
18 - access("NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0003700038$")
20 - access("NESTED_TABLE_ID"="OA"."SYS_NC0002100022$")
21 - filter( EXISTS (SELECT 0 FROM "XDBTEST"."SYS_NT7Erd/G5iSPWX9w20Z5cNRg=="
"SYS_ALIAS_1","XDBTEST"."SYS_NTQWY/m3uES5GM7AByRclr8A=="
"SYS_ALIAS_3","XDBTEST"."SYS_NTTiDHMvB7RbSEfNxho66yQg==" "SYS_ALIAS_0","XDBTEST"."ORG_PERSON_ASSOC" "OA"
WHERE "SYS_ALIAS_0"."NESTED_TABLE_ID"="OA"."SYS_NC0002100022$" AND
"SYS_ALIAS_1"."NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0003700038$" AND "SYS_ALIAS_0"."SYS_NC_TYPEID$" IS
NOT NULL AND TO_NUMBER("SYS_ALIAS_0"."OrganizationID")=30097 AND
"SYS_ALIAS_4"."NESTED_TABLE_ID"="SYS_ALIAS_1"."SYS_NC0002700028$" AND "SYS_ALIAS_1"."SYS_NC_TYPEID$" IS
NOT NULL AND "SYS_ALIAS_4"."SYS_NC_TYPEID$" IS NOT NULL AND "SYS_ALIAS_4"."PersonID"=:B1))
27 - filter("SYS_ALIAS_4"."SYS_NC_TYPEID$" IS NOT NULL AND "SYS_ALIAS_4"."PersonID"=:B1)
28 - filter("SYS_ALIAS_1"."SYS_NC_TYPEID$" IS NOT NULL)
29 - access("SYS_ALIAS_4"."NESTED_TABLE_ID"="SYS_ALIAS_1"."SYS_NC0002700028$")
30 - filter("SYS_ALIAS_0"."SYS_NC_TYPEID$" IS NOT NULL AND
TO_NUMBER("SYS_ALIAS_0"."OrganizationID")=30097)
31 - access("SYS_ALIAS_1"."NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0003700038$")
32 - access("SYS_ALIAS_0"."NESTED_TABLE_ID"="OA"."SYS_NC0002100022$")
Note
- dynamic sampling used for this statement
SQL> select extract(person,'/Person/Associations/Association')
2 from xml_person_association o
3 where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1
4 /
<Association><Name>Org Name Office</Name><OrganizationID>30097</OrganizationID><OrganizationType>Agency</OrganizationType><Role>Employee</Role><Record
Status>Active</RecordStatus><ImportedDate>2007-04-30</ImportedDate><PersonTypes><PersonType><Type>Resource Personnel</Type><GUID>3049ddcd-3590-4fd9-a5
34-e2cea5b82c09</GUID><RecordStatus>Active</RecordStatus><RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate><CreatedDate>2006-06-13T
00: -
Problem using SmartCard with 2 Certificates stored and SunPKCS11
Hi,
I'm trying to access one SmartCard token in Java 1.5 using SunPKCS11 provider for crypt, decrypt and digital signature operations.
I have 2 certificates stored on Token:
- CertA;
- CertB.
There are also 2 PIN:
- PIN1;
- PIN2.
I use:
- PIN1 for logging into the token;
- PIN1 for operation involving CertA;
- PIN2 for operation involving CertB;
There is no problem to logging into the token using Java and, without any troubles, I can read certificates and key from the
cryptographic card.
There is no problem using CertA for all my operation, but every attempt of using Private Key of CertB (for the same operations) returns with an Exception:
java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DEVICE_ERROR
Here there's an extract of my source code.
public void loginToken() {
Provider UserProvider = new sun.security.pkcs11.SunPKCS11(C:\\pkcs11.cfg);
Security.addProvider(UserProvider);
try {
KeyStore ks = null;
X509Certificate UserCert = null;
PrivateKey UserCertPrivKey = null;
PublicKey UserCertPubKey = null;
//PIN
char PIN1[] = "11111".toCharArray();
char PIN2[] = "22222".toCharArray();
//logging into token
ks = KeyStore.getInstance("PKCS11", UserProvider);
ks.load(null, PIN1);
//enumeration alias
String alias = "";
Enumeration e = ks.aliases();
while (e.hasMoreElements()) {
alias = (String) e.nextElement();
//Certificate
UserCert = (X509Certificate) ks.getCertificate(alias);
//PublicKey
UserCertPubKey = (PublicKey) ks.getCertificate(alias).getPublicKey();
if (alias.compareToIgnoreCase("Cert1") == 0) {
//PrivateKey reference
UserCertPrivKey = (PrivateKey) ks.getKey(alias, PIN1);
} else if (alias.compareToIgnoreCase("Cert2") == 0) {
//PrivateKey reference
UserCertPrivKey = (PrivateKey) ks.getKey(alias, PIN2);
} else {
System.out.println("ALIAS UNKNOW");
System.exit(1);
//Signature Test
if (!MakeSignature(UserCertPrivKey, UserProvider))
System.out.println(" *** SIGNATURE OK *** ");
else
System.out.println(" *** SIGNATURE KO *** ");
catch (Exception ex) {
System.out.println("ERROR: " + ex);
public boolean MakeSign(PrivateKey PrivKey, Provider p) {
try {
//File I/O
FileInputStream txtfis = new FileInputStream("C:\\Test.txt");
FileOutputStream sigfos = new FileOutputStream("C:\\Test_Signature.txt");
//Signature Obj init
Signature dsa = Signature.getInstance("SHA1withRSA", p.getName());
dsa.initSign(PrivKey);
//Update data
BufferedInputStream bufin = new BufferedInputStream(txtfis);
byte[] buffer = new byte[1024];
int len;
while (bufin.available() != 0) {
len = bufin.read(buffer);
dsa.update(buffer, 0, len);
bufin.close();
//Make signature
byte[] realSig = dsa.sign();
//save signature on file
sigfos.write(realSig);
sigfos.close();
return true;
catch (Exception ex) {
System.out.println("ERROR: " + ex);
return false;
Any help would be grateful...
Thanks in advance.
P.S. Sorry for my EnglishThis is the same my initial problem.
I resolved it using IAIK-PKCS#11Wrapper (it is FREE) insted of sun.security.pkcs11.SunPKCS11.
You can find it here:
http://jce.iaik.tugraz.at/sic/products/core_crypto_toolkits/pkcs_11_wrapper
Here an exemple of code.
The main class:
import iaik.pkcs.pkcs11.Module;
import iaik.pkcs.pkcs11.DefaultInitializeArgs;
import java.util.Hashtable;
import iaik.pkcs.pkcs11.Token;
import iaik.pkcs.pkcs11.Slot;
import iaik.pkcs.pkcs11.Session;
import iaik.pkcs.pkcs11.objects.RSAPrivateKey;
import java.util.Vector;
import iaik.pkcs.pkcs11.objects.PrivateKey;
import iaik.pkcs.pkcs11.objects.X509PublicKeyCertificate;
import java.util.Enumeration;
import iaik.pkcs.pkcs11.objects.Key;
import java.security.cert.CertificateFactory;
import java.io.ByteArrayInputStream;
import iaik.pkcs.pkcs11.Mechanism;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.io.File;
import java.io.FileInputStream;
import org.bouncycastle.cms.CMSSignedDataGenerator;
import org.bouncycastle.cms.CMSProcessableByteArray;
import java.util.ArrayList;
import java.security.cert.CertStore;
import java.security.cert.CollectionCertStoreParameters;
import org.bouncycastle.cms.CMSSignedData;
import java.io.FileOutputStream;
import java.security.cert.X509Certificate;
import iaik.pkcs.pkcs11.TokenInfo;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
public class MakeSignature {
public static void main(String[] args) {
String USER_PIN = "12345678";
String DLL_NAME = "C:\\windows\\system32\\dll_P11_name.dll";
String OBJ_LABEL1 = "CNS0"; //this is the label of my 1th cert
String OBJ_LABEL2 = "CNS1"; //this is the label of my 2th cert
String INPUT_FILE = "C:\\Temp\\test.txt";
String OUTPUT_FILE = "C:\\Temp\\test.p7m";
try {
// ********** INITIALIZE PKCS#11 MODULE WITH DEFAULT PARAMETERS **********
Module pkcs11Module = Module.getInstance(DLL_NAME);
pkcs11Module.initialize(new DefaultInitializeArgs());
// ********** SELECT TOKEN **********
Slot[] slotsWithToken = pkcs11Module.getSlotList(Module.SlotRequirement.TOKEN_PRESENT);
Token[] tokens = new Token[slotsWithToken.length];
Hashtable tokenIDtoToken = new Hashtable(tokens.length);
long tokenID = -1;
Token tokenUsed = null;
//enum readers
for (int i = 0; i < slotsWithToken.length; i++) {
tokens[i] = slotsWithToken.getToken();
tokenID = tokens[i].getTokenID();
tokenIDtoToken.put(new Long(tokenID), tokens[i]);
System.out.println("Active tokens:");
System.out.println("Token ID: " + tokenID);
if (tokens.length == 0) { //No SC found
System.out.println("No SC presents");
else {
System.out.println("Using token: " + tokens[0].getTokenID());
tokenUsed = tokens[0];
//Note: if you have more reader and more SC inserted, you have to write
//here the code for select the right token
// ********** OPEN SESSION VS THE TOKEN AND IF REQUIRED SUBMIT PIN **********
TokenInfo tokenInfo = tokenUsed.getTokenInfo();
Session session = tokenUsed.openSession(Token.SessionType.SERIAL_SESSION, false, null, null);
if (tokenInfo.isLoginRequired()) {
session.login(Session.UserType.USER, USER_PIN.toCharArray());
// ********** SET SEARCH TEMPLATE FOR THE P11 OBJECT **********
RSAPrivateKey privateSignatureKeyTemplate = new RSAPrivateKey();
privateSignatureKeyTemplate.getSign().setBooleanValue(Boolean.TRUE);
privateSignatureKeyTemplate.getLabel().setCharArrayValue(OBJ_LABEL2.toCharArray());
// ********** SEARCH P11 OBJECT USING TEMPLATE **********
Vector keyList = new Vector(4);
session.findObjectsInit(privateSignatureKeyTemplate);
Object[] matchingKeys;
while ( (matchingKeys = session.findObjects(1)).length > 0) {
keyList.addElement(matchingKeys[0]);
session.findObjectsFinal();
//Try to find the corresponding certificates for the signature keys
Hashtable keyToCertificateTable = new Hashtable(4);
Enumeration keyListEnumeration = keyList.elements();
while (keyListEnumeration.hasMoreElements()) {
PrivateKey signatureKey = (PrivateKey) keyListEnumeration.nextElement();
byte[] keyID = signatureKey.getId().getByteArrayValue();
X509PublicKeyCertificate certificateTemplate = new X509PublicKeyCertificate();
certificateTemplate.getId().setByteArrayValue(keyID);
session.findObjectsInit(certificateTemplate);
Object[] correspondingCertificates = session.findObjects(1);
if (correspondingCertificates.length > 0) {
keyToCertificateTable.put(signatureKey, correspondingCertificates[0]);
session.findObjectsFinal();
//There are three cases now: 1 no obj found; 2 found only one obj, 3 found more obj
Key selectedKey = null;
X509PublicKeyCertificate correspondingCertificate = null;
//no object found for template
if (keyList.size() == 0) {
System.out.println("No object found for template");
throw new Exception("No object found for template");
//Founf only one object
else if (keyList.size() == 1) {
selectedKey = (Key) keyList.elementAt(0);
// create a IAIK JCE certificate from the PKCS11 certificate
correspondingCertificate = (X509PublicKeyCertificate)keyToCertificateTable.get(selectedKey);
System.out.println("One object Found");
//Found more object ... user can select one
else {
System.out.println("Many obj found!!!");
//write here the code for select the right object
// ********** GET THE OBJECT **********
RSAPrivateKey signerPriKey = (RSAPrivateKey) selectedKey;
java.security.cert.CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
byte[] derEncodedCertificate = correspondingCertificate.getValue().getByteArrayValue();
//Cast to java.security.cert.X509Certificate
java.security.cert.X509Certificate signerCert = (java.security.cert.X509Certificate) certificateFactory.
generateCertificate(new ByteArrayInputStream(derEncodedCertificate));
// ********** SIGNATURE OPERATION **********
//Add BouncyCastle as provider
Security.addProvider(new BouncyCastleProvider());
//initialize signature operation
session.signInit(Mechanism.RSA_PKCS, (PrivateKey) signerPriKey);
//get input data
File src = new File(INPUT_FILE);
int sizecontent = ( (int) src.length());
byte[] contentData = new byte[sizecontent];
FileInputStream freader = new FileInputStream(src);
freader.read(contentData, 0, sizecontent);
freader.close();
//calculate digest of the input data
byte[] toEncrypt = buildBits(contentData); //I've already posted the code for this function
//make signature
byte[] signature = session.sign(toEncrypt);
// ********** MAKE P7 WELL FORMAT DOCUMENT **********
//CMSSignedDataGenerator fact = new CMSSignedDataGenerator();
Signature2CMSSignedData fact = new Signature2CMSSignedData();
CMSProcessableByteArray content = new CMSProcessableByteArray(contentData);
//Creation of BC CertStore
ArrayList certList = new ArrayList();
certList.add(signerCert);
CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), "BC");
//Signature Alg
String algorithm = CMSSignedDataGenerator.DIGEST_SHA1;
//add element to P7
fact.addSignature(signature, signerCert, algorithm);
fact.addCertificatesAndCRLs(certs);
//generate enveloped using Bouncycastle provider
CMSSignedData envdata = fact.generate(PKCSObjectIdentifiers.data.getId(), content, true);
byte[] enveloped = envdata.getEncoded();
//Write P7 file
FileOutputStream efos = new FileOutputStream(OUTPUT_FILE);
efos.write(enveloped);
efos.close();
// ********** END **********
session.closeSession();
pkcs11Module.finalize(null);
catch (Exception ex) {
ex.printStackTrace();
}Main class uses buildBits function (already posted in this topic) and Signature2CMSSignedData class.import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.security.cert.CertStore;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1Set;
import org.bouncycastle.asn1.BERConstructedOctetString;
import org.bouncycastle.asn1.DEREncodable;
import org.bouncycastle.asn1.DERNull;
import org.bouncycastle.asn1.DERObject;
import org.bouncycastle.asn1.DERObjectIdentifier;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.cms.ContentInfo;
import org.bouncycastle.asn1.cms.IssuerAndSerialNumber;
import org.bouncycastle.asn1.cms.SignedData;
import org.bouncycastle.asn1.cms.SignerIdentifier;
import org.bouncycastle.asn1.cms.SignerInfo;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.CertificateList;
import org.bouncycastle.asn1.x509.TBSCertificateStructure;
import org.bouncycastle.asn1.x509.X509CertificateStructure;
import org.bouncycastle.cms.CMSProcessable;
import org.bouncycastle.cms.CMSSignedData;
* class for generating a RSA pkcs7-signature message.
public class Signature2CMSSignedData2 {
CertStore certStore;
List certs = new ArrayList();
List crls = new ArrayList();
List signerInfs = new ArrayList();
List signers = new ArrayList();
public static final String DATA = PKCSObjectIdentifiers.data.getId();
public static final String ENCRYPTION_RSA = "1.2.840.113549.1.1.1";
private byte[] signatureData = null;
private X509Certificate cert = null;
private String digestOID = null;
private String encOID = null;
public Signature2CMSSignedData2() {
public void addSignature(byte[] signatureData, X509Certificate cert, String digestOID) {
this.signatureData = signatureData;
this.cert = cert;
this.digestOID = digestOID;
this.encOID = ENCRYPTION_RSA;
public void addCertificatesAndCRLs(CertStore certStore) throws Exception{
try {
Iterator it = certStore.getCertificates(null).iterator();
while (it.hasNext()) {
X509Certificate c = (X509Certificate) it.next();
certs.add(new X509CertificateStructure((ASN1Sequence) makeObj(c.getEncoded())));
Iterator it2 = certStore.getCRLs(null).iterator();
while (it2.hasNext()) {
X509CRL c = (X509CRL) it2.next();
crls.add(new CertificateList((ASN1Sequence) makeObj(c.getEncoded())));
catch (Exception e) {
throw new Exception(e.getMessage());
private DERObject makeObj(byte[] encoding) throws Exception {
if (encoding == null) {
return null;
ByteArrayInputStream bIn = new ByteArrayInputStream(encoding);
ASN1InputStream aIn = new ASN1InputStream(bIn);
return aIn.readObject();
public CMSSignedData generate(String signedContentType, CMSProcessable content, boolean encapsulate) throws Exception {
try {
ASN1EncodableVector digestAlgs = new ASN1EncodableVector();
ASN1EncodableVector signerInfos = new ASN1EncodableVector();
DERObjectIdentifier contentTypeOID = new DERObjectIdentifier(signedContentType);
// add the SignerInfo objects
Iterator it = signerInfs.iterator();
AlgorithmIdentifier digAlgId = new AlgorithmIdentifier(new DERObjectIdentifier(digestOID), new DERNull());
AlgorithmIdentifier encAlgId;
encAlgId = new AlgorithmIdentifier(new DERObjectIdentifier(encOID), new DERNull());
digestAlgs.add(digAlgId);
ASN1Set signedAttr = null;
ASN1Set unsignedAttr = null;
ASN1OctetString encDigest = new DEROctetString(signatureData);
ByteArrayInputStream bIn = new ByteArrayInputStream(cert.getTBSCertificate());
ASN1InputStream aIn = new ASN1InputStream(bIn);
TBSCertificateStructure tbs = TBSCertificateStructure.getInstance(aIn.readObject());
IssuerAndSerialNumber encSid = new IssuerAndSerialNumber(tbs.getIssuer(), tbs.getSerialNumber().getValue());
signerInfos.add(new SignerInfo(new SignerIdentifier(encSid), digAlgId, signedAttr, encAlgId, encDigest, unsignedAttr));
ASN1Set certificates = null;
if (certs.size() != 0) {
ASN1EncodableVector v = new ASN1EncodableVector();
it = certs.iterator();
while (it.hasNext()) {
v.add( (DEREncodable) it.next());
certificates = new DERSet(v);
ASN1Set certrevlist = null;
if (crls.size() != 0) {
ASN1EncodableVector v = new ASN1EncodableVector();
it = crls.iterator();
while (it.hasNext()) {
v.add( (DEREncodable) it.next());
certrevlist = new DERSet(v);
ContentInfo encInfo;
if (encapsulate) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
content.write(bOut);
ASN1OctetString octs = new BERConstructedOctetString(bOut.toByteArray());
encInfo = new ContentInfo(contentTypeOID, octs);
else {
encInfo = new ContentInfo(contentTypeOID, null);
SignedData sd = new SignedData(new DERSet(digestAlgs), encInfo, certificates, certrevlist, new DERSet(signerInfos));
ContentInfo contentInfo = new ContentInfo(PKCSObjectIdentifiers.signedData, sd);
return new CMSSignedData(content, contentInfo);
catch (Exception e) {
throw new Exception(e.getMessage());
}Bye. -
Query
SELECT case.case_objid FROM [email protected] case, table_x_cwp_tickect_details_vw t WHERE CASE.case_condition_cd IN ('OPEN', 'OPEN-DISPATCH', 'OPEN-REJECT', 'OPEN-RETURNED') AND case.case_type_cd in ('CUSTOMER FAULT', 'CHRONIC','SCHEDULED ACTIVITY','PROBLEM') AND ROWNUM <= 500 AND case.case_objid = t.ticket_objid AND ( ( case.account_id = '672286' ) ) ORDER BY case.case_id DESC
From PROD
Plan
SELECT STATEMENT HINT: FIRST_ROWS Cost: 2,629 Bytes: 221,500 Cardinality: 500
37 SORT ORDER BY Cost: 2,629 Bytes: 221,500 Cardinality: 500
36 COUNT STOPKEY
35 NESTED LOOPS OUTER Cost: 2,628 Bytes: 279,533 Cardinality: 631
33 HASH JOIN OUTER Cost: 2,627 Bytes: 275,116 Cardinality: 631
31 NESTED LOOPS OUTER Cost: 2,249 Bytes: 266,282 Cardinality: 631
28 NESTED LOOPS Cost: 1,766 Bytes: 257,448 Cardinality: 631
26 NESTED LOOPS Cost: 1,765 Bytes: 253,031 Cardinality: 631
24 NESTED LOOPS Cost: 1,764 Bytes: 248,614 Cardinality: 631
22 NESTED LOOPS Cost: 1,763 Bytes: 244,197 Cardinality: 631
19 NESTED LOOPS Cost: 1,258 Bytes: 235,363 Cardinality: 631
17 NESTED LOOPS Cost: 1,257 Bytes: 230,946 Cardinality: 631
14 NESTED LOOPS OUTER Cost: 752 Bytes: 217,695 Cardinality: 631
12 HASH JOIN Cost: 751 Bytes: 213,278 Cardinality: 631
1 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
11 HASH JOIN Cost: 748 Bytes: 208,861 Cardinality: 631
2 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
10 HASH JOIN Cost: 746 Bytes: 204,444 Cardinality: 631
3 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
9 HASH JOIN Cost: 743 Bytes: 200,027 Cardinality: 631
4 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
8 NESTED LOOPS Cost: 741 Bytes: 195,610 Cardinality: 631
5 REMOTE REMOTE CASE Cost: 235 Bytes: 156,488 Cardinality: 631
7 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_CASE Cost: 1 Bytes: 62 Cardinality: 1
6 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.TC_C_CASE_OBJINDEX Cost: 1 Cardinality: 1
13 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.UN_PTT2CASE Cost: 1 Bytes: 7 Cardinality: 1
16 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_SITE Cost: 1 Bytes: 21 Cardinality: 1
15 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_OBJINDEX Cost: 1 Cardinality: 1
18 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.BUS_ORG_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
21 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_ADDRESS Cost: 1 Bytes: 14 Cardinality: 1
20 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.ADDRESS_OBJINDEX Cost: 1 Cardinality: 1
23 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.COUNTRY_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
25 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONTACT_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
27 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONDITION_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
30 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE SA.TABLE_SITE_PART Cost: 1 Bytes: 14 Cardinality: 1 Partition #: 34
29 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_PART_OBJINDEX Cost: 1 Cardinality: 1
bold 32 TABLE ACCESS FULL TABLE SA.TABLE_MOD_LEVEL Cost: 376 Bytes: 1,442,084 Cardinality: 103,006 bold
34 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.PART_NUM_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
From DEV platform
Plan
SELECT STATEMENT HINT: FIRST_ROWS Cost: 591 Bytes: 61,134 Cardinality: 138
37 SORT ORDER BY Cost: 591 Bytes: 61,134 Cardinality: 138
36 COUNT STOPKEY
35 HASH JOIN Cost: 590 Bytes: 61,134 Cardinality: 138
1 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
34 HASH JOIN Cost: 588 Bytes: 60,168 Cardinality: 138
2 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
33 HASH JOIN Cost: 585 Bytes: 59,202 Cardinality: 138
3 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
32 HASH JOIN Cost: 583 Bytes: 58,236 Cardinality: 138
4 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
31 NESTED LOOPS OUTER Cost: 580 Bytes: 57,270 Cardinality: 138
29 NESTED LOOPS OUTER Cost: 579 Bytes: 56,304 Cardinality: 138
27 NESTED LOOPS OUTER Cost: 469 Bytes: 54,372 Cardinality: 138
24 NESTED LOOPS Cost: 363 Bytes: 52,440 Cardinality: 138
22 NESTED LOOPS Cost: 362 Bytes: 51,474 Cardinality: 138
20 NESTED LOOPS Cost: 361 Bytes: 50,508 Cardinality: 138
18 NESTED LOOPS Cost: 360 Bytes: 49,542 Cardinality: 138
15 NESTED LOOPS Cost: 249 Bytes: 47,610 Cardinality: 138
13 NESTED LOOPS Cost: 248 Bytes: 46,644 Cardinality: 138
10 NESTED LOOPS OUTER Cost: 138 Bytes: 43,746 Cardinality: 138
8 NESTED LOOPS Cost: 137 Bytes: 42,780 Cardinality: 138
5 REMOTE REMOTE CASE Cost: 26 Bytes: 34,224 Cardinality: 138
7 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_CASE Cost: 1 Bytes: 62 Cardinality: 1
6 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.TC_C_CASE_OBJINDEX Cost: 1 Cardinality: 1
9 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.UN_PTT2CASE Cost: 1 Bytes: 7 Cardinality: 1
12 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_SITE Cost: 1 Bytes: 21 Cardinality: 1
11 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_OBJINDEX Cost: 1 Cardinality: 1
14 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.BUS_ORG_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
17 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_ADDRESS Cost: 1 Bytes: 14 Cardinality: 1
16 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.ADDRESS_OBJINDEX Cost: 1 Cardinality: 1
19 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.COUNTRY_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
21 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONTACT_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
23 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONDITION_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
26 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE SA.TABLE_SITE_PART Cost: 1 Bytes: 14 Cardinality: 1 Partition #: 34
25 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_PART_OBJINDEX Cost: 1 Cardinality: 1
bold 28 INDEX RANGE SCAN INDEX SA.IND_PART_INFO2PART_NUM Cost: 1 Bytes: 14 Cardinality: 1 bold
30 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.PART_NUM_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
Conclusion:
IND_PART_INFO2PART_NUM is not in use in Production environment
PROD
1. SQL> select index_name,NUM_ROWS,CLUSTERING_FACTOR from dba_indexes where index_name='IND_PART_INFO2PART_NUM';
INDEX_NAME NUM_ROWS CLUSTERING_FACTOR
IND_PART_INFO2PART_NUM 103023 46488
DEV environment
SQL> select index_name,NUM_ROWS,CLUSTERING_FACTOR,table_name from dba_indexes where index_name='IND_PART_INFO2PART_NUM';
INDEX_NAME NUM_ROWS CLUSTERING_FACTOR TABLE_NAME
IND_PART_INFO2PART_NUM 101982 45722 TABLE_MOD_LEVEL
1. Index is rebuild
2. stats are up to date
3. Redef on table is done.
Still no change in the plan .Osama-mustafa wrote:
Aman.... wrote:
Osama-mustafa wrote:
alter index <index-name> rebuild ;Why?
Aman....I faced this issue with query and indexes was need rebuildWhat issue Osama-that query wasn't using index and after rebuild it did start using it? Not just that this reply is wrong , this is OP has mentioned that he has done already. Please note that index rebuild is not the answer when the query is not using the index. There can be many reasons behind it. Have a look at Richard Foote's blog where he explains all of this in a very detailed way and in many posts.
Aman.... -
Why my query not using any index but doing a FULL TABLE SCAN
Hi,
My EXPLAIN PLAN output is
Plan hash value: 1163866984
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 774 | 159K| | 40847 (2)| 00:08:11 |
|* 1 | FILTER | | | | | | |
| 2 | SORT GROUP BY | | 774 | 159K| | 40847 (2)| 00:08:11 |
|* 3 | HASH JOIN | | 77337 | 15M| 9744K| 40843 (2)| 00:08:11 |
|* 4 | HASH JOIN | | 77337 | 8836K| 5896K| 20987 (2)| 00:04:12 |
|* 5 | HASH JOIN | | 77337 | 4984K| | 9292 (3)| 00:01:52 |
|* 6 | HASH JOIN | | 24991 | 951K| | 3349 (3)| 00:00:41 |
|* 7 | TABLE ACCESS FULL| IDS_TXNIDNUMBERS | 24991 | 683K| | 2328 (3)| 00:00:28 |
| 8 | TABLE ACCESS FULL| IDS_TXNDEMDATAMAP | 2419K| 25M| | 1006 (3)| 00:00:13 |
| 9 | TABLE ACCESS FULL | IDS_IDNUMBERS | 7435K| 191M| | 5903 (2)| 00:01:11 |
| 10 | TABLE ACCESS FULL | IDS_DEMDATA | 2583K| 125M| | 3683 (5)| 00:00:45 |
| 11 | TABLE ACCESS FULL | IDS_TXN | 2583K| 231M| | 6403 (1)| 00:01:17 |
----------------------------------------------------------------------------------------------------- All my 5 tables IDS_TXNIDNUMBERS, IDS_TXNDEMDATAMAP, IDS_IDNUMBERS,IDS_DEMDATA, IDS_TXN has indexes in relevant columns. Is it cause less time so CBO is not using the indexes.
Thanks
Amitava.amitavachatterjee1975 wrote:
Please be polite when responding to my queries. If you find these questions not to your standard, stay away from them. This is an open forum and I have got my full rights to ask questions.Unsure, what wrong did you find in SB's reply. I find those links perfectly knowledgeable. The question of having so many unanswered questions probably pricked you a little too much. But that, IMO, is a legitimate question, to be asked to a User who even after being associated with OTN for over an year has 100% record of not getting an answer.
For your original question, you will have to provide more details to allow people to answer you.
You must read {message:id=3292438} and post the mentioned details. People do not carry a Crystal Ball to identify the problem merely by reading few lines of Problem description and Explain plans. Do not make people guess, provide appropriate details, to help them Help "You". -
Use of Index although a great number of rows is returned....
Hi ,
I have created the following table:
create table all_obj select * from all_objects;
Then i created some indexes:
create index idx_obj on all_obj (object_name)
create index idx_owner on all_obj (owner)
Then i issued the sql statement:
SQL> select count(object_name),owner from all_obj group by owner;
COUNT(OBJECT_NAME) OWNER
719 MDSYS
266 SCOTT_BI
266 INFO_BI
2 TSMSYS
118 DMSYS
20146 PUBLIC
6 OUTLN
171 CTXSYS
612 OLAPSYS
400 SYSTEM
168 EXFSYS
43 SCOTT
32 DBSNMP
1638 ORDSYS
5 ORDPLUGINS
866 SYSMAN
284 XDB
20993 SYS
264 INFORMATICS
212 WMSYS
COUNT(OBJECT_NAME) OWNER
8 SI_INFORMTN_SCHEMA
21 rows selectedand...:
SQL> analyze table all_obj compute statistics;
Table analyzedAt last , i issued the following pair of sql statements:
SQL> select object_name,owner from scott.all_obj where owner='SCOTT'
2 /
43 ãñáììÝò åðéëÝ÷èçêáí.
Ðñüãñáììá åêôÝëåóçò
Plan hash value: 2272571446
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| T
ime |
| 0 | SELECT STATEMENT | | 2249 | 65221 | 68 (0)| 0
0:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| ALL_OBJ | 2249 | 65221 | 68 (0)| 0
0:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_OWNER | 2249 | | 6 (0)| 0
0:00:01 |
Predicate Information (identified by operation id):
2 - access("OWNER"='SCOTT')
ÓôáôéóôéêÜ
0 recursive calls
0 db block gets
12 consistent gets
0 physical reads
0 redo size
1692 bytes sent via SQL*Net to client
407 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
43 rows processedand
SQL> select object_name,owner from scott.all_obj where owner='SYS';
20993 ãñáììÝò åðéëÝ÷èçêáí.
Ðñüãñáììá åêôÝëåóçò
Plan hash value: 2272571446
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| T
ime |
| 0 | SELECT STATEMENT | | 2249 | 65221 | 68 (0)| 0
0:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| ALL_OBJ | 2249 | 65221 | 68 (0)| 0
0:00:01 |
|* 2 | INDEX RANGE SCAN | IDX_OWNER | 2249 | | 6 (0)| 0
0:00:01 |
Predicate Information (identified by operation id):
2 - access("OWNER"='SYS')
ÓôáôéóôéêÜ
0 recursive calls
0 db block gets
3345 consistent gets
0 physical reads
0 redo size
801069 bytes sent via SQL*Net to client
15774 bytes received via SQL*Net from client
1401 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
20993 rows processed
The question is: why the second query uses the index since a great number of records is returned......????
I use Oracle10g.v.2
Thanks...
SimYou were right.....
using:
SQL> EXEC DBMS_STATS.gather_schema_stats(ownname => 'SCOTT');
the optimizer does follow the 'waited' access path....for the 'PUBLIC' records.....
It seems that using the analyze table statement does not permit to gather all the necessary statistics.....(that's why it is depreciated)...!!!!
Thanks.....
Sim
Maybe you are looking for
-
Balance report and document types
Hi: Just one simple question. I am not a FI, but I need to get Balance report, but I need to select only several Document Types. Is this possible? Do you know this kind of report? Thanks very much in advanced. Regards
-
Hi, How to configure CCMS to mail alert to my account when oracle tablespace space usage around 80%. Thanks and Rgds Shese
-
"Burn" Is Not Applying CD Name
Hi, When I burn my CD from Waveburner 1.5.1 the CD name ends up being "Audio CD". I've filled out all the Disc Options and Mastering Notes. When the CD is in my computer drive it should show the title of my CD not "Audio CD". It's two CD's so I need
-
Display scanned document to screen as it scans
When scanning to a PDF file, how can I set Acrobat X to display each page as it scans?
-
Protecting users and their emails after FA-P2T on Cloud and on-premise environments
Hello everyone, I would like to share this helpful article to let you know how to protect user's emails after a FA-P2T(production to test) procedure on-premise environments, and make it possible for Cloud(thru SRs, if approved, of course). thiagol