Extract Function return NULL
Hello All,
I am new to XML so bear with me. I have a situation where I need to extract column field name from XML file stored in table column. I am trying to use extract function but getting NULL value from below SQL. In this case I am expecting to have list of all caption text listed. Please let me know what wrong I am doing below.
SELECT X.XML.EXTRACT('/report/criteria/columns/column/columnHeading/caption/text()').GETSTRINGVAL() FROM <Table_name>
XML File is stored in Column name XML in table
- <saw:report xmlns:saw="com.siebel.analytics.web/report/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlVersion="201008230" xmlns:sawx="com.siebel.analytics.web/expression/v1.1">
- <saw:criteria xsi:type="saw:simpleCriteria" subjectArea=""Study Execution"" withinHierarchy="true">
- <saw:columns>
- <saw:column xsi:type="saw:switchGroupColumn" columnID="c997a816d5ca37338">
- <saw:choices>
- <saw:choice>
- <saw:column xsi:type="saw:regularColumn" columnID="c8b17a7121096d3b2">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Study"."ICON Study No."</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="suppress" wrapText="true" interaction="action">
- <saw:actionLinks showPopupMenuForOneLink="false">
- <saw:actionLink actionLinkID="c8b17a7121096d3b2_ale3731f8d930e8604">
- <saw:action>
<saw:actionName>Deviations - Site Summary PM Dash Board</saw:actionName>
- <saw:parameters allowExtraParameters="true">
- <saw:parameter name="__navigateToBIContent__" type="string" mandatory="true" removable="true" order="999" multiValues="false">
<saw:prompt>__navigateToBIContent__</saw:prompt>
<saw:description />
</saw:parameter>
</saw:parameters>
- <saw:assignments>
- <saw:assign name="__navigateToBIContent__" fixed="true" hidden="true" parentFixed="false" parentHidden="false" xsi:type="saw:stringAssign">
<saw:value>/shared/Clinical Operations/Project Managment Dashboard/Quality Tab/Deviations - Site Summary PM Dash Board</saw:value>
</saw:assign>
</saw:assignments>
- <saw:implementation xsi:type="saw:ScriptActionType" executeOnClient="true">
<saw:functionName>__navigateToBIContent__</saw:functionName>
<saw:scriptLanguage>JScript</saw:scriptLanguage>
<saw:scriptPath />
</saw:implementation>
- <saw:clientImplementation>
<saw:customisation invokeConfirmation="false" />
</saw:clientImplementation>
</saw:action>
- <saw:linkText>
<saw:text>Deviation Site Summary</saw:text>
</saw:linkText>
</saw:actionLink>
</saw:actionLinks>
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec interaction="none" />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
</saw:choice>
- <saw:choice>
- <saw:column xsi:type="saw:regularColumn" columnID="cd77e27e7b33767de">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Geography"."Region"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="suppress" wrapText="true" interaction="action">
- <saw:actionLinks showPopupMenuForOneLink="false">
- <saw:actionLink actionLinkID="cd77e27e7b33767de_alad0f25191c60257b">
- <saw:action>
<saw:actionName>Deviations - Site Summary PM Dash Board</saw:actionName>
- <saw:parameters allowExtraParameters="true">
- <saw:parameter name="__navigateToBIContent__" type="string" mandatory="true" removable="true" order="999" multiValues="false">
<saw:prompt>__navigateToBIContent__</saw:prompt>
<saw:description />
</saw:parameter>
</saw:parameters>
- <saw:assignments>
- <saw:assign name="__navigateToBIContent__" fixed="true" hidden="true" parentFixed="false" parentHidden="false" xsi:type="saw:stringAssign">
<saw:value>/shared/Clinical Operations/Project Managment Dashboard/Quality Tab/Deviations - Site Summary PM Dash Board</saw:value>
</saw:assign>
</saw:assignments>
- <saw:implementation xsi:type="saw:ScriptActionType" executeOnClient="true">
<saw:functionName>__navigateToBIContent__</saw:functionName>
<saw:scriptLanguage>JScript</saw:scriptLanguage>
<saw:scriptPath />
</saw:implementation>
- <saw:clientImplementation>
<saw:customisation invokeConfirmation="false" />
</saw:clientImplementation>
</saw:action>
- <saw:linkText>
<saw:text>Deviation Site Summary</saw:text>
</saw:linkText>
</saw:actionLink>
</saw:actionLinks>
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
</saw:choice>
- <saw:choice>
- <saw:column xsi:type="saw:regularColumn" columnID="cb13030672571aad9">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Geography"."Country"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="suppress" wrapText="true" interaction="action">
- <saw:actionLinks showPopupMenuForOneLink="false">
- <saw:actionLink actionLinkID="cb13030672571aad9_al40e4484c67de09d6">
- <saw:action>
<saw:actionName>Deviations - Site Summary PM Dash Board</saw:actionName>
- <saw:parameters allowExtraParameters="true">
- <saw:parameter name="__navigateToBIContent__" type="string" mandatory="true" removable="true" order="999" multiValues="false">
<saw:prompt>__navigateToBIContent__</saw:prompt>
<saw:description />
</saw:parameter>
</saw:parameters>
- <saw:assignments>
- <saw:assign name="__navigateToBIContent__" fixed="true" hidden="true" parentFixed="false" parentHidden="false" xsi:type="saw:stringAssign">
<saw:value>/shared/Clinical Operations/Project Managment Dashboard/Quality Tab/Deviations - Site Summary PM Dash Board</saw:value>
</saw:assign>
</saw:assignments>
- <saw:implementation xsi:type="saw:ScriptActionType" executeOnClient="true">
<saw:functionName>__navigateToBIContent__</saw:functionName>
<saw:scriptLanguage>JScript</saw:scriptLanguage>
<saw:scriptPath />
</saw:implementation>
- <saw:clientImplementation>
<saw:customisation invokeConfirmation="false" />
</saw:clientImplementation>
</saw:action>
- <saw:linkText>
<saw:text>Deviation Site Summary</saw:text>
</saw:linkText>
</saw:actionLink>
</saw:actionLinks>
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec interaction="none" />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
</saw:choice>
</saw:choices>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cf5c435bd3d235724">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Study"."Sponsor Name"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cf48a34febca748ff">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Study"."Project Status"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="ce51ccb4c38ed538f">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Project Goverance"."Project Manager"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cf4bc5bea2531f3fe">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Study"."Indication"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="c430e05de61704a98">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Key Deviations"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cf658139b454c5a7f">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Non-Key Deviations"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="c1276c4cb2684ce42">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Key/Non-Key NA Deviations"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cea25118bedcf2772">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Site Life Cycle Metrics"."# of Sites Activated by Deviation"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
<saw:formatSpec suppress="repeat" wrapText="true" />
</saw:displayFormat>
- <saw:tableHeading>
- <saw:caption fmt="text">
<saw:text>Site Life Cycle Metrics</saw:text>
</saw:caption>
</saw:tableHeading>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
- <saw:caption fmt="text">
<saw:text># of Sites Activated</saw:text>
</saw:caption>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cae9b8f9cb7b8daba">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Key Deviations per Active Site"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="repeat" wrapText="true">
<saw:dataFormat minDigits="2" maxDigits="2" commas="true" negativeType="minus" xsi:type="saw:number" />
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cbb0790d62c120f67">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Site Life Cycle Metrics"."# of Sites Activated with FPS by Deviation"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
<saw:formatSpec suppress="repeat" wrapText="true" />
</saw:displayFormat>
- <saw:tableHeading>
- <saw:caption fmt="text">
<saw:text>Site Life Cycle Metrics</saw:text>
</saw:caption>
</saw:tableHeading>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
- <saw:caption fmt="text">
<saw:text># of Recruiting Sites (FPS)</saw:text>
</saw:caption>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cec29c1b67bd731bc">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Key Deviations per Recruiting Site (FPS)"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="repeat" wrapText="true">
<saw:dataFormat minDigits="2" maxDigits="2" commas="true" negativeType="minus" xsi:type="saw:number" />
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cf52f2d88d2e78ff9">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Subject Life Cycle Metrics"."# of Actual Subjects Randomized by Deviation"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
<saw:formatSpec suppress="repeat" wrapText="true" />
</saw:displayFormat>
- <saw:tableHeading>
- <saw:caption fmt="text">
<saw:text>Subject Life Cycle Metrics</saw:text>
</saw:caption>
</saw:tableHeading>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
- <saw:caption fmt="text">
<saw:text># of Actual Subjects Randomized</saw:text>
</saw:caption>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="c804cdbe82e3fa7f3">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Key Deviations per Rand Patient"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="repeat" wrapText="true">
<saw:dataFormat minDigits="2" maxDigits="2" commas="true" negativeType="minus" xsi:type="saw:number" />
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="ce344decda5f6fd83">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Total Waivers"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
<saw:formatSpec suppress="repeat" wrapText="true" />
</saw:displayFormat>
- <saw:tableHeading>
- <saw:caption fmt="text">
<saw:text>Deviation Metrics</saw:text>
</saw:caption>
</saw:tableHeading>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
- <saw:caption fmt="text">
<saw:text># Total Waivers</saw:text>
</saw:caption>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="c0d6921698af79211">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Inclusion/Exclusion Waivers"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cef66aab5dfc4449d">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"- Deviation Metrics"."# Other Waivers"</sawx:expr>
</saw:columnFormula>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="cb963b668b55786bb">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Deviation Level"."Deviation Level"</sawx:expr>
</saw:columnFormula>
- <saw:displayFormat>
- <saw:formatSpec suppress="repeat" wrapText="true" interaction="clientEvent">
<saw:clientEventSpec channel="Level" />
</saw:formatSpec>
</saw:displayFormat>
- <saw:columnHeading>
- <saw:displayFormat>
<saw:formatSpec interaction="none" />
</saw:displayFormat>
</saw:columnHeading>
</saw:column>
- <saw:column xsi:type="saw:regularColumn" columnID="c15b89d8487d41b29">
- <saw:columnFormula>
<sawx:expr xsi:type="sawx:sqlExpression">"Deviation"."Deviation Type"</sawx:expr>
</saw:columnFormula>
</saw:column>
</saw:columns>
- <saw:filter>
- <sawx:expr xsi:type="sawx:logical" op="and">
<sawx:expr xsi:type="sawx:savedFilter" path="/shared/Clinical Operations/_filters/Study Execution/PM Dashboard - Quality" name="PM Dashboard - Quality" />
- <sawx:expr op="prompted" xsi:type="sawx:special">
<sawx:expr xsi:type="sawx:sqlExpression">"Deviation Level"."Deviation Level"</sawx:expr>
</sawx:expr>
</sawx:expr>
</saw:filter>
</saw:criteria>
- <saw:views currentView="0">
- <saw:view xsi:type="saw:compoundView" name="compoundView!1">
- <saw:cvTable>
- <saw:cvRow>
- <saw:cvCell viewName="titleView!1">
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:cvCell>
</saw:cvRow>
- <saw:cvRow>
<saw:cvCell viewName="columnSelectorView!1" />
</saw:cvRow>
- <saw:cvRow>
- <saw:cvCell viewName="tableView!1">
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:cvCell>
</saw:cvRow>
- <saw:cvRow>
<saw:cvCell viewName="filtersView!1" />
</saw:cvRow>
</saw:cvTable>
</saw:view>
<saw:view xsi:type="saw:titleView" name="titleView!1" includeName="false" startedDisplay="dateTime" />
- <saw:view xsi:type="saw:tableView" name="tableView!1" clientEventChannels="MD1" clientEventEnabled="true">
- <saw:edges>
- <saw:edge axis="page" showColumnHeader="true">
- <saw:displayGrandTotals>
- <saw:displayGrandTotal id="t1" grandTotalPosition="none">
- <saw:memberFormat>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:memberFormat>
- <saw:dataBodyFormat>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:dataBodyFormat>
</saw:displayGrandTotal>
</saw:displayGrandTotals>
</saw:edge>
<saw:edge axis="section" />
- <saw:edge axis="row" showColumnHeader="true">
- <saw:displayGrandTotals>
<saw:displayGrandTotal id="t2" grandTotalPosition="after" />
</saw:displayGrandTotals>
- <saw:edgeLayers>
<saw:edgeLayer type="column" columnID="c997a816d5ca37338" />
<saw:edgeLayer type="column" columnID="c430e05de61704a98" />
<saw:edgeLayer type="column" columnID="cf658139b454c5a7f" />
<saw:edgeLayer type="column" columnID="c1276c4cb2684ce42" />
<saw:edgeLayer type="column" columnID="cea25118bedcf2772" />
<saw:edgeLayer type="column" columnID="cae9b8f9cb7b8daba" />
<saw:edgeLayer type="column" columnID="cbb0790d62c120f67" />
<saw:edgeLayer type="column" columnID="cec29c1b67bd731bc" />
<saw:edgeLayer type="column" columnID="cf52f2d88d2e78ff9" />
<saw:edgeLayer type="column" columnID="c804cdbe82e3fa7f3" />
- <saw:edgeLayer type="column" columnID="ce344decda5f6fd83">
- <saw:headerFormat>
- <saw:displayFormat>
<saw:formatSpec />
</saw:displayFormat>
</saw:headerFormat>
</saw:edgeLayer>
<saw:edgeLayer type="column" columnID="c0d6921698af79211" />
<saw:edgeLayer type="column" columnID="cef66aab5dfc4449d" />
</saw:edgeLayers>
</saw:edge>
<saw:edge axis="column" />
</saw:edges>
</saw:view>
- <saw:view xsi:type="saw:columnSelectorView" name="columnSelectorView!1" labelPosition="left" goButton="false">
- <saw:selector prompt="true" columnID="c997a816d5ca37338">
- <saw:label>
- <saw:caption>
<saw:text>Select Level</saw:text>
</saw:caption>
</saw:label>
</saw:selector>
</saw:view>
- <saw:view xsi:type="saw:dvtchart" name="dvtchart!1">
- <saw:display type="bar" subtype="default" renderFormat="default" mode="online" xAxisLiveScrolling="false" yAxisLiveScrolling="false" clientEventEnabled="false" animateOnDisplay="true">
<saw:style barStyle="default" lineStyle="default" scatterStyle="default" fillStyle="default" bubblePercentSize="100" effect="2d" />
</saw:display>
- <saw:canvasFormat height="330" width="750" showGradient="true">
<saw:dataLabels display="default" label="default" position="below" transparentBackground="true" valueAs="default" />
- <saw:title mode="custom">
- <saw:caption>
<saw:text>Severity vs Deviation Type</saw:text>
</saw:caption>
</saw:title>
- <saw:gridlines default="true">
- <saw:horizontal>
<saw:major visible="false" />
<saw:minor visible="false" />
</saw:horizontal>
- <saw:vertical>
<saw:major visible="false" />
<saw:minor visible="false" />
</saw:vertical>
</saw:gridlines>
</saw:canvasFormat>
- <saw:selections>
- <saw:categories>
- <saw:category>
<saw:columnRef columnID="c15b89d8487d41b29" />
</saw:category>
</saw:categories>
- <saw:measures showMeasureLabelsOnCategory="false">
- <saw:column measureType="y">
<saw:columnRef columnID="c430e05de61704a98" />
</saw:column>
- <saw:column measureType="y">
<saw:columnRef columnID="cf658139b454c5a7f" />
</saw:column>
- <saw:column measureType="y">
<saw:columnRef columnID="c1276c4cb2684ce42" />
</saw:column>
</saw:measures>
- <saw:seriesGenerators>
<saw:measureLabels />
</saw:seriesGenerators>
- <saw:page>
- <saw:column>
<saw:columnRef columnID="cb963b668b55786bb" />
</saw:column>
</saw:page>
<saw:sections displayAsSlider="false" />
</saw:selections>
- <saw:legendFormat position="default" transparentFill="true">
<saw:textFormat />
</saw:legendFormat>
- <saw:axesFormats syncAxis="false">
- <saw:axisFormat axis="Y1">
- <saw:title mode="custom">
- <saw:caption>
<saw:text>Severity</saw:text>
</saw:caption>
</saw:title>
<saw:labels />
<saw:textFormat />
<saw:scale scaleValues="auto" showMajorTicks="false" showMinorTicks="false" logarithmic="false" defaultTicks="true" />
</saw:axisFormat>
- <saw:axisFormat axis="X" displayScaleLabels="true">
- <saw:title mode="custom">
- <saw:caption>
<saw:text>Deviation Type</saw:text>
</saw:caption>
</saw:title>
<saw:labels rotate="15" rotateLabels="true" stagger="false" skip="false" abbreviation="default" />
<saw:textFormat />
<saw:scale scaleValues="auto" showMajorTicks="false" showMinorTicks="false" logarithmic="false" />
</saw:axisFormat>
</saw:axesFormats>
- <saw:pageEdgeState>
- <saw:QDR>
- <saw:staticMemberGroup>
- <saw:groupType>
<sawx:columnRefExpr columnID="cb963b668b55786bb" />
</saw:groupType>
- <saw:members xsi:type="saw:stringMembers">
<saw:value>Patient</saw:value>
</saw:members>
</saw:staticMemberGroup>
</saw:QDR>
- <saw:selectionGroups>
<saw:selectionGroup columnID="cb963b668b55786bb" groupID="0" />
</saw:selectionGroups>
</saw:pageEdgeState>
</saw:view>
<saw:view xsi:type="saw:filtersView" name="filtersView!1" />
</saw:views>
<saw:prompts scope="report" subjectArea=""Study Execution"" />
</saw:report>
Edited by: Dinesh Chauhan on Jan 19, 2012 4:34 AM
2) In reality I'll have another column defined in same table which will have same value as columnFormula (from xml file). I would need to extract caption from the XMLType and store in another column.OK, let's see if I understand correctly.
You want to extract the caption text from the column where the columnFormula contains the value in COL1?
If I'm correct, it's this one :
<sawx:expr xsi:type="sawx:sqlExpression">" Site Life Cycle Metrics"."# of Sites Activated with FPS by Deviation"</sawx:expr>Assuming there's a unique match, you can do :
SQL> SELECT XMLCast(
2 XMLQuery(
3 'declare default element namespace "com.siebel.analytics.web/report/v1.1"; (: :)
4 declare namespace x = "com.siebel.analytics.web/expression/v1.1"; (: :)
5 /report/criteria/columns/column[ora:contains(columnFormula/x:expr,$val)>0]/columnHeading/caption/text'
6 passing t.xml
7 , t.col1 as "val"
8 returning content
9 )
10 as varchar2(100)
11 ) as caption_text
12 FROM temp_xml t
13 ;
CAPTION_TEXT
# of Recruiting Sites (FPS)
If you want to update the same table, say COL2, you can do it directly like this :
UPDATE temp_xml t
SET t.col2 =
XMLCast(
XMLQuery(
'declare default element namespace "com.siebel.analytics.web/report/v1.1"; (: :)
declare namespace x = "com.siebel.analytics.web/expression/v1.1"; (: :)
/report/criteria/columns/column[ora:contains(columnFormula/x:expr,$val)>0]/columnHeading/caption/text'
passing t.xml
, t.col1 as "val"
returning content
as varchar2(100)
;
Similar Messages
-
Wanted: only attributes .extract() - function returns the complete node
Hi I have xml documents stored as XMLType, I would like to extract only the attributes of a node which I point to using a xPath expression. As a matter of fact the funcion .extract( some XPath) returns the corresponding node inclusive all children. This is very costly since I have large XML documents having a deep structure.
ThanksYour XPATH is incorrect
The XPATH you provided identifies the node with the attribute name = blah
The XPATH you want would end with /@*
See
http://www.w3c.org/TR/xpath#section-Location-Steps
eg
SQL> select extract(xml,'/Root/Element[@A1="FOO"]/@*')
2 from
3 (select xmltype(
4 '
5 <Root>
6 <Element A1="FOO" A2="BAA"/>
7 <Element A1="BAA" A2="FOO"/>
8 </Root>
9 ') xml
10 from dual
11 );
EXTRACT(XML,'/ROOT/ELEMENT[@A1="FOO"]/@*')
FOOBAA
Unfortunately, extract will return a concatenation of the value of the selected attributes -
Why Json get function returns null in jsp page??
Hi guys,
i have developed a simple program that send HTTPrequest and get json as response. now i want to display this json to Treeview but i have able to get the valid json, i create a json object and setData(json). still its ok. but when i do json.get("id"). i get null. it is not working for any of the key present in that json object. can some one help me?? below is the code i am using.
where sb is StringBuffer containt json in text form
System.out.println(sb);
JSONObject obj = new JSONObject();
obj.setData(sb);
System.out.println(obj.getData());
System.out.println(obj.get("id"));
thanks in advance...What is the data?
-
Function - Return More than One Value in a Concatenated String
Hi,
Is it possible for a function to return a concatenated string(combining more than one number). I am trying to return the PO number by inputting and invoice_id and code number but an invoice_id can have more than one PO with the same code number. I would like to concatenate the PO numbers with commas e.g.
10124, 10090, 10987
At the moment the function returns null for these cases that have more than one PO number.
ThanksAlso is is possible to create another function that can be called in the same script using the PO number as an IN parameter in SQL. See SQL below:
select cck.concatenated_segments as "Segment" ,
cc.code_combination_id,
NVL ( src . user_je_source_name , '**********' ) AS "Source" ,
NVL ( cat . user_je_category_name , '**********' ) AS "Category" ,
jel . period_name as "Period Name" ,
i.invoice_id as "Invoice ID",
s.vendor_name as "Vendor Name",
s.segment1 as "Supplier No",
jeb . name as "Batch Name" ,
func_get_po(i.invoice_id, cc.code_combination_id) "PO No",
jeh . name AS "Header Name" ,
jel . description AS "Description" ,
jel.accounted_dr AS "Debit" ,
jel.accounted_cr AS "Credit" ,
NVL(jel.accounted_dr, 0) - NVL(jel.accounted_cr, 0) AS "Net Amount"
FROM apps.gl_code_combinations cc ,
apps.gl_code_combinations_kfv cck,
apps.gl_je_lines jel ,
apps.gl_je_headers jeh ,
apps.gl_je_batches jeb ,
apps.gl_je_categories cat ,
apps.gl_je_sources src,
apps.gl_import_references r,
apps.xla_ae_lines al,
apps.xla_ae_headers ah,
apps.xla_events e,
xla.xla_transaction_entities te,
apps.ap_invoices_all i,
apps.ap_suppliers s
WHERE ( cck.concatenated_segments BETWEEN '23.83545.141.000.00.23.000.000' AND '23.83545.141.000.00.23.000.000'
AND cc.CHART_OF_ACCOUNTS_ID = 50328
AND jeh.LEDGER_ID IN
(select acc.ledger_id
FROM apps.gl_access_set_ledgers acc
WHERE acc.access_set_id = 1000
AND jel.code_combination_id = cc.code_combination_id
AND cck.code_combination_id = cc.code_combination_id
AND jel.status
|| '' = 'P'
AND ( jel.accounted_dr != 0
OR jel.accounted_cr != 0 )
AND jeh.je_header_id = jel.je_header_id
AND jeh.actual_flag = 'A'
AND 1 = 1
AND jeh.currency_code != 'STAT'
AND jeb.je_batch_id = jeh.je_batch_id
AND jeb.average_journal_flag = 'N'
and src.je_source_name = jeh.je_source
and cat.je_category_name = jeh.je_category
and r.je_header_id(+) = jel.je_header_id
and r.je_line_num(+) = jel.je_line_num)
AND ( :period_name = jel.period_name
and al.gl_sl_link_id(+) = r.gl_sl_link_id
and al.ae_header_id = ah.ae_header_id(+)
and al.application_id = ah.application_id(+)
and ah.application_id = e.application_id(+)
and ah.event_id = e.event_id(+)
and e.application_id = te.application_id(+)
and e.entity_id = te.entity_id(+)
and nvl(te.source_id_int_1,-99) = i.invoice_id(+)
and i.vendor_id = s.vendor_id(+) )
AND ( jel.ledger_id = 2041)
ORDER BY src.user_je_source_name ,
cat.user_je_category_name ,
jeb.name ,
jeh.name ,
cck.concatenated_segments ,
jel.je_line_num
I am using func_get_po(i.invoice_id, cc.code_combination_id), I would like to call another function in this script that uses the PO number as an IN parameter.
For example func_get_po_requester(i.invoice_id, cc.code_combination_id, func_get_po(i.invoice_id, cc.code_combination_id))
Would this work?
Thanks -
Page Validation - Function Returning Boolean - Check for NULL
I have 3 Page Validations which all fire on "When Button Pressed" = "Submit".
<br><br>
Number 1 is of type "Item specified is NOT NULL" for "P199_BUSINESS_UNIT1".
<br>
Number 2 is of type "Item specified is NOT NULL" for "P199_BUSINESS_UNIT2".
<br>
Number 3 is of type "Function Returning Boolean" and has the following code:
<br><br>
IF :P199_BUSINESS_UNIT1 IS NULL AND
:P199_BUSINESS_UNIT2 IS NULL THEN
RETURN FALSE ;
ELSE
RETURN TRUE ;
END IF ;<br>
When P199_BUSINESS_UNIT1 is NULL and P199_BUSINESS_UNIT2 is NOT NULL, I get the Error from Validation 1. Perfect.
<br>
When P199_BUSINESS_UNIT1 is NOT NULL and P199_BUSINESS_UNIT2 is NULL, I get the Error from Validation 2. Perfect.
<br>
When P199_BUSINESS_UNIT1 is NOT NULL and P199_BUSINESS_UNIT2 is NOT NULL, I don't get an Error Message. Perfect.
<br><br>
When P199_BUSINESS_UNIT1 is NULL and P199_BUSINESS_UNIT2 is NULL, I get Error Message 1 & 2, <strong>but nothing from 3.</strong>
<br><br>
If I change the code to:
<br><br>
IF :P199_BUSINESS_UNIT1 = '01' AND
:P199_BUSINESS_UNIT2 = '01' THEN
RETURN FALSE ;
ELSE
RETURN TRUE ;
END IF ;<br>
and change both values to '01', I get the appropriate Error Message.
<br><br>
What is going on? Is there some reason I can't check for NULL in a Function Returning Boolean?Scott,
<br><br>
Instead of adding the Validations, I changed my code from:
<br><br>
IF :P199_BUSINESS_UNIT1 IS NULL AND
:P199_BUSINESS_UNIT2 IS NULL THEN
RETURN FALSE ;
ELSE
RETURN TRUE ;
END IF ;
<br>to the following and got the desired results:
<br><br>
IF REPLACE(:P199_BUSINESS_UNIT1,<strong>'%null'</strong> || '%',NULL) IS NULL AND
REPLACE(:P199_BUSINESS_UNIT2,<strong>'%null'</strong> || '%',NULL) IS NULL THEN
RETURN FALSE ;
ELSE
RETURN TRUE ;
END IF ;<br>
Note that I changed the word REPLACE to upper case and the second occurrence of the word NULL to upper case to accentuate the fact that the '%null' is case sensitive, using "%NULL' does not work, it has to be "%null' in lower case.
<br><br>
<strong>Thanks for your help.</strong> -
how to get the Benefits Rate multiplier value in HCM extract ? used Extract rule type Fastfomula, but returns null.
Formula:
DEFAULT FOR BEN_ABR_NAME IS 'NA'
DEFAULT FOR l_rate_multiplier IS 'X'
L_BG_ID = GET_CONTEXT(BUSINESS_GROUP_ID, 1)
L_EFF_DATE = GET_CONTEXT(EFFECTIVE_DATE, to_date('1951/01/01 00:00:00'))
L_ABRT_ID = GET_CONTEXT(ACTY_BASE_RT_ID, 9999)
CHANGE_CONTEXTS(EFFECTIVE_DATE = L_EFF_DATE, BUSINESS_GROUP_ID = L_BG_ID, ACTY_BASE_RT_ID = L_ABRT_ID )
l_rate_multiplier = BEN_ABR_NAME
RETURN l_rate_multiplierI used DBI - BEN_ABR_NAME.
What is back end query ? can we use query to extract the value in Extracts ? -
GetTagFromIdentifierAndTitle returning nulls - function PreSaveItem
I'm attempting to add what should be a very straightforward date verification routine to a Sharepoint 2010 list. It's documented all over the web, but for some reason, I can't get it to work. The code is below:
<script language="javascript" type="text/javascript">
function PreSaveItem()
var date1 = getTagFromIdentifierAndTitle("input","DateTimeFieldDate","Start Date and Time");
var date2 = getTagFromIdentifierAndTitle("input","DateTimeFieldDate","End Date and Time");
var arrDate1 = date1.value.split("/");
var useDate1 = new Date(arrDate1[2], arrDate1[1]-1, arrDate1[0]);
var arrDate2 = date2.value.split("/");
var useDate2 = new Date(arrDate2[2], arrDate2[1]-1, arrDate2[0]);
if(useDate1 > useDate2)
alert("The End Date cannot happen earlier than the Start Date");
return false; // Cancel the item save process
return true; // OK to proceed with the save item
function getTagFromIdentifierAndTitle(tagName, identifier, title)
var len = identifier.length;
var tags = document.getElementsByTagName(tagName);
for (var i=0; i < tags.length; i++)
var tempString = tags[i].id;
if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len))
return tags[i];
return null;
}</script>
I've traced it via debug mode, and it hangs up when I'm trying to parse date1, which contains null values. I can't understand why it's not pulling the date from the NewForm screen.
To answer the obvious question; yes, I have selected dates on the NewForm screen.
Any help or debugging tips would be greatly appreciated.Hi,
The script works great in my environment, when start date is less than end date, a dialog will pop up for the warning message:
As you said, “it hangs up when I'm trying to parse date1”, I suggest you log out some information to the console of the browser to check that whether the “title” attribute
of the start date input control is “Start Date and Time” and whether the “date1” object holds the valid date value.
About Using the Console to view errors and debug in IE Developer Tools:
https://msdn.microsoft.com/en-us/library/ie/dn255006(v=vs.85).aspx
Thanks
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Select query having count function is returning null
Hi Everyone,
Please see the query and help me to get this solved.
DB version
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production"
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - ProductionQUERY
SELECT COUNT(*) as V_COUNT
FROM LAB_ORDER_TMPLT_TEST
WHERE TEST_ID IN
(SELECT WEST_TEST_ID
FROM TEST_CODE_CONVERSION TCC
WHERE TCC.EAST_TEST_ID = 2769)
GROUP BY LAB_ORDER_TMPLT_ID
HAVING COUNT(*) > 1;
It's returning null. Is there any way I can get the value as zero instead of null? Please help.Regards,
BS2012.Hi,
BS2012 wrote:
Hi Everyone,
Please see the query and help me to get this solved.
DB version
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
"CORE 10.2.0.1.0 Production"
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - ProductionQUERY
SELECT COUNT(*) as V_COUNT
FROM LAB_ORDER_TMPLT_TEST
WHERE TEST_ID IN
(SELECT WEST_TEST_ID
FROM TEST_CODE_CONVERSION TCC
WHERE TCC.EAST_TEST_ID = 2769)
GROUP BY LAB_ORDER_TMPLT_ID
HAVING COUNT(*) > 1;
It's returning null.
Really? COUNT never returns NULL; it always returns 0 or a positive integer.
Do you mean the query results in "no rows selected"?
Is there any way I can get the value as zero instead of null? Please help.Do you want a query that will produce the same output as the query above, but will produce a single row containing 0 when the query above does not produce anything? That sounds like a job for an outer join:
WITH original_query AS
SELECT COUNT(*) AS v_count
FROM lab_order_tmplt_test
WHERE test_id IN
( SELECT west_test_id
FROM test_code_conversion tcc
WHERE tcc.east_test_id = 2769
GROUP BY lab_order_tmplt_id
SELECT NVL (o.v_count, 0) AS v_count
FROM dual
LEFT OUTER JOIN original_query o ON o.v_count > 0
;If you'd care to post CREATE TABLE and INSERT statements for the sample data, then I could test this. -
How to pass parameter into extract function (for XMLTYPE)
I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
Query
SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
FROM PROBLEMXML j ,
XMLTABLE (
'/problem'
PASSING j.xml_column
COLUMNS probid VARCHAR (31) PATH '/problem/@id',
Def XMLTYPE PATH '/problem/Definitions') prob
where PROBLEM_ID =1;
returns exactly what I want a;m.
But
declare
my_var varchar2(2000) :=null;
n1 number;
n2 number;
begin
n1:=1;
n2:=2;
SELECT extract(prob.Def,'/Definitions/Definition[n1]/@var') || '|'|| extract(prob.Def,'/Definitions/Definition[n2]/@var') into my_var
FROM ETL_PROBLEMXML_STG_T j ,
XMLTABLE (
'/problem'
PASSING j.xml_column
COLUMNS probid VARCHAR (31) PATH '/problem/@id',
Def XMLTYPE PATH '/problem/Definitions') prob
where PROBLEM_ID =1;
dbms_output.put_line(my_var);
end;
returns NULL.
Is there is a way to pass parameter into extract function?I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
For example :
SQL> WITH etl_problemxml_stg_t AS (
2 SELECT 1 problem_id,
3 xmltype('<problem id="1">
4 <Definitions>
5 <Definition var="var1"></Definition>
6 <Definition var="var2"></Definition>
7 <Definition var="var3"></Definition>
8 </Definitions>
9 </problem>') xml_column
10 FROM dual
11 )
12 SELECT j.problem_id,
13 prob.probid,
14 prob.def
15 FROM etl_problemxml_stg_t j,
16 XMLTable(
17 'for $i in /problem
18 return element r
19 {
20 $i/@id,
21 element d { string-join($i/Definitions/Definition/@var, ";") }
22 }'
23 passing j.xml_column
24 columns
25 probid varchar2(30) path '@id',
26 def varchar2(100) path 'd'
27 ) prob
28 ;
PROBLEM_ID PROBID DEF
1 1 var1;var2;var3 -
SDO_CENTROID returning null
Hi,
I am having a few problems with SDO_Centroid returning null if I have a polygon and a point in one record. Is this expected and is there a way around it (if I do a MBR first and then sdo_centroid it works but is slow - it is accurate enought for my needs though).
thanks
ChrisChris2,
[1] For that function, the Oracle Docs say, +"The function returns a null value if geom1 is not a polygon, multipolygon, point, or point cluster, as identified by the SDO_GTYPE value in the SDO_GEOMETRY object"+. Your geometry is likely SDO_GTYPE 2004 (collection).
[2] Perhaps you could extract the polygon part and perform sdo_centroid on that.
-- "Assuming you always have 1 polygon and 1 point"
-- "AND assuming the polygon comes first (=1)"
SELECT SDO_GEOM.SDO_CENTROID(SDO_UTIL.EXTRACT(geometry, 1), 0.1) FROM MyTable;[3] So you have a collection comprised of a polygon and a point. Out of curiosity, where's the point with respect to the centroid?
[4] SpatialDB Advisor has some alternatives to sdo_centroid [url http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/75/multi-centroid-shootout]here and [url http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/75/multi-centroid-shootout]here. Scroll all the way down to the bottom of those pages to see an illustration of what those do.
Regards,
Noel -
Report- Pl/sql function returning sql query parsing page items as text?
Hi Team,
I am facing a strange issue .
I have four page items namely
1)JOB_CODE
2)MIN_EXP
3) MAX_EXP
4) SOURCES1
I have a report of the type "Pl/sql function returning sql query"
declare
v_sql varchar2(4000);
begin
if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
end if;
insert into query_list values (v_sql);
insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
return v_sql;
end;
Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
Now I select the data from the debug tables.
select unique(query) from query_list;
select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
select * from debug;
JOBCODE MINEX MAXEX SOURCE
21 1 10 donkeyHire
And if I run the query in sql I get some records returned
select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
V_CANDIDATE_ID V_FNAME V_CURRENT_EMPLOYER V_EXPERIENCE_YEARS
2 Vengu Andale Tech 4
But the record does not show up in the report!
does this type of report parse page items as text?
Why is it so?
Waiting for an early reply.
Thanks,
venkatVenkat - You don't want to put ':SOURCES1' in quotes like that.
Scott -
Get textFrame by label returns null and anchored objects
I have the following two functions:
function getByLabel(page, label)
for(var i=0; i < page.allPageItems.length; i++)
if( page.allPageItems[i].label == label )
return page.allPageItems[i];
and
Object.prototype.findItems = function(/*obj*/props)
if( !('everyItem' in this) )
throw new Error("Error: " + this + " is not a collection.");
var ret = this.everyItem().getElements(),
i = ret.length,
e, p;
while( i-- && e=ret[i] )
for( p in props )
if( (p in e) && e[p]===props[p] ) continue;
ret.splice(i,1);
return ret;
In my page structure, I got one main text frame (the content area) and two vertical text fromes on the sides of the page. There is also a small box textframe on top of the page. All these textboxes EXCEPT the main text frame are ALL "ANCHORED objects". I had to make them anchored objects, eitherwise after importing data, the boxes would jump around. (Example, the small box textframe that is on the top would get moved to the content area textframe etc). Not sure if using anchored objects is the proper way to fix this.
When I try to get the small box text frame, it does not work using the findItems (returns null) but it works fine with the getByLabel method. Why is that?
The calling syntax is:
for( i=0 ; i < doc.pages.length ; ++i )
var page = doc.pages.item(i);
var textFrame = getByLabel(page, 'lblSection' ); //This works
// var textFrame = page.textFrames.findItems({ label: 'lblSection' })[0]; This does not work, returns null
if( textFrame != null )
textFrame.parentStory.contents = "";(function () {
// Per the InDesign Scripting Guide, app.activeScript is only
// valid when a script is directly executed from InDesign, not
// from the ESTK, so a try/catch block is recommended to handle
// it.
var d;
try {
d = app.activeScript.parent.parent.fsName;
} catch (e) {
d = Folder.appPackage.parent.fsName+"/Scripts";
return d; -
GetDocumentBase returns null in Update 40
The change to make getCodeBase() and getDocumentBase() return null has broken our FindinSite-CD signed applet which is out in the field on many data CDs and similar, ie running locally. It doesn't provide any more security as our all-permissions applet can still access the same information (once it knows where it is). The trouble is, the CD may be run from anywhere so I do not know the absolute path in advance. I have found that I can add code so that JavaScript is used to pass the current URL as a PARAM to the APPLET. However this should not be necessary.
Can you provide a better fix that does not break all our existing users who update to Update 25 or 40?
I would be happy for our applet to have access restricted to its own directory or lower.
Or for an all-permissions applet, make getCodeBase() and getDocumentBase() return the correct values.
Please see the second link below for a further discussion.
Bug ID: JDK-8019177 getdocument base should behave the same as getcodebase for file applets
Oracle's Java Security Clusterfuck
PS There is a separate Firefox 23 issue stopping access to local Java applets - this should be fixed this week in version 24.
Chris Cant
PHD Computer Consultants Ltd
http://www.phdcc.com/fiscd/Our company uses the above FindinSite-CD software to provide search functionality on our data CDs and we have done so successfully for many years. These latest changes in Update 40 have now broken this vital component on our product and will cost us considerably in technical support time and replacing the discs when a fix comes out. Just an end user's perspective!
-
T1 (Table and columns & data ) used in my example
create table T1 (col1 number,col2 number);
col1 col2
1 5
2 5
3 5
4 5
11 6
12 6
13 6
14 6
CREATE OR REPLACE FUNCTION TEST (par NUMBER) RETURN VARCHAR2 IS
l_concat VARCHAR2(32767) ;
BEGIN
select wm_concat(col1) into l_concat from t1 where col2=par;
RETURN l_concat;
END;
select TEST(5) from dual;
The above example always returns a NULL as opposed to (1,2,3,4);
CREATE OR REPLACE FUNCTION TEST (par NUMBER) RETURN VARCHAR2 IS
l_concat VARCHAR2(32767) ;
l_str varchar2(32767);
BEGIN
l_str:='select wm_concat(col1) from t1 where col2=:b';
execute immediate l_str into l_concat using par;
RETURN l_concat;
END;
select TEST(5) from dual;
This returns the correct answer .i.e. (1,2,3,4);
My question is why my first code returning NULL? Is there any restriction using aggregate functions inside
plsql code ?BluShadow wrote:
The in paramter has the same name as one of the column . Thus the select query was not taking the filtering predicate as the in parameter col1 ,rather it was
using the column's value for filtering each row and hence the wm_concat was not getting any row to concatenate .That's why you should use a good coding standard and perhaps prefix parameters with "p" or "p_" and local variables with "v" or "v_" etc.Smacks too much of archaic Hungarian notation. :-)
Explicit scope definition is supported by PL/SQL. So why invent a new manual standard for scope, when there exists one already?
SQL> create or replace procedure FooProc( empNo emp.empno%Type ) is
2 empRow emp%RowType;
3 begin
4 select
5 e.* into empRow
6 from emp e
7 where e.empno = FooProc.empNo;
8
9 dbms_output.put_line(
10 'Employee '||empNo||' is '||empRow.ename||
11 ', and employed as '||empRow.job
12 );
13 end;
14 /
Procedure created.
SQL>
SQL>
SQL> exec FooProc(7369)
Employee 7369 is SMITH, and employed as CLERK
PL/SQL procedure successfully completed.
SQL> Personally, I find the v_ and p_ prefix approach quite silly - attempting to address an issue that is already solved by explicit PL/SQL scope.
Never mind that the approach of using different prefixes, attempts to identify scope - and goes down the exact same slippery scope that Hungarian notation did. Which resulted in the death of this misguided standard, many years ago.
Frustrates me to no end to see the exact SAME mistakes made in PL/SQL that were made a decade or more ago - where lessons learned since then are conveniently ignored when it comes to PL/SQL programming.
It is still seems to be the Dark Ages when it comes to PL/SQL development.... :-( -
In Portal, request.getparameter return NULL (Sample Monthcalendar)
I used the sample monthcalendar. When i used it without integrated in portal, i can change month by month with ">>" button.
In the JSP File, there is a call to the P_CALDATE parameter
String l_inputDate = request.getParameter("P_CALDATE"); // Input Date.
When i put this JSP file as an URL Portlet, i can't navigate month by month. the function request.getParameter("P_CALDATE") return NULL, but in the URL i have the parameter:
http://hddms220.cg63.fr/servlet/page?_pageid=54,58,56&_dad=portal30&_schema=PORTAL30&P_CALDATE=2002-05-01.
Someone have an idea
Thanks in advancedI have tested the sample with JSERV, and all works fine.
But if i wan't use OC4J/ORION to display a portlet how can i do it.
Thanks in advanced
Maybe you are looking for
-
I recently updated my Mac operating system and now regularly get the above message whenever I click on website pdf(s). I have tried to relaunch Adobe Reader - but nothing remotely resembling an end user license agreement ever shows up. I can find n
-
Possible to retrieve an '09 blog published on iWeb/MobileMe?
Argh. I published my family's travel blog a few years back using MobileMe (web.me.com/shwang), and stupidly forgot about it during the MobileMe/iCloud transition. Is there any way to retrieve the blog's contents, with or without comments?
-
Hi Gurus, I am having trouble with a specific purchase order on the MR11 transaction. I was able to post/clear/remove other purchase orders variances but this one gives me a warning/error message Perform the planned price change for material. Plea
-
LR 1.4 Virtual Copy Stopped Working...
or did it? What I usually do is click on the photo I want to make a virtual copy of, right click on the pic, click on 'create virtual copy' and--viola--virtual copy appears. Not this time! Now I get a grey slate screen and the message "no photo sele
-
Hi all, We have SCOM 2012 SP1 with two Management server ( MS1 and MS2) and one SQL server . While install Reporting server role in SQL server we gave MS1 name in Specify a Management server option. After installation report works fine in SCOM Report