Is this query on XMLTYPE the most performant ?
Hello,
We are in 11gR2
and we built a process for loading XML files that I think are very complex (I hope so)
We about about 600 similar XML files to load every night.
The XML file is saved under a XMLTYPE table and we attached a XSD Schema on it.
One of the queries we built for selecting XMLTYPE data uses several outer joins on the XML. And I think I should find a way for increasing performance on the query
Here is the details (sometimes huge in volume) :
1) The query I would like to improve :
Depending on data in the XML file, the SELECT duration can go from 3 minutes to more than 4 hours !
select DISTINCT UPPER(t2.ressource_code)
, CASE WHEN ( t5.isWorkDay = 'false' AND t5.day IS NOT NULL
AND ( to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
BETWEEN to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
AND to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'))
THEN to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
ELSE to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS') END day_start
, CASE WHEN ( t5.isWorkDay = 'false' AND t5.day IS NOT NULL
AND ( to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
BETWEEN to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
AND to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'))
THEN to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')+1
ELSE to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS') END day_finish
, DECODE( t5.isWorkDay, NULL, CASE WHEN (to_number( t4.rate)>0) THEN 'true' ELSE 'false' END, t5.isWorkDay) isWorkDay
, DECODE( t5.isWorkDay, NULL, TO_CHAR( to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'), 'HH24:MI:SS'), t6.shift_start) shift_start
, DECODE( t5.isWorkDay, NULL, TO_CHAR( to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'), 'HH24:MI:SS'), t6.shift_finish) shift_finish
, DECODE( UPPER(t5.dayOfWeek), 'MON', 'LUNDI', 'TUE', 'MARDI', 'WED', 'MERCREDI', 'THU', 'JEUDI', 'FRI', 'VENDREDI', 'SAT', 'SAMEDI', 'SUN', 'DIMANCHE', NULL, NULL) dayOfWeek
, SYSDATE
, t1.tache_uid, t1.tache_code, t1.tache_desc
, t3.curve_name
, to_number( t4.rate) activity
FROM WORKBENCH_PROJECT_TABLE t
, xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
, '/WORKBENCH_PROJECT/Projects/Project/Tasks/Task' passing OBJECT_VALUE
columns tache_UID varchar2(70) path '@UID'
, tache_code varchar2(150) path '@taskID'
, tache_desc varchar2(150) path '@name'
, activites_xml xmltype path 'Assignments'
) t1
, xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
, '/Assignments/*' passing t1.activites_xml
columns ressource_code varchar2(50) path '@resourceID'
, curves_xml xmltype path 'Curve'
) t2
, xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
, '/Curve' passing t2.curves_xml
columns curve_name varchar2(50) path '@name'
, segments_xml xmltype path 'Segments'
) t3
, xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
, '/Segments/*' passing t3.segments_xml
columns rate varchar2(50) path '@rate'
, taux_start_date varchar2(20) path '@start'
, taux_end_date varchar2(20) path '@finish'
, calendar_days_xml xmltype path 'Calendar/Days'
) t4
, xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
, '/Days/*' passing t4.calendar_days_xml
columns dayOfWeek varchar2(50) path '@dayOfWeek'
, isWorkDay varchar2(20) path '@isWorkDay'
, DAY varchar2(20) path '@start'
, shift_xml xmltype path 'Shifts'
) (+) t5
, xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
, 'Shifts/Shift' passing t5.shift_xml
columns shift_start varchar2(20) path '@start'
, shift_finish varchar2(20) path '@finish'
) (+) t6; Here is the XSD schema :
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns="http://www.oracle.com/xsd/projet.xsd"
targetNamespace="http://www.oracle.com/xsd/projet.xsd"
elementFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xsd:element name="WORKBENCH_PROJECT" xdb:defaultTable="WORKBENCH_PROJECT_TABLE">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="BaseCalendars"/>
<xsd:element ref="PoolResources"/>
<xsd:element ref="Projects"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BaseCalendars" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Calendar" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PoolResources" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="PoolResource" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PoolResource" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Calendar"/>
<xsd:element ref="Curve"/>
<xsd:element ref="Notes" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="emailAddress" type="xsd:string"/>
<xsd:attribute name="employmentType" type="xsd:integer"/>
<xsd:attribute name="description" type="xsd:string"/>
<xsd:attribute name="firstName" type="xsd:string"/>
<xsd:attribute name="fullName" type="xsd:string"/>
<xsd:attribute name="hireDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="inputTypeCode" type="xsd:integer"/>
<xsd:attribute name="isActive" type="xsd:boolean"/>
<xsd:attribute name="isExternal" type="xsd:boolean"/>
<xsd:attribute name="isRole" type="xsd:boolean"/>
<xsd:attribute name="lastName" type="xsd:string"/>
<xsd:attribute name="managerUserName" type="xsd:string"/>
<xsd:attribute name="modBy" type="xsd:string"/>
<xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
<xsd:attribute name="resourceId" type="xsd:string"/>
<xsd:attribute name="resourceType" type="xsd:integer"/>
<xsd:attribute name="roleID" type="xsd:string"/>
<xsd:attribute name="terminationDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="trackMode" type="xsd:integer"/>
<xsd:attribute name="userFlag1" type="xsd:boolean"/>
<xsd:attribute name="userFlag2" type="xsd:boolean"/>
<xsd:attribute name="userNumber1" type="xsd:decimal"/>
<xsd:attribute name="userNumber2" type="xsd:decimal"/>
<xsd:attribute name="userText1" type="xsd:string"/>
<xsd:attribute name="userText2" type="xsd:string"/>
<xsd:attribute name="userText3" type="xsd:string"/>
<xsd:attribute name="userText4" type="xsd:string"/>
<xsd:attribute name="userText5" type="xsd:string"/>
<xsd:attribute name="userText6" type="xsd:string"/>
<xsd:attribute name="userText7" type="xsd:string"/>
<xsd:attribute name="userText8" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Projects" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Project" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Project" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Baselines" minOccurs="0"/>
<xsd:element ref="Notes" minOccurs="0"/>
<xsd:element ref="Resources" minOccurs="0"/>
<xsd:element ref="Tasks" minOccurs="0"/>
<xsd:element ref="BaselineDetails" minOccurs="0"/>
<xsd:element ref="Dependencies" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="UID"/>
<xsd:attribute name="active" type="xsd:boolean"/>
<xsd:attribute name="asOf" type="xsd:NMTOKEN"/>
<xsd:attribute name="approved" type="xsd:boolean"/>
<xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
<xsd:attribute name="budget" type="xsd:double"/>
<xsd:attribute name="closed" type="xsd:boolean"/>
<xsd:attribute name="cpmType" type="xsd:integer"/>
<xsd:attribute name="department" type="xsd:string"/>
<xsd:attribute name="description" type="xsd:string"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="finishImposed" type="xsd:boolean"/>
<xsd:attribute name="format" type="xsd:integer"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
<xsd:attribute name="priority" type="xsd:integer"/>
<xsd:attribute name="projectType" type="xsd:integer"/>
<xsd:attribute name="program" type="xsd:boolean"/>
<xsd:attribute name="projectID" type="xsd:string"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="startImposed" type="xsd:boolean"/>
<xsd:attribute name="status" type="xsd:integer"/>
<xsd:attribute name="trackMode" type="xsd:integer"/>
<xsd:attribute name="userText1" type="xsd:string"/>
<xsd:attribute name="userText2" type="xsd:string"/>
<xsd:attribute name="userText3" type="xsd:string"/>
<xsd:attribute name="userText4" type="xsd:string"/>
<xsd:attribute name="userText5" type="xsd:string"/>
<xsd:attribute name="userText6" type="xsd:string"/>
<xsd:attribute name="userText7" type="xsd:string"/>
<xsd:attribute name="userText8" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Baselines" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Baseline" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Baseline" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="code" type="xsd:string"/>
<xsd:attribute name="current" type="xsd:boolean"/>
<xsd:attribute name="description"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Resources" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Resource" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Resource" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="BaselineDetails" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="availFrom" type="xsd:NMTOKEN"/>
<xsd:attribute name="availTo" type="xsd:NMTOKEN"/>
<xsd:attribute name="bookingStatus" type="xsd:integer"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
<xsd:attribute name="requestStatus" type="xsd:integer"/>
<xsd:attribute name="resourceID" type="xsd:string"/>
<xsd:attribute name="roleID" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Tasks" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Task" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Task" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Assignments" minOccurs="0"/>
<xsd:element ref="BaselineDetails" minOccurs="0"/>
<xsd:element ref="Constraints" minOccurs="0"/>
<xsd:element ref="Notes" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="UID"/>
<xsd:attribute name="taskID" type="xsd:string"/>
<xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
<xsd:attribute name="baselineDuration" type="xsd:decimal"/>
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="critical" type="xsd:boolean"/>
<xsd:attribute name="earlyFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="earlyStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="fixed" type="xsd:boolean"/>
<xsd:attribute name="guidelines" type="xsd:string"/>
<xsd:attribute name="key" type="xsd:boolean"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="lateFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="lateStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="locked" type="xsd:boolean"/>
<xsd:attribute name="methodID" type="xsd:string"/>
<xsd:attribute name="milestone" type="xsd:boolean"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="outlineLevel" type="xsd:integer"/>
<xsd:attribute name="percComp" type="xsd:decimal"/>
<xsd:attribute name="priority" type="xsd:string"/>
<xsd:attribute name="proxy" type="xsd:boolean"/>
<xsd:attribute name="shortName" type="xsd:string"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="status" type="xsd:integer"/>
<xsd:attribute name="summary" type="xsd:boolean"/>
<xsd:attribute name="totalSlack" type="xsd:double"/>
<xsd:attribute name="unplanned" type="xsd:boolean"/>
<xsd:attribute name="userText1" type="xsd:string"/>
<xsd:attribute name="userText2" type="xsd:string"/>
<xsd:attribute name="userText3" type="xsd:string"/>
<xsd:attribute name="userText4" type="xsd:string"/>
<xsd:attribute name="userText5" type="xsd:string"/>
<xsd:attribute name="userText6" type="xsd:string"/>
<xsd:attribute name="userText7" type="xsd:string"/>
<xsd:attribute name="userText8" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Assignments" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Assignment" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Assignment" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="BaselineDetails" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="actualThrough" type="xsd:NMTOKEN"/>
<xsd:attribute name="actualWork" type="xsd:double"/>
<xsd:attribute name="baselineWork" type="xsd:double"/>
<xsd:attribute name="estMax" type="xsd:double"/>
<xsd:attribute name="estPattern" type="xsd:integer"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="pendActSum" type="xsd:double"/>
<xsd:attribute name="pendEstSum" type="xsd:double"/>
<xsd:attribute name="remainingWork" type="xsd:double"/>
<xsd:attribute name="resourceID" type="xsd:string"/>
<xsd:attribute name="roleID" type="xsd:string"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="status" type="xsd:integer"/>
<xsd:attribute name="unplanned" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Constraints" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Constraint" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Constraint" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="time" type="xsd:NMTOKEN"/>
<xsd:attribute name="type" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Notes" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Note" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Note" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="content" type="xsd:string"/>
<xsd:attribute name="createdBy" type="xsd:string"/>
<xsd:attribute name="createdDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Dependencies" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Dependency" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Dependency" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="lag" type="xsd:decimal"/>
<xsd:attribute name="lagType" type="xsd:integer"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="predecessorID" type="xsd:string"/>
<xsd:attribute name="predecessorUID"/>
<xsd:attribute name="startFinishType" type="xsd:integer"/>
<xsd:attribute name="successorID" type="xsd:string"/>
<xsd:attribute name="successorUID"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Calendar" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Days" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="baseCalendar"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="name"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Days" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Day" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Day" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Shifts" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="dayOfWeek" type="xsd:string"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="isWorkDay" type="xsd:boolean"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Shifts" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Shift" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Shift" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Curve" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Segments" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="default" type="xsd:double"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Segments" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Segment" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Segment" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Calendar" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="rate" type="xsd:double"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="BaselineDetails" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="BaselineDetail" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BaselineDetail" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="baselineCode" type="xsd:string"/>
<xsd:attribute name="costSum" type="xsd:double"/>
<xsd:attribute name="duration" type="xsd:double"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="usageSum" type="xsd:double"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>3) and one of the smallest XML ... (I can send you a bigger one, where you could notice the query duration )
"Your message exceeds the maximum length of 30000 characters."I can email you an XML file, I failed to upload the smallest XML file !!!!
Well, I hope that's clear enough ad that you could provide me help and advices
Thanks a lot in advance,
Olivier
connect / as sysdba
set define on
set timing on
-- Define variables for USERNAME, TABLESPACES and XMLDIR that represents the base directory where a 'xsd' directory
-- exists that contains the called XML schema used in this script to be registered that creates the XMLTYPE OR table
def USERNAME = cap
def PASSWORD = &USERNAME
-- def XMLDIR = 'C:\Temp'
def USER_TABSPACE = USERS
def TEMP_TABSPACE = TEMP
-- End declaritive section
drop user &USERNAME cascade
grant create any directory, drop any directory, connect, resource, create synonym, alter session, create view to &USERNAME identified by &PASSWORD
alter user &USERNAME default tablespace &USER_TABSPACE temporary tablespace &TEMP_TABSPACE
connect &USERNAME/&PASSWORD
-- create or replace directory XMLDIR as '&XMLDIR/xsd'
select * from v$version
DECLARE
V_XMLSCHEMA CLOB := '<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns="http://www.oracle.com/xsd/projet.xsd"
targetNamespace="http://www.oracle.com/xsd/projet.xsd"
elementFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xsd:element name="WORKBENCH_PROJECT" xdb:defaultTable="WORKBENCH_PROJECT_TABLE">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="BaseCalendars"/>
<xsd:element ref="PoolResources"/>
<xsd:element ref="Projects"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BaseCalendars" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Calendar" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PoolResources" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="PoolResource" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PoolResource" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Calendar"/>
<xsd:element ref="Curve"/>
<xsd:element ref="Notes" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="emailAddress" type="xsd:string"/>
<xsd:attribute name="employmentType" type="xsd:integer"/>
<xsd:attribute name="description" type="xsd:string"/>
<xsd:attribute name="firstName" type="xsd:string"/>
<xsd:attribute name="fullName" type="xsd:string"/>
<xsd:attribute name="hireDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="inputTypeCode" type="xsd:integer"/>
<xsd:attribute name="isActive" type="xsd:boolean"/>
<xsd:attribute name="isExternal" type="xsd:boolean"/>
<xsd:attribute name="isRole" type="xsd:boolean"/>
<xsd:attribute name="lastName" type="xsd:string"/>
<xsd:attribute name="managerUserName" type="xsd:string"/>
<xsd:attribute name="modBy" type="xsd:string"/>
<xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
<xsd:attribute name="resourceId" type="xsd:string"/>
<xsd:attribute name="resourceType" type="xsd:integer"/>
<xsd:attribute name="roleID" type="xsd:string"/>
<xsd:attribute name="terminationDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="trackMode" type="xsd:integer"/>
<xsd:attribute name="userFlag1" type="xsd:boolean"/>
<xsd:attribute name="userFlag2" type="xsd:boolean"/>
<xsd:attribute name="userNumber1" type="xsd:decimal"/>
<xsd:attribute name="userNumber2" type="xsd:decimal"/>
<xsd:attribute name="userText1" type="xsd:string"/>
<xsd:attribute name="userText2" type="xsd:string"/>
<xsd:attribute name="userText3" type="xsd:string"/>
<xsd:attribute name="userText4" type="xsd:string"/>
<xsd:attribute name="userText5" type="xsd:string"/>
<xsd:attribute name="userText6" type="xsd:string"/>
<xsd:attribute name="userText7" type="xsd:string"/>
<xsd:attribute name="userText8" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Projects" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Project" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Project" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Baselines" minOccurs="0"/>
<xsd:element ref="Notes" minOccurs="0"/>
<xsd:element ref="Resources" minOccurs="0"/>
<xsd:element ref="Tasks" minOccurs="0"/>
<xsd:element ref="BaselineDetails" minOccurs="0"/>
<xsd:element ref="Dependencies" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="UID"/>
<xsd:attribute name="active" type="xsd:boolean"/>
<xsd:attribute name="asOf" type="xsd:NMTOKEN"/>
<xsd:attribute name="approved" type="xsd:boolean"/>
<xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
<xsd:attribute name="budget" type="xsd:double"/>
<xsd:attribute name="closed" type="xsd:boolean"/>
<xsd:attribute name="cpmType" type="xsd:integer"/>
<xsd:attribute name="department" type="xsd:string"/>
<xsd:attribute name="description" type="xsd:string"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="finishImposed" type="xsd:boolean"/>
<xsd:attribute name="format" type="xsd:integer"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
<xsd:attribute name="priority" type="xsd:integer"/>
<xsd:attribute name="projectType" type="xsd:integer"/>
<xsd:attribute name="program" type="xsd:boolean"/>
<xsd:attribute name="projectID" type="xsd:string"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="startImposed" type="xsd:boolean"/>
<xsd:attribute name="status" type="xsd:integer"/>
<xsd:attribute name="trackMode" type="xsd:integer"/>
<xsd:attribute name="userText1" type="xsd:string"/>
<xsd:attribute name="userText2" type="xsd:string"/>
<xsd:attribute name="userText3" type="xsd:string"/>
<xsd:attribute name="userText4" type="xsd:string"/>
<xsd:attribute name="userText5" type="xsd:string"/>
<xsd:attribute name="userText6" type="xsd:string"/>
<xsd:attribute name="userText7" type="xsd:string"/>
<xsd:attribute name="userText8" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Baselines" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Baseline" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Baseline" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="code" type="xsd:string"/>
<xsd:attribute name="current" type="xsd:boolean"/>
<xsd:attribute name="description"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Resources" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Resource" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Resource" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="BaselineDetails" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="availFrom" type="xsd:NMTOKEN"/>
<xsd:attribute name="availTo" type="xsd:NMTOKEN"/>
<xsd:attribute name="bookingStatus" type="xsd:integer"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
<xsd:attribute name="requestStatus" type="xsd:integer"/>
<xsd:attribute name="resourceID" type="xsd:string"/>
<xsd:attribute name="roleID" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Tasks" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Task" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Task" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Assignments" minOccurs="0"/>
<xsd:element ref="BaselineDetails" minOccurs="0"/>
<xsd:element ref="Constraints" minOccurs="0"/>
<xsd:element ref="Notes" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="UID"/>
<xsd:attribute name="taskID" type="xsd:string"/>
<xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
<xsd:attribute name="baselineDuration" type="xsd:decimal"/>
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="critical" type="xsd:boolean"/>
<xsd:attribute name="earlyFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="earlyStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="fixed" type="xsd:boolean"/>
<xsd:attribute name="guidelines" type="xsd:string"/>
<xsd:attribute name="key" type="xsd:boolean"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="lateFinish" type="xsd:NMTOKEN"/>
<xsd:attribute name="lateStart" type="xsd:NMTOKEN"/>
<xsd:attribute name="locked" type="xsd:boolean"/>
<xsd:attribute name="methodID" type="xsd:string"/>
<xsd:attribute name="milestone" type="xsd:boolean"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="outlineLevel" type="xsd:integer"/>
<xsd:attribute name="percComp" type="xsd:decimal"/>
<xsd:attribute name="priority" type="xsd:string"/>
<xsd:attribute name="proxy" type="xsd:boolean"/>
<xsd:attribute name="shortName" type="xsd:string"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="status" type="xsd:integer"/>
<xsd:attribute name="summary" type="xsd:boolean"/>
<xsd:attribute name="totalSlack" type="xsd:double"/>
<xsd:attribute name="unplanned" type="xsd:boolean"/>
<xsd:attribute name="userText1" type="xsd:string"/>
<xsd:attribute name="userText2" type="xsd:string"/>
<xsd:attribute name="userText3" type="xsd:string"/>
<xsd:attribute name="userText4" type="xsd:string"/>
<xsd:attribute name="userText5" type="xsd:string"/>
<xsd:attribute name="userText6" type="xsd:string"/>
<xsd:attribute name="userText7" type="xsd:string"/>
<xsd:attribute name="userText8" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Assignments" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Assignment" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Assignment" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="BaselineDetails" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="actualThrough" type="xsd:NMTOKEN"/>
<xsd:attribute name="actualWork" type="xsd:double"/>
<xsd:attribute name="baselineWork" type="xsd:double"/>
<xsd:attribute name="estMax" type="xsd:double"/>
<xsd:attribute name="estPattern" type="xsd:integer"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="pendActSum" type="xsd:double"/>
<xsd:attribute name="pendEstSum" type="xsd:double"/>
<xsd:attribute name="remainingWork" type="xsd:double"/>
<xsd:attribute name="resourceID" type="xsd:string"/>
<xsd:attribute name="roleID" type="xsd:string"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="status" type="xsd:integer"/>
<xsd:attribute name="unplanned" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Constraints" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Constraint" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Constraint" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="time" type="xsd:NMTOKEN"/>
<xsd:attribute name="type" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Notes" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Note" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Note" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="content" type="xsd:string"/>
<xsd:attribute name="createdBy" type="xsd:string"/>
<xsd:attribute name="createdDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Dependencies" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Dependency" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Dependency" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="lag" type="xsd:decimal"/>
<xsd:attribute name="lagType" type="xsd:integer"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="predecessorID" type="xsd:string"/>
<xsd:attribute name="predecessorUID"/>
<xsd:attribute name="startFinishType" type="xsd:integer"/>
<xsd:attribute name="successorID" type="xsd:string"/>
<xsd:attribute name="successorUID"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Calendar" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Days" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="baseCalendar"/>
<xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
<xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
<xsd:attribute name="name"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Days" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Day" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Day" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Shifts" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="dayOfWeek" type="xsd:string"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="isWorkDay" type="xsd:boolean"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Shifts" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Shift" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Shift" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Curve" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Segments" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="default" type="xsd:double"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Segments" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Segment" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Segment" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Calendar" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="rate" type="xsd:double"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="BaselineDetails" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="BaselineDetail" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BaselineDetail" xdb:defaultTable="">
<xsd:complexType xdb:maintainDOM="false">
<xsd:sequence>
<xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="baselineCode" type="xsd:string"/>
<xsd:attribute name="costSum" type="xsd:double"/>
<xsd:attribute name="duration" type="xsd:double"/>
<xsd:attribute name="finish" type="xsd:NMTOKEN"/>
<xsd:attribute name="start" type="xsd:NMTOKEN"/>
<xsd:attribute name="usageSum" type="xsd:double"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>' ;
BEGIN
dbms_xmlschema.registerSchema
schemaurl => 'http://www.oracle.com/xsd/projet.xsd',
schemadoc => V_XMLSCHEMA,
local => TRUE,
genTypes => TRUE,
genBean => FALSE,
genTables => TRUE,
enablehierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
owner => user
END;
/
Similar Messages
-
The most performance friendly way to do this ?
I have a program thats in PROD and I want to make modifications to it.
The program loads an internal table with a high volume of data and does a bunch of processing on each record.
I need to modify the code so that when I do the first Loop and I am processing a rectype 1 record, I now want to consolidate it with other records eg:
ctry rectype pid date time etc ...
CA 1 2
CA 1 2
For every rectype 1 with the same pid, perform checks and consolidate the records into 1.
We are processing high volume data. So I would like to implement the most performance freindly modification.
What is the best way to do the consolidation?
So when I get the first rectype 1 within my first loop, I need to go get all the records with the same pid. Consolidate them and then delete them so I dont pick them up again.
thx for your input .. JIf I understand this properly... Big if!
1) create a duplicate table
2) sort both tables by PID
3) delete duplicate PIDs from the main table. This will become your consolidated table
4) loop through the new "summary" table and loop through the original "details" table and do your consolidation logic. Use the initial binary read to identify the starting point in the table of the PID to be consolidated. This will avoid a full table scan for each summary record. Modify the summary table with the updated data.
This will be performance "friendly"
li_summary[] = original_table[].
li_details[] = li_summary[].
SORT: li_details BY pid,
li_summary BY pid.
DELETE ADJACENT DUPLICATES FROM li_summary COMPARING pid.
LOOP AT li_summary ASSIGNING <summary>.
READ TABLE li_details TRANSPORTING NO FIELDS
WITH KEY pid = <summary>-pid
BINARY SEARCH.
IF sy-subrc = 0.
LOOP AT li_details assinging <same_pid> FROM sy-tabix.
IF <same_pid>-pid <> <summary>-pid.
EXIT.
ENDIF.
consolidate or whatever you need to do
<summary>-??? = ?? + ??? etc.
ENDLOOP.
ENDIF.
ENDLOOP.
original_table[] = li_summary[]. -
Need the most performance and scalable way to "trigger" JavaEE application
Hi,
Need the most performance and scalable way to "trigger" JavaEE application code running on WLS from PLSQL code.
There are some thirdparty JavaEE application running on WLS that we need to invoke from PLSQL code. I have looked at couple of options:
Option 1)
Use oracle db callouts(http call etc.) but it seems the connection to WLS will not be maintained across database-sessions and so every call from different plsql database-session will make fresh TCP/IP connection. Usually fresh socket connection setup is expensive and can become a bottleneck.
Option 2)
Use AQ in the database from PLSQL and have a MDB in WLS to invoke the java code. The problem here is how do I simulate the Request/Reply pattern using the AQ API from PLSQL. The PLSQL code needs to wait until the JavaEE code completes as it needs some result back from JavaEE app. AQ also does not have true temporary queues so I am not sure how it will work with concurrent user/sessions.
Option 3)
Use Java in the database, we have tried this but for our usecase it is too expensive resource wise and is not meeting our performance needs.
Performance is the triggering mechanism is of highest interest to us.
Any suggestions/pointers is greatly appreciated.
Thanks,
Prantor
Edited by: Prantor on Nov 8, 2010 10:37 PMPerhaps you would benefit from viewing the problem differently.
In some/many/most cases the application server (WLS) invokes procedure residing in the DB server.
Place the control for the desired results in the application code running on the WLS. -
Why is this query not using the index?
check out this query:-
SELECT CUST_PO_NUMBER, HEADER_ID, ORDER_TYPE, PO_DATE
FROM TABLE1
WHERE STATUS = 'N'
and here's the explain plan:-
1
2 -------------------------------------------------------------------------------------
3 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
4 -------------------------------------------------------------------------------------
5 | 0 | SELECT STATEMENT | | 2735K| 140M| 81036 (2)|
6 |* 1 | TABLE ACCESS FULL| TABLE1 | 2735K| 140M| 81036 (2)|
7 -------------------------------------------------------------------------------------
8
9 Predicate Information (identified by operation id):
10 ---------------------------------------------------
11
12 1 - filter("STATUS"='N')
There is already an index on this column, as is shown below:-
INDEX_NAME INDEX_TYPE UNIQUENESS TABLE_NAME COLUMN_NAME COLUMN_POSITION
1 TABLE1_IDX2 NORMAL NONUNIQUE TABLE1 STATUS 1
2 TABLE1_IDX NORMAL NONUNIQUE TABLE1 HEADER_ID 1
So why is this query not using the index on the 'STATUS' Column?
I've already tried using optimizer hints and regathering the stats on the table, but the execution plan still remains the same, i.e. it still uses a FTS.
I have tried this command also:-
exec dbms_stats.gather_table_stats('GECS','GEPS_CS_SALES_ORDER_HEADER',method_opt=>'for all indexed columns size auto',cascade=>true,degree=>4);
inspite of this, the query is still using a full table scan.
The table has around 55 Lakh records, across 60 columns. And because of the FTS, the query is taking a long time to execute. How do i make it use the index?
Please help.
Edited by: user10047779 on Mar 16, 2010 6:55 AMIf the cardinality is really as skewed as that, you may want to look at putting a histogram on the column (sounds like it would be in order, and that you don't have one).
create table skewed_a_lot
as
select
case when mod(level, 1000) = 0 then 'N' else 'Y' end as Flag,
level as col1
from dual connect by level <= 1000000;
create index skewed_a_lot_i01 on skewed_a_lot (flag);
exec dbms_stats.gather_table_stats(user, 'SKEWED_A_LOT', cascade => true, method_opt => 'for all indexed columns size auto');Is an example. -
my iphone 5 has restored to an old backup after updating to ios 7 is there any way of getting my stuff back as this has now become the most recent back up?
also since the update it keeps resetting itself? i had a lot of stuff on there that i really wanted and alot of important info lost? please help!!You might be able to remove the recent backup from the backups folder and the old one should be usable at that point
USE EXTREAME CAUTION WHEN ACCESS THE FILES AND DO NOT DELETE ANYTHING
Mac: ~/Library/Application Support/MobileSync/Backup/
Note: The "~" represents your Home folder. If you don't see Library in your home folder, Option-click the Go menu.
Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
Note: To quickly access the Application Data folder, click Start, and choose Run. Type %appdata% and click OK.
Windows Vista, Windows 7, and Windows 8: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\ -
Can you please explain how this query is fetching the rows?
here is a query to find the top 3 salaries. But the thing is that i am now able to understand how its working to get the correct data :How the data in the alias table P1 and P2 getting compared. Can you please explain in some steps.
SELECT MIN(P1.SAL) FROM PSAL P1, PSAL P2
WHERE P1.SAL >= P2.SAL
GROUP BY P2.SAL
HAVING COUNT (DISTINCT P1.SAL) <=3 ;
here is the data i used :
SQL> select * from psal;
NAME SAL
able 1000
baker 900
charles 900
delta 800
eddy 700
fred 700
george 700
george 700
Regards,
Renu... Please help me in understanding the query.
Your query looks like anything but a Top-N query.
If you run it in steps and analyze the output at the end of each step, then you should be able to understand what it does.
Given below is some brief information on the same:
test@ora>
test@ora> --
test@ora> -- Query 1 - using the non-equi (theta) join
test@ora> --
test@ora> with psal as (
2 select 'able' as name, 1000 as sal from dual union all
3 select 'baker', 900 from dual union all
4 select 'charles', 900 from dual union all
5 select 'delta', 800 from dual union all
6 select 'eddy', 700 from dual union all
7 select 'fred', 700 from dual union all
8 select 'george', 700 from dual union all
9 select 'george', 700 from dual)
10 --
11 SELECT p1.sal AS p1_sal, p1.NAME AS p1_name, p2.sal AS p2_sal,
12 p2.NAME AS p2_name
13 FROM psal p1, psal p2
14 WHERE p1.sal >= p2.sal;
P1_SAL P1_NAME P2_SAL P2_NAME
1000 able 1000 able
1000 able 900 baker
1000 able 900 charles
1000 able 800 delta
1000 able 700 eddy
1000 able 700 fred
1000 able 700 george
1000 able 700 george
900 baker 900 baker
900 baker 900 charles
900 baker 800 delta
900 baker 700 eddy
900 baker 700 fred
900 baker 700 george
900 baker 700 george
900 charles 900 baker
900 charles 900 charles
900 charles 800 delta
900 charles 700 eddy
900 charles 700 fred
900 charles 700 george
900 charles 700 george
800 delta 800 delta
800 delta 700 eddy
800 delta 700 fred
800 delta 700 george
800 delta 700 george
700 eddy 700 eddy
700 eddy 700 fred
700 eddy 700 george
700 eddy 700 george
700 fred 700 eddy
700 fred 700 fred
700 fred 700 george
700 fred 700 george
700 george 700 eddy
700 george 700 fred
700 george 700 george
700 george 700 george
700 george 700 eddy
700 george 700 fred
700 george 700 george
700 george 700 george
43 rows selected.
test@ora>
test@ora>This query joins PSAL with itself using a non equi-join. Take each row of PSAL p1 and see how it compares with PSAL p2. You'll see that:
- Row 1 with sal 1000 is >= to all sal values of p2, so it occurs 8 times
- Row 2 with sal 900 is >= to 9 sal values of p2, so it occurs 7 times
- Row 3: 7 times again... and so on.
- So, total no. of rows are: 8 + 7 + 7 + 5 + 4 + 4 + 4 + 4 = 43
test@ora>
test@ora> --
test@ora> -- Query 2 - add the GROUP BY
test@ora> --
test@ora> with psal as (
2 select 'able' as name, 1000 as sal from dual union all
3 select 'baker', 900 from dual union all
4 select 'charles', 900 from dual union all
5 select 'delta', 800 from dual union all
6 select 'eddy', 700 from dual union all
7 select 'fred', 700 from dual union all
8 select 'george', 700 from dual union all
9 select 'george', 700 from dual)
10 --
11 SELECT p2.sal AS p2_sal,
12 COUNT(*) as cnt,
13 COUNT(p1.sal) as cnt_p1_sal,
14 COUNT(DISTINCT p1.sal) as cnt_dist_p1_sal,
15 MIN(p1.sal) as min_p1_sal,
16 MAX(p1.sal) as max_p1_sal
17 FROM psal p1, psal p2
18 WHERE p1.sal >= p2.sal
19 GROUP BY p2.sal;
P2_SAL CNT CNT_P1_SAL CNT_DIST_P1_SAL MIN_P1_SAL MAX_P1_SAL
700 32 32 4 700 1000
800 4 4 3 800 1000
900 6 6 2 900 1000
1000 1 1 1 1000 1000
test@ora>
test@ora>Now, if you group by p2.sal in the output of query 1, and check the number of distinct p1.sal, min of p1.sal etc. you see that for p2.sal values - 800, 900 and 1000, there are 3 or less p1.sal values associated.
So, the last 3 rows are the ones you are interested in, essentially. As follows:
test@ora>
test@ora> --
test@ora> -- Query 3 - GROUP BY and HAVING
test@ora> --
test@ora> with psal as (
2 select 'able' as name, 1000 as sal from dual union all
3 select 'baker', 900 from dual union all
4 select 'charles', 900 from dual union all
5 select 'delta', 800 from dual union all
6 select 'eddy', 700 from dual union all
7 select 'fred', 700 from dual union all
8 select 'george', 700 from dual union all
9 select 'george', 700 from dual)
10 --
11 SELECT p2.sal AS p2_sal,
12 COUNT(*) as cnt,
13 COUNT(p1.sal) as cnt_p1_sal,
14 COUNT(DISTINCT p1.sal) as cnt_dist_p1_sal,
15 MIN(p1.sal) as min_p1_sal,
16 MAX(p1.sal) as max_p1_sal
17 FROM psal p1, psal p2
18 WHERE p1.sal >= p2.sal
19 GROUP BY p2.sal
20 HAVING COUNT(DISTINCT p1.sal) <= 3;
P2_SAL CNT CNT_P1_SAL CNT_DIST_P1_SAL MIN_P1_SAL MAX_P1_SAL
800 4 4 3 800 1000
900 6 6 2 900 1000
1000 1 1 1 1000 1000
test@ora>
test@ora>
test@ora>That's what you are doing in that query.
The thing is - in order to find out Top-N values, you simply need to scan that one table PSAL. So, joining it to itself is not necessary.
A much simpler query is as follows:
test@ora>
test@ora>
test@ora> --
test@ora> -- Top-3 salaries - distinct or not; using ROWNUM on ORDER BY
test@ora> --
test@ora> with psal as (
2 select 'able' as name, 1000 as sal from dual union all
3 select 'baker', 900 from dual union all
4 select 'charles', 900 from dual union all
5 select 'delta', 800 from dual union all
6 select 'eddy', 700 from dual union all
7 select 'fred', 700 from dual union all
8 select 'george', 700 from dual union all
9 select 'george', 700 from dual)
10 --
11 SELECT sal
12 FROM (
13 SELECT sal
14 FROM psal
15 ORDER BY sal DESC
16 )
17 WHERE rownum <= 3;
SAL
1000
900
900
test@ora>
test@ora>
test@ora>And for Top-3 distinct salaries:
test@ora>
test@ora> --
test@ora> -- Top-3 DISTINCT salaries; using ROWNUM on ORDER BY on DISTINCT
test@ora> --
test@ora> with psal as (
2 select 'able' as name, 1000 as sal from dual union all
3 select 'baker', 900 from dual union all
4 select 'charles', 900 from dual union all
5 select 'delta', 800 from dual union all
6 select 'eddy', 700 from dual union all
7 select 'fred', 700 from dual union all
8 select 'george', 700 from dual union all
9 select 'george', 700 from dual)
10 --
11 SELECT sal
12 FROM (
13 SELECT DISTINCT sal
14 FROM psal
15 ORDER BY sal DESC
16 )
17 WHERE rownum <= 3;
SAL
1000
900
800
test@ora>
test@ora>
test@ora>You may also want to check out the RANK and DENSE_RANK analytic functions.
RANK:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions123.htm#SQLRF00690
DENSE_RANK:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions043.htm#SQLRF00633
HTH
isotope -
How to modify this query to get the desired output format
I hv written a Query to display all the parent table names and their primary key columns(relevant to this foreign key of the child table).The query is given below...
SELECT DISTINCT(TABLE_NAME) AS PARENT_TABLE,COLUMN_NAME AS PARENT_COLUMN
FROM ALL_CONS_COLUMNS
WHERE CONSTRAINT_NAME IN (SELECT AC.R_CONSTRAINT_NAME
FROM ALL_CONSTRAINTS AC
WHERE AC.TABLE_NAME=TABLE_NAME
AND AC.TABLE_NAME='&TABLE'
AND AC.R_CONSTRAINT_NAME IS NOT NULL);
This query will display all the parent tables and their primary key columns.Now my problem is that how to modify this query to also display the foreign key column name of the child table.
I want the query result in the following format.The query should display the following columns.1)child table's name,2)child table's foreign key column name,3)the corresponding parent table's name,4)the parent table's primary key column name(which is the foreign key in the child table).
For Example I want the output as follows...
TAKE THE CASE OF SCOTT.EMP(AS INPUT TO YOUR QUERY)
CHILD_TABLE CHILD_COLUMN PARENT_TABLE PARENT_COLUMN
EMP DEPTNO DEPT DEPTNO
In this result I hv used alias name for the columns.The query should display this only for the foreign keys in the child table.In the query which I sent to you earlier will give the parent table and the parent column names,But I also want to append the child table and child column names there.
any help on how to tackle would be appreciated.Try this query
SELECT c.table_name child_table,
c.column_name child_column,
p.table_name parent_table,
p.column_name parent_column
FROM user_constraints a,user_constraints b,user_cons_columns c,
user_cons_columns p
WHERE a.r_constraint_name=b.constraint_name and
a.constraint_name=c.constraint_name and
b.constraint_name=p.constraint_name and
c.position=p.position
ORDER BY c.constraint_name,c.position
Anwar -
Dude, this query is frightening the children
We're using PlumBEALogicAquaWebCenterTree 6.1 on Oracle 10g on Solaris. This query is taking 11+ seconds to run. (It gets faster after the first time due to DB-level caching.) We only have about 20,000 users and around 250 communities. PTVGroupMembership has just under 1.4 million rows in it, which seems a little high for a portal of this size. Anyway, here's the scary query:
'/* MYPAGES_COMMUNITY_QUERY_AVAILABLE:ANSI */ SELECT c.Name, c.IsLocalized, c.ObjectID FROM PTComm
unities c, (SELECT DISTINCT c.ObjectID FROM PTCommunities c, PTCommSecurity cs, PTVGroupMembership gm WHERE cs.ObjectID=c.ObjectID AND c
s.ClassID=512 AND ((cs.GroupID=?) OR (gm.UserID=? AND cs.GroupID=gm.GroupID )) AND c.ObjectID NOT IN (SELECT c.ObjectID FROM PTCommunit
ies c, PTMyCommunities mc, PTCommSecurity cs, PTVGroupMembership gm WHERE c.ObjectID=mc.CommunityID AND cs.ObjectID=c.ObjectID AND cs.Cl
assID=512 AND ((mc.GroupID=? AND cs.GroupID=gm.GroupID AND gm.UserID=-mc.GroupID) OR (mc.GroupID=gm.GroupID AND gm.UserID=? AND cs.Grou
pID=gm.GroupID ))) ) tmp WHERE tmp.ObjectID=c.ObjectID ORDER BY LOWER(c.Name)'
This happens when people log into to the portal and display the home community. The use case: someone doesn't use the portal for a while, then they log in and it takes 15+ seconds, then they give up and never come back. Problem solved! They never use our system again because it's slower than a dog trapped in a La Brea tar pit. Oh yeah, and did I mention that the dog has no legs?
I'd like to talk to the person who wrote this query, but I've already called the three developers from Plumtree who still work at Oracle and all three of them vehemently denied writing this nasty bit of SQL. (I would have done the same thing if it were my query.)
Any suggestions?We figured out that adding the part in bold makes the query run in .06 seconds. That's a big improvement from 11 seconds (or more):
'/* MYPAGES_COMMUNITY_QUERY_AVAILABLE:ANSI */ SELECT c.Name, c.IsLocalized, c.ObjectID FROM PTComm
unities c, (SELECT DISTINCT c.ObjectID FROM PTCommunities c, PTCommSecurity cs, PTVGroupMembership gm WHERE cs.ObjectID=c.ObjectID AND c
s.ClassID=512 AND ((cs.GroupID=? and gm.UserID IS NULL ) OR (gm.UserID=? AND cs.GroupID=gm.GroupID )) AND c.ObjectID NOT IN (SELECT c.ObjectID FROM PTCommunit
ies c, PTMyCommunities mc, PTCommSecurity cs, PTVGroupMembership gm WHERE c.ObjectID=mc.CommunityID AND cs.ObjectID=c.ObjectID AND cs.Cl
assID=512 AND ((mc.GroupID=? AND cs.GroupID=gm.GroupID AND gm.UserID=-mc.GroupID) OR (mc.GroupID=gm.GroupID AND gm.UserID=? AND cs.Grou
pID=gm.GroupID ))) ) tmp WHERE tmp.ObjectID=c.ObjectID ORDER BY LOWER(c.Name)'
Now the question is . . . do we wait for months (or years) for a patch or just hack the change in ourselves? -
Query to show the most useful Indexes in SQL?
So I'm familiar with the Queries that show the Bad Indexes, but, is there a query I can run that shows which Indexes are the best, or, most used?
This topic first appeared in the Spiceworks CommunityHi ganesh,
Thanks for response.
but assumption is wrong.
the values below 200 also needed and the values above 200(400,204) has to show 200 in the output of the report.
format before the output of the query.
james 400
kitty 200
jhones 180
francy 204.
Now my output has to show
james 200
kitty 200
jhones 180
francy 200.
I hope you can understand better now.
Thanks,
James -
So a lot of my music in iTunes is CDs and recently I was trying to download another CD to it and everything went as normal until I downloaded it to my iPod. So I know that to get everything to match you have to change the names and stuff to get the album to match the iTunes version exactly so that everything will go smoothly and I did that but when I downloaded it to my iPod I saw that it didn't name the artist. Where it should say the artist it says "Unknown Artist". I thought that it was just that particular album but than I tried downloading another album and the same thing happened. I've tried everything. I've double checked to make sure the album matches the iTunes version and it still does it. Everything is fine on the iTunes on the computer. It says the artist and stuff but than on my iPod it doesn't. The album artwork, name of the album, and name of the songs are all there but the name of the artist isn't. It never did this before and it started right after I downloaded the latest version of iTunes so since it happened twice I think it may be a glitch with either my iPod or with iTunes but I thought maybe somebody could help me? I guess it's not important but it really bothers me. Especially since it could be avoided.
Yes i've tried all of that. I've turned it all the way on and off and erased all of my music and put it back on and nothing works. And with the breaking up CDs and putting into compilation categories i have already fixed all of that stuff. It's fine it just doesn't show up in the list of artists. I can find the album in the songs category and the albums category it's just it doesn't show tha name of the artist. All of the other albums that i downloaded before i updated my itunes to th most recent update are fine. It's just the two that i downloaded afterwards. Thanks for trying though.
-
Is this supposed to be the most reliable database server? A msg to oracle.
Hi, it's been 3 weeks now that I'm fiddling with oracle 11g and I am surprised with the amount of installation/startup/shutdown/management issues that I am facing. I need to evaluate oracle as a possible replacement for sql server, I am supposed to test oracle's scalability vs sql server scalability but so far I was messed up by all kind of installation/management issues. Is Oracle a product always in alpha stage?
I am not new with oracle, I've used oracle 10g in the past and I went through all the oracle library documentation (concepts, dba guide, sql reference etc). By now I am pretty confident with db concepts like control files, redo logs, spfile, tablespaces etc.
I've installed it on 4 machines:
1. windows xp 64bit, 40GB Ram
installation went ok, database + listener + dbconsole started correctly. I did a few things but after rebooting the machine the db did not start! (it complained that it tried to allocate 0 bytes of memory where it needed 2mb for some reason).
dbca is supposed to configure an instance but guess what? To configure the instance if first must start the instance and ofcourse in my case it couldn't start the instance!!!
After reading docs, googling etc, I exported spfile to pfile , manually edited the pfile, imported the pfile as spfile and the db finally started working.
Why on earth a product costing so much can't survive a reboot?
2. centos 5.3 64bit on a P4 machine with 2gb ram
installed ok, database + listener + dbconsole started ok after install. There is no script that I am aware which starts or shuts down the db nor the installer prompted me to install the db as a service (/etc/init.d). So I manually had to create scripts to start/shutdown the db by exporting ORACLE_HOME, ORACLE_SID and using dbstart.sh and dbshut.sh and also calling emctrl start dbconsole.
Which means that if someone doesn't shut down the instance before rebooting linux, will the db shut down abnormally?
I would expect a product that costs £13k to install itself properly on linux. mysql is free but comes with proper installations in most linux flavors.
3. centos 5.3, 64bit on an athlon 64 3000+ with 1gb ram.
installed ok, database + listener + dbconsole started ok after install. As you can guess, it didn't survive a reboot. Anyway to make long story short, I managed to create startup/shutdown scripts and all started working.
Then I tried to play admin for a while, i.e. tried to move tablespaces, backup/restore db, backup tablespaces and so on, using dbconsole. Oh well, I can't count the times dbconsole was failing... Are we the beta testers of dbconsole?
But then I needed to change the domain name of the machine and bang! All db services broken again. After fiddling with listener.ora and other config files that I don't remember, I managed to make db and listener work again but not the dbconsole which doesn't want to start and also I don't know where are the log files (there are so many log folders....) Anyway I am still digging into the documentation.
4. fedora 9 32 bit, 2gb ram. Same issues like #2,#3.
I've the following suggestions for oracle:
1. Less configuration files for oracle's next version.
2. Installation should "do it all" for the user in all operating systems
3. a dedicated testing team for dbconsole - it's just buggy
4. improvements on db,tablespace backups and movements. Is it so hard to create a utility that create a zipped backup of tablespaces or the database which can be used on a different server to restore the files?
I've still not worked on my main task : to test scalability. More comments will follow...
Regards,
KostasHi, found the log file, it is under .../dbhome_1/oc4j/j2ee/OC4J_DBConsole_server.lan_orcl/log
It appears that oc4j was trying to load the encryption keys file from OC4J_DBConsole_localhost_orcl, didn't find it, oc4j was then exiting but emctl was constantly trying to restart oc4j!!! One more cool "feature" of oracle.
Anyway, I managed to fix that issue but now oc4j/dbconsole still doesn't start, dunno why, the log says:
<MESSAGE>
<HEADER>
<TSTZ_ORIGINATING>2010-01-07T21:35:39.517+00:00</TSTZ_ORIGINATING>
<COMPONENT_ID>oc4j</COMPONENT_ID>
<MSG_TYPE TYPE="WARNING"></MSG_TYPE>
<MSG_LEVEL>1</MSG_LEVEL>
<HOST_ID>server.lan</HOST_ID>
<HOST_NWADDR>192.168.1.4</HOST_NWADDR>
<MODULE_ID>network</MODULE_ID>
<THREAD_ID>13</THREAD_ID>
<USER_ID>ariskk</USER_ID>
</HEADER>
<CORRELATION_DATA>
<EXEC_CONTEXT_ID><UNIQUE_ID>192.168.1.4:94967:1262900139517:43</UNIQUE_ID><SEQ>0</SEQ></EXEC_CONTEXT_ID>
</CORRELATION_DATA>
<PAYLOAD>
<MSG_TEXT>Exception in NIOServerSocketDriver:selectForRead</MSG_TEXT>
<SUPPL_DETAIL><![CDATA[java.nio.channels.ClosedChannelException
at java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:252)
at oracle.oc4j.network.NIOServerSocketDriver$SelectorThreadTask.selectForRead(NIOServerSocketDriver.java:331)
at oracle.oc4j.network.NIOServerSocketDriver.selectForRead(NIOServerSocketDriver.java:58)
at oracle.oc4j.network.ServerSocketAcceptHandler.persistConnection(ServerSocketAcceptHandler.java:389)
at oracle.oc4j.network.ServerSocketAcceptHandler.endReadHandlerRun(ServerSocketAcceptHandler.java:409)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:275)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
]]></SUPPL_DETAIL>
</PAYLOAD>
</MESSAGE>
I also got an other problem. I have a heap table and I've created the same table as index organized. I am trying to copy the data over :
insert into header2 select * from header nologging;
But after around 5000 secs, sql developer gives me this error:
SEVERE 117 1314807 java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:246)
and the dml stops running. I've run that 3-4 times and it fails from 4800 to 5200 secs so I recon a time out is in place, any idea how to remove this timeout? -
I am looking for only column compare for making my target table same as source table.
My query:
select case when column_name_s is null and column_name_t is not null
then 'alter table GRADE_CONVERSION drop ' || column_name_t || ';'
when column_name_s is not null and column_name_t is null
then 'alter table GRADE_CONVERSION add ' || column_name_s || ' ' || data_type_s ||';'
else 'alter table GRADE_CONVERSION modify ' || column_name_t || ' ' || data_type_t ||';'
end alterations
from (select s.column_name column_name_s,t.column_name column_name_t,
s.data_type data_type_s,t.data_type data_type_t
from (select column_id,column_name,data_type
from all_tab_cols@database
where owner = 'erhan'
and table_name = 'GRADE_CONVERSION'
) s
full outer join
(select column_id,column_name,data_type
from all_tab_cols@database
where owner = 'sarigul'
and table_name = 'GRADE_CONVERSION'
) t
on s.column_name = t.column_name
Tables:
Target table: GRADE_CONVERSION table in sarigul@database
LETTER_GRADE
VARCHAR2(2)
GRADE_POINT
NUMBER(3,2)
MAX_GRADE
NUMBER(3)
MIN_GRADE
NUMBER(3)
Source table: GRADE_CONVERSION table in erhan@database
LETTER_GRADE
VARCHAR2(2)
GRADE_POINT
NUMBER(3,2)
MAX_GRADE
NUMBER(3)
MIN_GRADE
NUMBER(3)
CREATED_BY
VARCHAR2(30)
CREATED_DATE
DATE
MODIFIED_BY
VARCHAR2(30)
MODIFIED_DATE
DATE
want to see the result similar to this *(please ignore the column names here this is just a plain exemple:)
Alter table Target_table modify BOOK_ID Varchar2 (4);
Alter table Target_table add ISBN_10 Varchar2(13), null;
Alter table Target_table drop TITLE;I am looking for only column compare for making my target table same as source table.
My query:
select case when column_name_s is null and column_name_t is not null
then 'alter table GRADE_CONVERSION drop ' || column_name_t || ';'
when column_name_s is not null and column_name_t is null
then 'alter table GRADE_CONVERSION add ' || column_name_s || ' ' || data_type_s ||';'
else 'alter table GRADE_CONVERSION modify ' || column_name_t || ' ' || data_type_t ||';'
end alterations
from (select s.column_name column_name_s,t.column_name column_name_t,
s.data_type data_type_s,t.data_type data_type_t
from (select column_id,column_name,data_type
from all_tab_cols@database
where owner = 'erhan'
and table_name = 'GRADE_CONVERSION'
) s
full outer join
(select column_id,column_name,data_type
from all_tab_cols@database
where owner = 'sarigul'
and table_name = 'GRADE_CONVERSION'
) t
on s.column_name = t.column_name
Tables:
Target table: GRADE_CONVERSION table in sarigul@database
LETTER_GRADE
VARCHAR2(2)
GRADE_POINT
NUMBER(3,2)
MAX_GRADE
NUMBER(3)
MIN_GRADE
NUMBER(3)
Source table: GRADE_CONVERSION table in erhan@database
LETTER_GRADE
VARCHAR2(2)
GRADE_POINT
NUMBER(3,2)
MAX_GRADE
NUMBER(3)
MIN_GRADE
NUMBER(3)
CREATED_BY
VARCHAR2(30)
CREATED_DATE
DATE
MODIFIED_BY
VARCHAR2(30)
MODIFIED_DATE
DATE
want to see the result similar to this *(please ignore the column names here this is just a plain exemple:)
Alter table Target_table modify BOOK_ID Varchar2 (4);
Alter table Target_table add ISBN_10 Varchar2(13), null;
Alter table Target_table drop TITLE; -
How to run this query to get the minutes between two hours?
Hi all,
Hope doing well,
sir i am running one query which is:
v_TotalHrsMin1 := LPAD((extract(minute from TO_TIMESTAMP (v_Temphrs,'HH24:mi:ss')) - extract(minute from TO_TIMESTAMP (v_Outtime1,'HH24:mi:ss'))), 2, '0');--select to_date(v_temphrs,'YYYY-MM-DD HH:mi:ss')-to_date(v_OutPunch,'YYYY-MM-DD HH:mi:ss')*1440;
in this v_TotalHrsMin1 is number datatype and v_Temphrs is varchar2 which is storing this value: 12:00:00
and v_Outtime1 is varchar2 which is storing 06:00:00
now i want the minute difference between both times
and insert into v_Totalmin1.
but getting null value in v_totalmin1.
thanks952646 wrote:
Hi Sir,
i used query like this: v_TotalHrsMin1 := extract(hour from time_interval) * 60 + extract(minute from time_interval) from (select to_timestamp(v_temphrs,'HH24:MI:SS')-to_timestamp(v_outtime1,'HH24:MI:SS') time_interval from dual);That is not a query - that is a PL/SQL assignment expression. You should learn the differences between SQL and PL/SQL and how they work together ;-)
When doing it in PL/SQL, you do not need a query at all. Why would you do a select from dual in the PL/SQL assignment.
But you should be able to take the SQL example I gave you and write the equivalent PL/SQL code.
We do not want to do your work for you - we want to teach you how to do it yourself.
You should try and understand the examples we give you - not just cut-and-paste it and cry for help when you are cut-and-pasting a SQL example into PL/SQL code.
Anyway - here's a way to do it in PL/SQL:
declare
v_outtime1 varchar2(8);
v_temphrs varchar2(8);
v_interval interval day to second;
v_totalhrsmin1 number;
begin
v_outtime1 := '06:00:00';
v_temphrs := '12:00:00';
v_interval := to_timestamp(v_temphrs,'HH24:MI:SS')-to_timestamp(v_outtime1,'HH24:MI:SS');
v_totalhrsmin1 := extract(hour from v_interval) * 60 + extract(minute from v_interval);
end;
/What's so difficult about taking my SQL example, understanding what the differenct functions do, and then write that piece of PL/SQL? ;-) -
My sister has an iPad and an HP printer. She cant' print from her iPad even though a genius at the Apple Store sold the combination to her with the idea that it would be easy to do. Instead, I have to go to her place with my MacBook, she sends me an email, and I hook up my laptop to her printer to print what she needs. Why can't the Apple geniuses come up with a USB cable and an OS update to make it easy and NOT SO FRUSTRATING to print from the iPad?
I've been a Mac user for fifteen years but I could not, in good conscience, recommend an iPad to anyone until Apple considers that ease of use does not include regularly getting frustrated with the easiest of tasks.all printers speak a diffrent "computer language" for a device to understand this language
a driver is required
some devices such a computers come with drivers for a long line of printers and other devices
apple decided that it was better not to include that huge list of drivers as users would then not have
much storage left for media and apps
then apple let printer makers make apps for printing in app store and make printers support airprint -
DMX Query, the most influential variable
Yours sincerely.
I'm doing work of data mining using decision trees, and I have the expected result: Predicted probability of dropping out, however I would like the result, by DMX query, throw me the most influential variable in the above probability .
For example if Marco, has a 90% chance of dropping out, tell me what was the most influential variable for this probability, which can be Sex, Age, City, etc..
I have in my data mining model, named Tree, variables such as sex, age, marital status, district, etc., and my view of the data, Vista_Datos, fields such as customer name, phone, email, Prov.; so my query resulted DMX follows.
Select
(T. [CustomerName]) as [Customer]
(T. [date]) as [Date of Appointment]
t. [Department],
t. [Province]
t. [District]
(T. [address]) as [Address],
(T. [telephone]) as [Phone Fixed]
(T. [Cell_Phone]) as [Cell Phone]
(T. [email]) as [E],
PredictProbability ([Tree]. [Desertion], 0) * 100 as [Probability of Defection]
From
[Tree]
PREDICTION JOIN
OPENQUERY ([Source Mining]
'SELECT
[CustomerName]
[Date],
[Department],
[Province]
[District]
[Street address]
[telephone]
[Cell_Phone]
[Email]
FROM
[Dbo]. [Vista_Datos]
') AS t
ON
[Tree]. [Department] = t. [Department] AND
[Tree]. [Province] = t. [Province] AND
[Tree]. [District] = t. [District] AND
where (PredictProbability ([Tree]. [Desertion], 0) * 100)> 50
I need to modify the query to get the most influential variable in the prediction result.
I hope I have been clear so they can help me.
Thank you for your attention.
select * from [Model_Name].content
returns you all the information about the model (all the nodes in the tree).
select NODE_UNIQUE_NAME from [Model_Name].content where NODE_TYPE=2
returns NODE_UNIQUE_NAME of the root node. If you want to find all children of the root node (all the first splits) you can execute query like
select * from [Model_Name].content where [PARENT_UNIQUE_NAME]='000000004'
where '000000004' is NODE_UNIQUE_NAME of the root node.
Tatyana Yakushev [PredixionSoftware.com]
Maybe you are looking for
-
How to delete the record in the table without using lead selection?
hi, I have added the separate column "delete" to the table uielement and so for each record or row of the table the appropriate "delete" link to action will be there................the code below works when the particular row is selected through lead
-
Photoshop Elements 12 runs really slow and is almost unusable.
Photoshop (and Premiere) Elements 12 runs really slow and is almost unusable. All other high end software works perfectly including 3D rendering software. 27" iMac mid 2011. 16gb of RAM. Over 100gb free hdd space. Radeon HD card 2GB. 3.4 GHz Intel Co
-
Adobe flash player installer screen won't close
I was going to install it and found it was going to install Google chrome, and I didn't want that. So, I cancelled it and now I can't get the installer screen off my computer! Any help?
-
Contacts missing from iCloud, iPhone, Macbook, and iPad!
I somehow deleted all my address book contacts off of my Macbook. Since everything is through iCloud, I no longer have any contacts on my iPhone or iPad either. I don't have any time machine back ups on my Macbook (stupid, I know) and iCloud was neve
-
I'm trying to download the new iOS 7.0.6 but all I get is "est time remaining" message. I want to cancel but don't know how.