Nested loop Mapping in XSLT
Hi
I am using this XSLT mapping with the source and target structure as same, since i need to include some constants in it.I am doing more than two nesting for loop. Since it is the same structure it looks simple. But i cannot produce the nested output.
the XSL am using :
<b><xsl:for-each select="products/vendor/product"></b>
<xsl:element name="product">
<xsl:value-of select="products/vendor/product" />
<b> <xsl:for-each select="products/vendor/product/attribute"></b>
<xsl:element name="products/vendor/product/attribute">
<xsl:value-of select="products/vendor/product/attribute" />
<attribute operation="" attributeId="" name="" language="" endpointid="" xsi:type=""/>
</xsl:element>
<b> </xsl:for-each></b>
</xsl:element>
<b></xsl:for-each></b>
Need the output like
<product >
<attribute name="ADA Compliant">Y</attribute>
<attribute name="" type=" ">32.750</attribute>
<attribute name="" type=" ">19.750 in</attribute>
<attribute name="" type=" ">No</attribute>
<attribute name="" type=" ">65.000</attribute>
</product>
I am not sure what is wrong in the XSLT. Any pointers on this.
Regards
Anandan
Message was edited by:
Anandan Loganathan
Hi
Have a look
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
Some scenarios
/people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
Thanks
Similar Messages
-
Hi,
I have 2 mapping program one is main .xsl program and other one is value mapping program .xsl .
I have zipped both the program and imported into Imported archive in IR but while testing in interface mapping i am getting error.
error:could not compile xslt stylsheet.
Some of the interface having one .xsl program and value mapping is also defined in the main program itself,these interface i am able to execute successfully but unable to execute wherever there are 2 program (main prog + value mapping).
It seems that value mapping is not loading / executing.
Can anyone please guide me how to call value mapping using xslt mapping?
Thanks,
SubbuHi Prateek,
Thanks for the response.
Yes i have 2 program and both needs to execute in one interface mapping.
First program (main) is MappingMOAPS_SAVEMULTIPLE2013.xsl and second program i.e (value mapping) MO_vmf.xsl.
From main program itself value mapping program is called.
Please look below code for main & value mapping prog.
In main prog this is the parameter (<xsl:import href="MO_vmf.xslt"/>) where value mapping prog name is mentioned.
I have already zipped and imported but while testing in interface mapping it is giving error that "could not compile xslt stylsheet".
Could you plaese tell how to check or make XSL to accommodate multiple mappings?
Main mapping : MappingMOAPS_SAVEMULTIPLE2013.xsl --
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was generated by Altova MapForce 2008sp1
YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
Refer to the Altova MapForce Documentation for further details.
http://www.altova.com/mapforce
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vmf="http://www.altova.com/MapForce/UDF/vmf" exclude-result-prefixes="vmf xs xsi xsl">
<xsl:import href="MO_vmf.xslt"/>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/PPR">
<MOAPS_SAVEMULTIPLE201>
<IDOC>
<EDI_DC40>
<xsl:for-each select="SI_ID_IDOCS">
<xsl:for-each select="ID_TABNAM">
<TABNAM>
<xsl:value-of select="."/>
</TABNAM>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="SI_SP_SAP_PARTNER_INFO">
<xsl:for-each select="SP_MANDT">
<MANDT>
<xsl:value-of select="."/>
</MANDT>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="SI_ID_IDOCS">
<xsl:for-each select="ID_DIRECT">
Value mapping : MO_vmf.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was generated by Altova MapForce 2008sp1
YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
Refer to the Altova MapForce Documentation for further details.
http://www.altova.com/mapforce
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vmf="http://www.altova.com/MapForce/UDF/vmf" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs xsi xsl">
<xsl:template name="vmf:inputtoresult">
<xsl:param name="input"/>
<xsl:choose>
<xsl:when test="$input='01'">
<xsl:value-of select="'PM1C'"/>
</xsl:when>
<xsl:when test="$input='02'">
<xsl:value-of select="'PM2C'"/>
</xsl:when>
<xsl:when test="$input='03'">
<xsl:value-of select="'EXT3'"/>
</xsl:when>
Regards,
Subbu -
Hi,
I have a scenario in which i have to do a N:1 mapping using XSLT.
I am doing this using the BpmPatternCollectMultiIf giving the XSLT mapping in the transformation step...
But, the transformation step is returning the following error:
Error: Exception CX_MERGE_SPLIT occurred (program: CL_MERGE_SPLIT_SERVICE========CP, include: CL_
My XSLT mapping is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<item xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<KEYCODE>
<xsl:value-of select="ns0:Messages/ns0:Message1/fsxml/item/keycode"/>
</KEYCODE>
<DESCRIPTION>
<xsl:value-of select="ns0:Messages/ns0:Message1/fsxml/item/description"/>
</DESCRIPTION>
<CLASS>
<xsl:value-of select="ns0:Messages/ns0:Message1/fsxml/item/class"/>
</CLASS>
<ONE>
<xsl:value-of select="ns0:Messages/ns0:Message2/test/row/one"/>
</ONE>
<TWO>
<xsl:value-of select="ns0:Messages/ns0:Message2/test/row/two"/> </TWO>
</item>
</xsl:template>
</xsl:stylesheet>
Here,<b> fsxml</b> is the first message and<b> test</b> is the second message.
Kindly let me know if there is any problem in the XSLT mapping.
Thanks in advance,
Thanks,
Karen PereiraHi,
There was problem in the XSLT mapping. i figured it out and fixed it and the scenario worked.
The new mapping was as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<item xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<!-- Mapping for tags which are to be directly replicated in the target message-->
<KEYCODE>
<xsl:value-of select="ns0:Messages/ns0:Message1/fsxml/item/keycode"/>
</KEYCODE>
<DESCRIPTION>
<xsl:value-of select="ns0:Messages/ns0:Message1/fsxml/item/description"/>
</DESCRIPTION>
<CLASS>
<xsl:value-of select="ns0:Messages/ns0:Message1/fsxml/item/class"/>
</CLASS>
<ONE>
<xsl:value-of select="ns0:Messages/ns0:Message2/test/row/one"/>
</ONE>
<TWO>
<xsl:value-of select="ns0:Messages/ns0:Message2/test/row/two"/>
</TWO>
</item>
</ns0:Message1>
</ns0:Messages>
</xsl:template>
</xsl:stylesheet>
Thanks,
Karen -
How to call Java Map in XSLT map
Hello,
Can anyone tell me how to call Java Map in XSLT map.
Thanks and Regards
HemantHello, Vijay,
Can you help in understanding how can we pass whole payload in the parameter in XSLT map.....
for eg
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javamap="java:DATEandTIME.Date_Time">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="inputparam" />
<xsl:template match="/">
<MT_TARGET>
<date>
<xsl:if test="function-available('javamap:getDateValue')">
<xsl:value-of select="javamap:getDateValue($inputparam)"/> </xsl:if>
</date>
<time>
<xsl:if test="function-available('javamap:getTimeValue')">
<xsl:value-of select="javamap:getTimeValue($inputparam)"/> <xsl:value-of select="$test"/>
</xsl:if>
</time>
<project>
<xsl:value-of select= "//project"/>
</project>
</MT_TARGET>
</xsl:template>
</xsl:stylesheet>
here we are passing static value in parameter.....
Java code is:
private static AbstractTrace trace = null;
public static String getDateValue(Map inputparam)
trace = (AbstractTrace)inputparam.get(
StreamTransformationConstants.MAPPING_TRACE );
Date now1 = new Date();
SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMd");
String dateString = formatter.format(now1);
return dateString;
public static String getTimeValue(Map inputparam)
trace = (AbstractTrace)inputparam.get(
StreamTransformationConstants.MAPPING_TRACE );
Date now1 = new Date();
SimpleDateFormat formatter = new SimpleDateFormat ("hhmmss");
String dateString1 = formatter.format(now1);
return dateString1;
I want to pass whole payload so how can i pass it. -
Hello,
I am implementing value mapping in XSLT using template
I call following template to retrieve the value from ID....
<xsl:template name="NonMerchandiseSaleValueMapping">
<xsl:param name="GMNonMerchandiseType"/>
<xsl:value-of select="vm:executeMapping( 'GMNonMerchandiseType', 'GMNonMerchandiseTypeSchema', $GMNonMerchandiseType, 'IXRetailPOSLogLineItemType', 'IXRetailPOSLogLineItemTypeSchema')"/>
</xsl:template>
It works fine for 1 entry that was added long back. I added few new entries in ID value mapping table. All of them does not work. Is there any step we need to do after entering new data in value mapping table. I can see the values in cache monitoring also.
regards
GrewalHey
In Both IR and ID go to Environment->Cache Notifications
Do you see any error(red icon) for cache update,it must be all green to refresh cache.If there are any red color icons,click that and manually do a cache refresh(by clicking the small cache refresh icon).
also refresh Cache in RWB.
If all the above does not work,you can re-import the XSLT mapping in IR and see if it works.
Thanks
Aamir -
Building Tree hierarchy Using nested loops and class cl_gui_column_tree
Hello gurus,
I want to create a tree report using custom container and class cl_gui_column_tree. I have read and understood the standard demo report which SAP has provided i.e. SAPCOLUMN_TREE_CONTROL_DEMO. But in this report all the levels nodes are created as constants and hardcoded. I want to create hierarchy using nested loops. For this i took one example of a hierarchy of VBAK-VBELN->VBAP-POSNR Like One sales order has many line items and each line item can have number of line items in billing plan.
I have done some coding for it.
FORM build_tree USING node_table TYPE treev_ntab
item_table TYPE zitem_table. " i created the zitem_table table type of mtreeitm in SE11.
DATA: node TYPE treev_node,
item TYPE mtreeitm.
node-node_key = root.
CLEAR node-relatkey.
CLEAR node-relatship.
node-hidden = ' '.
node-disabled = ' '.
CLEAR node-n_image.
CLEAR node-exp_image.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
item-node_key = root.
item-item_name = colm1.
item-class = cl_gui_column_tree=>item_class_text.
item-text = 'Root'.
APPEND item TO item_table.
item-node_key = root.
item-item_name = colm2.
item-class = cl_gui_column_tree=>item_class_text.
item-text = 'Amount'.
APPEND item TO item_table.
LOOP AT it_vbeln INTO wa_vbeln.
node-node_key = wa_vbeln-vbeln.
node-relatkey = root.
node-relatship = cl_gui_column_tree=>relat_last_child.
node-hidden = ' '.
node-disabled = ' '.
CLEAR node-n_image.
CLEAR node-exp_image.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
item-node_key = wa_vbeln-vbeln.
item-item_name = colm1.
item-class = cl_gui_column_tree=>item_class_text.
item-text = wa_vbeln-vbeln.
APPEND item TO item_table.
item-node_key = wa_vbeln-vbeln.
item-item_name = colm2.
item-class = cl_gui_column_tree=>item_class_text.
item-text = wa_vbeln-netwr.
APPEND item TO item_table.
LOOP AT it_posnr INTO wa_posnr.
node-node_key = wa_posnr-posnr.
node-relatkey = wa_vbeln-vbeln.
node-relatship = cl_gui_column_tree=>relat_last_child.
node-hidden = ' '.
node-disabled = ' '.
CLEAR node-n_image.
CLEAR node-exp_image.
node-isfolder = ' '.
node-expander = ' '.
APPEND node TO node_table.
item-node_key = wa_posnr-posnr.
item-item_name = colm1.
item-class = cl_gui_column_tree=>item_class_text.
item-text = wa_posnr-posnr.
APPEND item TO item_table.
item-node_key = wa_posnr-posnr.
item-item_name = colm2.
item-class = cl_gui_column_tree=>item_class_text.
item-text = wa_posnr-netpr.
APPEND item TO item_table.
ENDLOOP.
ENDLOOP.
ENDFORM.
Now this program compiles fine and runs till there is only one level. That is root->vbeln. But when i add one more loop of it_posnr it gives me runtime error of message type 'X'. The problem i found was uniqueness of item-item_name as all the sales order have posnr = 0010. What could be done? I tried giving item_name unique hierarchy level using counters just like stufe field in prps eg. 10.10.10, 10.10.20,10.20.10,10.20.20,20.10.10 etc.. etc.. but still i am getting runtime error when i add one more hierarchy using nested loop. Plz guide.
Edited by: Yayati6260 on Jul 14, 2011 7:25 AMHello all,
Thanks the issue is solved. The node key was not getting a unique identification as nodekey. I resolved the issue by generating unique identification for each level. Thanks all,
Regards
Yayati Ekbote -
Problem with Nested loop in Fox-Formula
Dear Experts,
Let s share the scenario :
MaterialGroups with following Keys for Example AAAA, BBBB, CCCC..., Materialgroups are selected in the 1st input ready query, which is assigned to DataProvider DP_1 in a webtemplate.
every Materialgroup has several Materials, for instance:
Materialgroup AAAA has following Materials: AAAA10, AAAA11, AAAA12, AAAA13...
Materials are selected in a second input ready Query, which is assigned to a second DataProvider DP_2 in the Same Webtemplate as the query 1.
Both Materialgroup and Material are based on the same Aggreagtion level and same real time cube.
I want to copy the input values for every MaterialGroup ( 1st query, DP_1) only to it s own Materials (2cond Query, DP_2).
To resolve this Issue i wrote the following Fox Formula code with a nested loop, however it does not work properly. when I m debugging the code, i could release that the second Loop was ignored.but wehn i replace the second loop (nested loop) with a fixed value it s seems to work properly
DATA MG1 TYPE MATG.<------ MaterialGroup
DATA MT1 TYPE MAT.<----
Material
DATA S1 TYPE STRING.
DATA S2 TYPE STRING.
DATA S3 TYPE STRING
DATA K TYPE F.
DATA Z TYPE F.
FOREACH MG1.
To check Materialgroup in debugger
S1= MG1.
BREAK-POINT.
K = {KEYfIG, #, MG1}.
BREAK-POINT.
FOREACH MT1. <----- if i set MT1 to a fixed value like AAAA11 then S3 get the wished value namely AAAA
S2 = MT1.
BREAK-POINT.
S3 = SUBSTR (MT1, 0, 4).
BREAK-POINT.
IF S1 = S3.
{KEYFIG, MT1, #} = K.
following Statement is only used To check in debugger if Material has become the same Materialgroup value
Z = {KEYFIG, MT1, #}.
BREAK-POINT.
ENDIF.
ENDFOR.
ENDFOR.
Thakns for any help
Frank
Edited by: FRYYYBM on Mar 17, 2011 10:54 PM
Edited by: FRYYYBM on Mar 17, 2011 11:06 PMHi,
Please try this way.
DATA MG1 TYPE MATG.<------ MaterialGroup
DATA MT1 TYPE MAT.<----
Material
DATA S1 TYPE STRING.
DATA S2 TYPE STRING.
DATA S3 TYPE STRING
DATA K TYPE F.
DATA Z TYPE F.
FOREACH MT1.
FOREACH MG1.
To check Materialgroup in debugger
S1= MG1.
BREAK-POINT.
K = {KEYfIG, #, MG1}.
BREAK-POINT.
FOREACH MT1. <----- if i set MT1 to a fixed value like AAAA11 then S3 get the wished value namely AAAA
S2 = MT1.
BREAK-POINT.
S3 = SUBSTR (MT1, 0, 4).
BREAK-POINT.
IF S1 = S3.
{KEYFIG, MT1, #} = K.
following Statement is only used To check in debugger if Material has become the same Materialgroup value
Z = {KEYFIG, MT1, #}.
BREAK-POINT.
ENDIF.
ENDFOR.
ENDFOR.
ENDFOR.
Thanks.
With regards,
Anand Kumar -
Hi!
I would like to list all Combinations of a list A and a list B (each containing 5 integers) in a third list C in order to get 25 combinations. I am intending to use nested loops so that on the first loop the second loop starts and then the result lets say list A + list B are listed in the list C. Is there any other way of doing this with Labview or I am on the right track?
Best Regards,
HamidYou can use the polymorphic array math to accomplish this. Inside of a single for loop, index Array A and add that to the entire Array B in one shot. At this point, there are numerous ways to take the output. Probably the simpliest is to reshape the output 2D array into a 1D array. For better memory allocation, you can preinitialize a 1D array and replace elements in the for loop but in the end it accomplishes the same task. See attached example (LV7.1.1). Of course everything is dependant on what you are going to do with this, what operations, when and where the numbers come from.
Paul
Paul <--Always Learning!!!
sense and simplicity.
Browse my sample VIs?
Attachments:
arrayMath.vi 33 KB -
hi all.
I´ve just completed a little test for making a tree
component with custom
icons / bransch.
However, i can only get my first branch to show custom
icons.(links -
document) I figure I need to make a nested loop to Iterate
over
nextSibling?. I tried ALOT, but i guess I´m doing
something completely
wrong.
here is code for my tree so far:
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("tree.xml");
my_xml.onLoad = function(){
myTree.dataProvider = this.firstChild;
var folders = my_xml.firstChild.firstChild;
var docs = folders.childNodes;
for (var i=0; i < docs.length; i++){
currDoc = docs
trace(docs);
var docIcon = currDoc.attributes.pic;
switch(docIcon){
case "pdf":
myTree.setIcon(currDoc, "pdfIcon");
break;
case "word":
myTree.setIcon(currDoc, "wordIcon");
break;
case "excel":
myTree.setIcon(currDoc, "excelIcon");
break;
case "ie":
myTree.setIcon(currDoc, "ieIcon");
break;
}//switch
} //for
};//onLoad
And here is the XML I used:
<node label="» Dokument typer">
<node label="» links - document">
<node label="test.url" url="
http://www." pic="ie" info="test text" />
<node label="test.doc" url="test.doc" pic="word"
info="test text" />
<node label="test.excel" url="test.xls" pic="excel"
info="test text" />
<node label="test.pdf" url="test.pdf" pic="pdf"
info="test text." />
</node>
<node label="» Links - document">
<node label="test URL" url="
http://www." pic="ie" info="test text."
/>
<node label="test URL" url="
http://www." pic="ie" info="test text."
/>
</node>
</node>Solved it ..works nicely :D
ty anyways.
//cleaner
"cLeAnEr" <[email protected]> skrev i meddelandet
news:ekm1vc$r8h$[email protected]..
> hi all.
>
> I´ve just completed a little test for making a tree
component with custom
> icons / bransch.
> However, i can only get my first branch to show custom
icons.(links -
> document) I figure I need to make a nested loop to
Iterate over
> nextSibling?. I tried ALOT, but i guess I´m doing
something completely
> wrong.
>
>
> here is code for my tree so far:
>
> my_xml = new XML();
> my_xml.ignoreWhite = true;
> my_xml.load("tree.xml");
>
> my_xml.onLoad = function(){
> myTree.dataProvider = this.firstChild;
>
>
> var folders = my_xml.firstChild.firstChild;
> var docs = folders.childNodes;
>
> for (var i=0; i < docs.length; i++){
> currDoc = docs
> trace(docs);
>
> var docIcon = currDoc.attributes.pic;
>
> switch(docIcon){
> case "pdf":
> myTree.setIcon(currDoc, "pdfIcon");
> break;
> case "word":
> myTree.setIcon(currDoc, "wordIcon");
> break;
> case "excel":
> myTree.setIcon(currDoc, "excelIcon");
> break;
> case "ie":
> myTree.setIcon(currDoc, "ieIcon");
> break;
> }//switch
> } //for
> };//onLoad
>
>
> And here is the XML I used:
>
> <node label="» Dokument typer">
> <node label="» links - document">
> <node label="test.url" url="
http://www." pic="ie" info="test text" />
> <node label="test.doc" url="test.doc" pic="word"
info="test text" />
> <node label="test.excel" url="test.xls" pic="excel"
info="test text" />
> <node label="test.pdf" url="test.pdf" pic="pdf"
info="test text." />
> </node>
> <node label="» Links - document">
> <node label="test URL" url="
http://www." pic="ie" info="test text."
/>
> <node label="test URL" url="
http://www." pic="ie" info="test text."
/>
> </node>
> </node>
> -
Too many nested loops in execution plan?
Hi,
i wonder about execution plan not indicating that access to some tables (for join) is in parallel.
Please see this example:
------------------------ snip ------------------------------------
drop table test_a1;
drop table test_a2;
drop table test_b;
drop table test_c;
drop table test_d;
create table test_a1 (
x number,
y number,
z number);
create unique index testa1_pk on test_a1 (x);
create table test_a2 (
x number,
y number,
z number);
create unique index testa2_pk on test_a2 (x);
create table test_b (
x number,
y number,
z number);
create unique index testb_pk on test_b (y);
create table test_c (
x number,
y number,
z number);
create unique index testc_pk on test_b (z);
create table test_d (
x number,
y number,
z number);
create unique index testd_pk on test_d (y);
select
a1.x a1_x,
a1.y a1_y,
a1.z a1_z,
a2.x a2_x,
a2.y a2_y,
a2.z a2_z,
b.x b_x,
b.y b_y,
b.z b_z,
c.x c_x,
c.y c_y,
c.z c_z,
d.x d_x,
d.y d_y,
d.z d_z
from test_a1 a1, test_a2 a2, test_b b, test_c c, test_d d
where a1.x = 100
and a2.x = 200
and b.y = a1.y
and c.z = b.z
and d.y = a1.y;
------------------------ snap ------------------------------------
The execution plan goes like this:
Select Stmt
nested loops
nested loops
nested loops
nested loops
table access
index
access predicate
a2.x = 200
table access
index
access predicate
a1.x = 100
table access
index
access predicate
d.y = a1.y
table access
index
access predicate
b.y = a1.y
table acess
index
acess predicate
c.z = b.z
Access to tables a1 and a2 is on the same level (in parallel - i guess).
However, why isn't access to table d and b on the same level?
Both depend on a1. So no need to execute one after the other (no inter-dependency).
Maybe i have just wrong expectation to the output of the execution plan(?!)
- many thanks!
best regards,
FrankPreservation of identation and spacing is invaluable when it comes to reading an explain plan.
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 195 | 2 (0)| 00:00:01 |
| 1 | NESTED LOOPS | | 1 | 195 | 2 (0)| 00:00:01 |
| 2 | NESTED LOOPS | | 1 | 156 | 0 (0)| 00:00:01 |
| 3 | NESTED LOOPS | | 1 | 117 | 0 (0)| 00:00:01 |
| 4 | NESTED LOOPS | | 1 | 78 | 0 (0)| 00:00:01 |
| 5 | TABLE ACCESS BY INDEX ROWID| TEST_A2 | 1 | 39 | 0 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | TESTA2_PK | 1 | | 0 (0)| 00:00:01 |
| 7 | TABLE ACCESS BY INDEX ROWID| TEST_A1 | 1 | 39 | 0 (0)| 00:00:01 |
|* 8 | INDEX UNIQUE SCAN | TESTA1_PK | 1 | | 0 (0)| 00:00:01 |
| 9 | TABLE ACCESS BY INDEX ROWID | TEST_D | 82 | 3198 | 0 (0)| 00:00:01 |
|* 10 | INDEX UNIQUE SCAN | TESTD_PK | 1 | | 0 (0)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID | TEST_B | 82 | 3198 | 0 (0)| 00:00:01 |
|* 12 | INDEX UNIQUE SCAN | TESTB_PK | 1 | | 0 (0)| 00:00:01 |
|* 13 | TABLE ACCESS FULL | TEST_C | 1 | 39 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
6 - access("A2"."X"=200)
8 - access("A1"."X"=100)
10 - access("D"."Y"="A1"."Y")
12 - access("B"."Y"="A1"."Y")
13 - filter("C"."Z"="B"."Z")
Access to tables a1 and a2 is on the same level (in parallel - i guess).
Maybe i have just wrong expectation to the output of the execution plan(?!)You guess wrong, there's nothing parallel going on here.
Execution plan is a tree of parent-child operations.
For example, the NESTED LOOP at operation 4 has two children @ 5 and 7.
Both of these operations- 5 & 7 - have a single child operation.
The execution tree starts with operation 6, using the TESTA2_PK index to identify rows where A2.X=100.
From this list of rowids, we go to the table TEST_A2 operation 5.
The rows from operation five feed into the NESTED LOOP - operation 4.
For each of these rows, we go to TEST_A1 via the index TEST_A1_PK for rows where A1.X=100.
This is really a cartesian join because there's no join condition between the two tables.
etc, etc, etc
Three things in particular to point out.
Firstly, that nothing joins to A2. So there will be a cartesian product - i.e. for every row in the result set between the joined tables A1, B, C and D, these will be multiplied by the number of rows returned by the the A2 rowsource.
Secondly, when everything has got one or zero rows (or the optimizer thinks that it's one or zero rows), you can get very different plans from when there are known/thought to be more rows.
Both depend on a1. So no need to execute one after the other (no inter-dependency).Thirdly, in terms of isolated join operations (ignoring A2 and C for the moment), A1 cannot join to B and D at the same time, you can either join A1 to B and then join the result of that to D, or join A1 to D then B, which is what you've got in your plan (well, actually we have A2 joined to A1 then the result of that joined to D and then the result of that to B).
Edited by: Dom Brooks on Jul 6, 2011 4:07 PM
Corrected typo -
Why optimizer prefers nested loop over hash join?
What do I look for if I want to find out why the server prefers a nested loop over hash join?
The server is 10.2.0.4.0.
The query is:
SELECT p.*
FROM t1 p, t2 d
WHERE d.emplid = p.id_psoft
AND p.flag_processed = 'N'
AND p.desc_pool = :b1
AND NOT d.name LIKE '%DUPLICATE%'
AND ROWNUM < 2tkprof output is:
Production
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 4 0
Execute 1 0.00 0.01 0 4 0 0
Fetch 1 228.83 223.48 0 4264533 0 1
total 3 228.84 223.50 0 4264537 4 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 108 (SANJEEV)
Rows Row Source Operation
1 COUNT STOPKEY (cr=4264533 pr=0 pw=0 time=223484076 us)
1 NESTED LOOPS (cr=4264533 pr=0 pw=0 time=223484031 us)
10401 TABLE ACCESS FULL T1 (cr=192 pr=0 pw=0 time=228969 us)
1 TABLE ACCESS FULL T2 (cr=4264341 pr=0 pw=0 time=223182508 us)Development
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 0 0
Execute 1 0.00 0.01 0 4 0 0
Fetch 1 0.05 0.03 0 512 0 1
total 3 0.06 0.06 0 516 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 113 (SANJEEV)
Rows Row Source Operation
1 COUNT STOPKEY (cr=512 pr=0 pw=0 time=38876 us)
1 HASH JOIN (cr=512 pr=0 pw=0 time=38846 us)
51 TABLE ACCESS FULL T2 (cr=492 pr=0 pw=0 time=30230 us)
861 TABLE ACCESS FULL T1 (cr=20 pr=0 pw=0 time=2746 us)sanjeevchauhan wrote:
What do I look for if I want to find out why the server prefers a nested loop over hash join?
The server is 10.2.0.4.0.
The query is:
SELECT p.*
FROM t1 p, t2 d
WHERE d.emplid = p.id_psoft
AND p.flag_processed = 'N'
AND p.desc_pool = :b1
AND NOT d.name LIKE '%DUPLICATE%'
AND ROWNUM < 2
You've got already some suggestions, but the most straightforward way is to run the unhinted statement in both environments and then force the join and access methods you would like to see using hints, in your case probably "USE_HASH(P D)" in your production environment and "FULL(P) FULL(D) USE_NL(P D)" in your development environment should be sufficient to see the costs and estimates returned by the optimizer when using the alternate access and join patterns.
This give you a first indication why the optimizer thinks that the chosen access path seems to be cheaper than the obviously less efficient plan selected in production.
As already mentioned by Hemant using bind variables complicates things a bit since EXPLAIN PLAN is not reliable due to bind variable peeking performed when executing the statement, but not when explaining.
Since you're already on 10g you can get the actual execution plan used for all four variants using DBMS_XPLAN.DISPLAY_CURSOR which tells you more than the TKPROF output in the "Row Source Operation" section regarding the estimates and costs assigned.
Of course the result of your whole exercise might be highly dependent on the actual bind variable value used.
By the way, your statement is questionable in principle since you're querying for the first row of an indeterministic result set. It's not deterministic since you've defined no particular order so depending on the way Oracle executes the statement and the physical storage of your data this query might return different results on different runs.
This is either an indication of a bad design (If the query is supposed to return exactly one row then you don't need the ROWNUM restriction) or an incorrect attempt of a Top 1 query which requires you to specify somehow an order, either by adding a ORDER BY to the statement and wrapping it into an inline view, or e.g. using some analytic functions that allow you specify a RANK by a defined ORDER.
This is an example of how a deterministic Top N query could look like:
SELECT
FROM
SELECT p.*
FROM t1 p, t2 d
WHERE d.emplid = p.id_psoft
AND p.flag_processed = 'N'
AND p.desc_pool = :b1
AND NOT d.name LIKE '%DUPLICATE%'
ORDER BY <order_criteria>
WHERE ROWNUM <= 1;Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Hi,
Both the querys are returning same results, but in my first query hash join and second query nested loop . How ? PLs explain
select *
from emp a,dept b
where a.deptno=b.deptno and b.deptno>20;
6 rows
Plan hash value: 4102772462
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 6 | 348 | 6 (17)| 00:00:01 |
|* 1 | HASH JOIN | | 6 | 348 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 3 | 60 | 2 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | PK_DEPT | 3 | | 1 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | EMP | 7 | 266 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - access("A"."DEPTNO"="B"."DEPTNO")
3 - access("B"."DEPTNO">20)
4 - filter("A"."DEPTNO">20)
select *
from emp a,dept b
where a.deptno=b.deptno and b.deptno=30;
6 rows
Plan hash value: 568005898
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5 | 290 | 4 (0)| 00:00:01 |
| 1 | NESTED LOOPS | | 5 | 290 | 4 (0)| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 1 | 20 | 1 (0)| 00:00:01 |
|* 3 | INDEX UNIQUE SCAN | PK_DEPT | 1 | | 0 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | EMP | 5 | 190 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - access("B"."DEPTNO"=30)
4 - filter("A"."DEPTNO"=30)Hi,
Unless specifically requested, Oracle picks the best execution plan based on estimates of table sizes, column selectivity and many other variables. Even though Oracle does its best to have the estimates as accurate as possible, they are frequently different, and in some cases quite different, from the actual values.
In the first query, Oracle estimated that the predicate “ b.deptno>20” would limit the number of records to 6, and based on that it decided the use Hash Join.
In the second query, Oracle estimated that the predicate “b.deptno=30” would limit the number of records to 5, and based on that it decided the use Nested Loops Join.
The fact that the actual number of records is the same is irrelevant because Oracle used the estimate, rather the actual number of records to pick the best plan.
HTH,
Iordan
Iotzov -
DECLARE @tableA table (Productid varchar(20),Product varchar(20),RateID int)
insert into @tableA values('1','Mobile',2);
insert into @tableA values('2','Chargers',4);
insert into @tableA values('3','Stand',6);
insert into @tableA values('4','Adapter',8);
insert into @tableA values('5','Cover',10);
insert into @tableA values('6','Protector',12);
--SELECT * FROM @tableA
DECLARE @tableB table (id varchar(20),RateID int,Rate int)
insert into @tableB values('1',2,200);
insert into @tableB values('2',4,40);
insert into @tableB values('3',6,60);
insert into @tableB values('4',8,80);
insert into @tableB values('5',10,10);
insert into @tableB values('6',12,15);
--SELECT * FROM @tableB
SELECT Product,Rate
FROM @tableA a
JOIN @tableB b ON a.RateID = b.RateID
Above is the sample query, where in execution plan it shows the Hash Match (inner Join). Now how do I change it to Nested Loop with out changing the query? help plzIs Hash Match(inner join) or Nested loop is better to have in the query?
That depends on the size of the tables, available indexes etc. The optimizer will (hopefully) make the best choice.
Above is the sample query, where in execution plan it shows the Hash Match (inner Join). Now how do I change it to Nested Loop with out changing the query?
The answer that you should leave that to the optimizer in most cases.
I see that the logical read for nested loop is higher than Hash Match.
But Hash Match tends to need more CPU. The best way to two compare two queries or plans is wallclock time.
On a big tables, how do we reduce the logical read?
Make sure that there are usable indexes.
Erland Sommarskog, SQL Server MVP, [email protected] -
I've been asked to check if HASH JOIN is more suitable than NESTED LOOP(which CBO chose by default) for the following query.
SELECT CM_DETAILS.TASK_ID FROM GEN_TYPE, CM_DETAILS WHERE ( ( ( ( ( CM_DETAILS.STAT_CODE < 8 ) AND ( GEN_TYPE.TASK_ID = CM_DETAILS.TASK_ID ) ) AND ( GEN_TYPE.DEST_LOCN_ID = 5 ) ) AND ( GEN_TYPE.COM_ID = 7 ) ) AND ( ( ( CM_DETAILS.CASE_NO = 1 ) OR ( CM_DETAILS.CASE_NO = 3 ) ) OR ( CM_DETAILS.CASE_NO = 9 ) ) )
Both GEN_TYPE and CM_DETAILS tables have over 330,000 rows.
Version: 10g R2
Any thoughts?As gintsp gave you very nice tip but there is initialization parameter " OPTIMIZER_INDEX_COST_ADJ" which cause what path to be chose for CBO,but usually expert says for changing init paramter setting should be at last resort.
It has default value of 100 which indicates to the CBO that indexed access is 100% as costly (i.e., equally costly) as FULL table scan access.
SQL> column plan_plus_exp format a100
SQL> set linesize 1000
SQL> SET AUTOTRACE TRACEONLY
SQL> SELECT e.ename,d.dname
2 FROM emp e,dept d
3 WHERE e.deptno=d.deptno
4 /
14 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=7 Card=10 Bytes=320)
1 0 HASH JOIN (Cost=7 Card=10 Bytes=320)
2 1 TABLE ACCESS (FULL) OF 'DEPT' (TABLE) (Cost=3 Card=5 Bytes=90)
3 1 TABLE ACCESS (FULL) OF 'EMP' (TABLE) (Cost=3 Card=14 Bytes=196)
Statistics
672 recursive calls
0 db block gets
151 consistent gets
27 physical reads
0 redo size
793 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
15 sorts (memory)
0 sorts (disk)
14 rows processed
SQL> /
14 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=7 Card=10 Bytes=320)
1 0 HASH JOIN (Cost=7 Card=10 Bytes=320)
2 1 TABLE ACCESS (FULL) OF 'DEPT' (TABLE) (Cost=3 Card=5 Bytes=90)
3 1 TABLE ACCESS (FULL) OF 'EMP' (TABLE) (Cost=3 Card=14 Bytes=196)
Statistics
0 recursive calls
0 db block gets
15 consistent gets
0 physical reads
0 redo size
793 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
14 rows processed
SQL> SHOW PARAMETER optimizer
NAME TYPE VALUE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.1.0
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100<--------
optimizer_mode string ALL_ROWS
SQL> ALTER SESSION SET optimizer_index_cost_adj=35
2 /
Session altered.
SQL> SELECT e.ename,d.dname
2 FROM emp e,dept d
3 WHERE e.deptno=d.deptno
4 /
14 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=10 Bytes=320)
1 0 MERGE JOIN (Cost=5 Card=10 Bytes=320)
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'DEPT' (TABLE) (Cost=1 Card=5 Bytes=90)
3 2 INDEX (FULL SCAN) OF 'DEPT_PRIMARY_KEY' (INDEX (UNIQUE)) (Cost=1 Card=5)
4 1 SORT (JOIN) (Cost=4 Card=14 Bytes=196)
5 4 TABLE ACCESS (FULL) OF 'EMP' (TABLE) (Cost=3 Card=14 Bytes=196)
Statistics
1 recursive calls
0 db block gets
11 consistent gets
1 physical reads
0 redo size
733 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
14 rows processed
SQL> /
14 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=10 Bytes=320)
1 0 MERGE JOIN (Cost=5 Card=10 Bytes=320)
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'DEPT' (TABLE) (Cost=1 Card=5 Bytes=90)
3 2 INDEX (FULL SCAN) OF 'DEPT_PRIMARY_KEY' (INDEX (UNIQUE)) (Cost=1 Card=5)
4 1 SORT (JOIN) (Cost=4 Card=14 Bytes=196)
5 4 TABLE ACCESS (FULL) OF 'EMP' (TABLE) (Cost=3 Card=14 Bytes=196)
Statistics
0 recursive calls
0 db block gets
11 consistent gets
0 physical reads
0 redo size
733 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
14 rows processedKhurram -
Oracle 11g - Nested loops on outer joins
Hello,
I have a select query that was working with no problems. The results are used to insert data into a temp table.
Recently, it would not complete executing. The explain plan shows a cartesian. But, there could be problems with using nested loops on the outer join. Interestingly, when I copy production code and rename the temp table and rename the view, it works.
Can someone take a look at the code and help. Maybe offer a suggestion on tuning too? Thanks.
CREATE TABLE "CT"
( "TN" VARCHAR2(30) NOT NULL ENABLE,
"COL_NAME" VARCHAR2(30) NOT NULL ENABLE,
"CDE" VARCHAR2(5) NOT NULL ENABLE,
"CDE_DESC" VARCHAR2(80) NOT NULL ENABLE,
"CDE_STAT" CHAR(1));
insert into CT (TN, COL_NAME, CDE, CDE_DESC, CDE_STAT)
values ('INDSD', 'STCD', 'U', 'RF', 'A');
insert into CT (TN, COL_NAME, CDE, CDE_DESC, CDE_STAT)
values ('AT', 'TCD', '001', 'RL', 'A');
insert into CT (TN, COL_NAME, CDE, CDE_DESC, CDE_STAT)
values ('AT', 'TCD', '033', 'PFR', 'A');
CREATE TABLE "IPP"
( "IND_ID" NUMBER(9,0) NOT NULL ENABLE,
"PLCD" VARCHAR2(5) NOT NULL ENABLE,
"CBCD" VARCHAR2(5));
insert into IPP (IND_ID, PLCD, CBCD)
values (2007, 'AS', '04');
insert into IPP (IND_ID, PLCD, CBCD)
values (797098, 'AS', '34');
insert into IPP (IND_ID, PLCD, CBCD)
values (797191, 'AS','04');
CREATE TABLE "INDS"
( "OPCD" VARCHAR2(5) NOT NULL ENABLE,
"IND_ID" NUMBER(9,0) NOT NULL ENABLE,
"IND_CID" NUMBER(*,0),
"GFLG" VARCHAR2(1),
"HHID" NUMBER(9,0),
"DOB" DATE,
"DOB_FLAG" VARCHAR2(1),
"VCD" VARCHAR2(5),
"VTDTE" DATE,
"VPPCD" VARCHAR2(4),
"VRCDTE" DATE NOT NULL ENABLE,
"VDSID" NUMBER(9,0),
"VTRANSID" NUMBER(12,0),
"VOWNCD" VARCHAR2(5),
"RCDTE" DATE,
"LRDTE" DATE
insert into INDS (OPCD, IND_ID, IND_CID, GFLG, HHID, DOB, DOB_FLAG, VCD, VTDTE, VPPCD, VRCDTE, VDSID, VTRANSID, VOWNCD, RCDTE, LRDTE)
values ('USST', 2007, 114522319, '', 304087673, to_date('01-01-1980', 'dd-mm-yyyy'), 'F', '2', to_date('06-04-2011 09:21:37', 'dd-mm-yyyy hh24:mi:ss'), '', to_date('06-04-2011 09:21:37', 'dd-mm-yyyy hh24:mi:ss'), 1500016, null, 'USST', to_date('06-04-2011 09:21:37', 'dd-mm-yyyy hh24:mi:ss'), to_date('18-07-2012 21:52:53', 'dd-mm-yyyy hh24:mi:ss'));
insert into INDS (OPCD, IND_ID, IND_CID, GFLG, HHID, DOB, DOB_FLAG, VCD, VTDTE, VPPCD, VRCDTE, VDSID, VTRANSID, VOWNCD, RCDTE, LRDTE)
values ('USST', 304087678, 115242519, '', 304087678, to_date('01-01-1984', 'dd-mm-yyyy'), 'F', '2', to_date('06-04-2011 09:21:39', 'dd-mm-yyyy hh24:mi:ss'), '', to_date('06-04-2011 09:21:39', 'dd-mm-yyyy hh24:mi:ss'), 1500016, null, 'USST', to_date('06-04-2011 09:21:39', 'dd-mm-yyyy hh24:mi:ss'), to_date('18-07-2012 21:52:53', 'dd-mm-yyyy hh24:mi:ss'));
CREATE TABLE "INDS_TYPE"
( "IND_ID" NUMBER(9,0) NOT NULL ENABLE,
"STCD" VARCHAR2(5) NOT NULL ENABLE);
insert into INDS_type (IND_ID, STCD)
values (2007, 'U');
insert into INDS_type (IND_ID, STCD)
values (313250322, 'U');
insert into INDS_type (IND_ID, STCD)
values (480058122, 'U');
CREATE TABLE "PLOP"
( "OPCD" VARCHAR2(5) NOT NULL ENABLE,
"PLCD" VARCHAR2(5) NOT NULL ENABLE,
"PPLF" VARCHAR2(1));
insert into PLOP (OPCD, PLCD, PPLF)
values ('USST', 'SP', 'Y');
insert into PLOP (OPCD, PLCD, PPLF)
values ('PMUSA', 'ST', '');
insert into PLOP (OPCD, PLCD, PPLF)
values ('USST', 'RC', '');
CREATE TABLE "IND_T"
( "OPCD" VARCHAR2(5) NOT NULL ENABLE,
"CID" NUMBER(9,0) NOT NULL ENABLE,
"CBCD" VARCHAR2(5),
"PF" VARCHAR2(1) NOT NULL ENABLE,
"DOB" DATE,
"VCD" VARCHAR2(5),
"VOCD" VARCHAR2(5),
"IND_CID" NUMBER,
"RCDTE" DATE NOT NULL ENABLE
insert into IND_T (OPCD, CID, CBCD,PF, DOB, VCD, VOCD, IND_CID, RCDTE)
values ('JMC', 2007, '04', 'F',to_date('11-10-1933', 'dd-mm-yyyy'), '2', 'PMUSA', 363004880, to_date('30-09-2009 04:31:34', 'dd-mm-yyyy hh24:mi:ss'));
insert into IND_T (OPCD, CID, CBCD,PF, DOB, VCD, VOCD, IND_CID, RCDTE)
values ('JMC', 2008, '04', 'N',to_date('01-01-1980', 'dd-mm-yyyy'), '2', 'PMUSA', 712606335, to_date('05-04-2013 19:36:05', 'dd-mm-yyyy hh24:mi:ss'));
CREATE TABLE "IC"
( "CID" NUMBER(9,0) NOT NULL ENABLE,
"CF" CHAR(1));
insert into IC (CID, CF)
values (2007, 'N');
insert into IC (CID, CF)
values (100, 'N');
insert into IC (CID, CF)
values (200, 'N');
CREATE OR REPLACE FORCE VIEW "INDSS_V" ("OPCD", "IND_ID", "IND_CID", "GFLG", "HHID", "DOB", "DOB_FLAG", "VCD", "VTDTE", "VPPCD", "VRCDTE", "VDSID", "VTRANSID", "VOWNCD", "RCDTE", "LRDTE") AS
SELECT DISTINCT a.OPCD, a.IND_ID, a.IND_CID, a.GFLG, a.HHID,
a.DOB, a.DOB_flag, a.VCD, a.VTDTE,
a.VPPCD, a.VRCDTE, a.VDSID, a.VTRANSID,
a.VOWNCD, a.RCDTE, a.LRDTE
FROM INDS a, INDS_type b
WHERE a.IND_ID = b.IND_ID
AND b.STCD in (select CDE
from CT --database link
where TN = 'INDSD'
and COL_NAME = 'STCD'
and CDE_STAT = 'A') ;
--insert /*+ parallel(IND_T,2) */ into IND_T
select /*+ parallel(a,4) */
a.OPCD as OPCD
, a.IND_ID as CID
, b.CBCD as CBCD
, NULL as BFCD
, 'N' as PF
, a.DOB as DOB
, a.VCD as VCD
, a.VOWNCD as VOCD
, a.IND_CID as IND_CID
, a.RCDTE as RCDTE
from INDSS_V a
, (select /*+ parallel(IPP,4) */ * from IPP IPP , PLOP PLO
where plo.PLCD = ipp.PLCD
and PPLF='Y') b
, IC c
where a.IND_ID = b.IND_ID (+)
and a.OPCD = b.OPCD (+)
and a.IND_ID = c.CID
and c.CF = 'N';Please consult
HOW TO: Post a SQL statement tuning request - template posting
Also format your code and post it using the [ code ] and [ /code ] tags. (Leave out the extra space after [ and before ])
Sybrand Bakker
Senior Oracle DBA
Edited by: sybrand_b on 10-apr-2013 17:57
Maybe you are looking for
-
Hello all- I am currently trying to configure group policy (specifically folder redirects) from a new Windows Server 2008 in my home... the server acts as both an AD DS and file server for 4 client computers, all running Windows Vista Ultimate. Here
-
Unable to add new WLC to the Mobility Group
Hi, Any help will be very welcome. I recently add a second CT5508 to the network, but when I tried to add the first 5508 to the mobilty group I received a message like this: "error in creating member" I've tried different mobility names, via GUI, via
-
Snapping cursor line to end of clips
I recently upgraded from 1.5 to 3 and for some reason by default the play line thing doesnt snap to the end of clips automatically. Does anyone know how to find the option that will allow that line, i dont know what its called, the line that scrolls
-
hi, i have problem with ub11b - with windows xp service pack my compuetr carsh to blue screen when i install last driver (2004-7-5) for ub11b. Please help, thx all. no260
-
Fail to pass parameters to subreports via VB6 application
Hi everybody, I'm a newbie here and I need to view a report (CR10) via a VB6 application where you enter the report's parameters. The report has subreports where its parameters are linked to the main report's ones. The application works properly on t