SQL EXTRACT FUNCTION

Hi,
In One of our tables, there are some invalid dates have been found the application is unable to show up those values.
I used the below query to get the row distribution.
SELECT EXTRACT(YEAR FROM X_EFF_DT) YEAR,COUNT(X_EFF_DT) "X_EFF_DT" FROM CDMST GROUP BY EXTRACT(YEAR FROM X_EFF_DT) ORDER BY "X_EFF_DT" DESC.
X_EFF_DT has some invalid date values in the Database.
The table has another column. CREATED which has the valid date values.
now, i want to extract the rows using CREATED to find the X_EFF_DT values based on Year.
Can some one give me a clue on how to do it.

id date is invalid then it will give you error
SQL> ed
Wrote file afiedt.buf
  1  select extract(year from sysdate),
  2         extract(month from sysdate)
  3*  from dual
SQL> /
EXTRACT(YEARFROMSYSDATE) EXTRACT(MONTHFROMSYSDATE)
                    2008                         3

Similar Messages

  • Problem with "&#34" using PL/SQL extract function ( XMLTYPE)

    Hi,
    When I use extract function (PL/SQL), it does not transform well "&#34". Insted of returning ' " ' , it returns ' &quot '.
    I know this works changing the code replacing xml.extract for SELECT extractvalue(xml,'//A/text()') into v from dual;
    But Is there another way to do this using PL/SQL? any patch, option..?
    Regards

    Hi,
    cursor proct is select * from proc22;
    cursor proct5 is select *from proc24;
    fetch proct into proctval;
    fetch proct5 into proctval5;
    if proct.symbol=proct5.symbolThat's strange to join two tables like this. You will have chance if you enter in your if condition.
    Why not create only one cursor with this join condition on the two tables ?
    re5:=re5/proctval.previousprice5;Furthermore, what do you make with r5 variable ? It seems nothing to do. Your proc does no much job.
    What do you want to achieve exactly ?
    Nicolas.

  • Problem using extract function (PL/SQL) with "&#34"

    Hi,
    When I use extract function (PL/SQL), it does not transform well "&#34". Insted of returning ' " ' , it returns ' &quot '.
    I know this works changing the code replacing xml.extract for SELECT extractvalue(xml,'//A/text()') into v from dual;
    But Is there another way to do this using PL/SQL? any patch, option..?
    Regards

    Had to use my website to demonstrate the code...
    As said, whatever I try here the code gets automatically converted...
    See for answer on your question: http://www.liberidu.com/blog/?p=635

  • 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)
    ;

  • Oracle.xdb.XMLType extract function

    I have an external java program that connect to the database using a thick connection so I can use the methods extract and existsNode available with the XMLType from oracle.xdb.XMLType.
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection(jdbc:oracle:oci8:@,"user","pwd");
    It works fine from the program. When I load the java function in the SQL database I use the default connection
    conn = DriverManager.getConnection("jdbc:default:connection:");
    and the extract function gives the error java.sql.SQLException.
    Is there a way to define the native connection as thin or thick because that was the error I was getting from the client program when I was using thin connection
    Thanks
    Mirette

    Please try and avoid duplicate posts...

  • 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

  • EXTRACT function and Chinese data

    Hi !
    I'm working with PL/SQL web applications, and I'm having trouble viewing it on a webpage when I use EXTRACT function for Chinese data.
    <abccompany> <department> &#20975;&#20262;·&#23041;&#24265;&#26031;&#26159;&#19968;&#23478;&#23567;&#22411;&#31038;&#21306;&#21046;&#33647;&#21378;&#30340;&#25152;&#26377;&#32773;&#65292;&#22905;&#27491;&#32771;&#34385;&#24320;&#22987;&#25552;&#20379;&#33647;&#26041;&#36882;&#36865;&#30340;&#26381;&#21153;&#65292;&#21516;&#26102;&#20063;&#24050;&#32463;&#23601;&#27492;&#20107;&#24449;&#27714;&#20102;&#20445;&#38505;&#19987;&#23478;&#40077;&#21187;·&#24067;&#26391;&#30340;&#24847;&#35265;&#12290;&#20975;&#20262;&#35810;&#38382;&#40077;&#21187;&#65292;&#38656;&#35201;&#36141;&#20080;&#21738;&#20123;&#20445;&#38505;&#12289;</department></abccompany>
    The Chinese xml data is stored as 'xmltype' in the Oracle database.
    1)
    When I run the below query, the output shown on a web page is upside down question marks like this
    select v.xtext.EXTRACT('/abccompany/department/text()').GetClobVal()
    into text
    from case_text v
    where case_identifier=inIdx;
    htp.print('<html><body>')
    htp.print(text);
    htp.print('</body></html>');
    2)
    However, the EXTRACT function works perfectly for English data.
    3)
    I also observed that, when I replace
    select v.xtext.EXTRACT('/abccompany/department/text()').GetClobVal()
    with
    to_clob(xtext)
    the web page displays the Chinese contents of the whole file and not just within the nodes <abccompany><department>.
    How can I make Extract function work with Chinese data ?
    Any help appreciated !
    -Sara

    Sara
    This normally happens when the client character set is not capable of showing chinese data. For instance on my laptop I cannot show the results of an extract() which returns chinese or japanese data in sqlplus (which cannot show chinese data on my machine) but I can in ISQL*PLUS which is web based and can show chinese data.
    THis might be a result of your NLS_LANG settings. The database translates from the database character set (I'm assuming AL32UTF8 in this case, into the client character set (as defined by NLS_LANG). Again if the characters cannot be converted this can cause this issue.

  • Using SQL/XML Functions or XSU to generate structured XML file.

    Hi,
    I have a view on a relational database I need to generate an XMLfile based on that view. I need to have below structure
    <Employees>
    <Employee A>
    <Employee info>
    </Employee info>
    < Contact info>
    <Address>
    </Address>
    </Contact info>
    </Employee>
    <Employee B>
    <Employee info>
    </Employee info>
    < Contact info>
    <Address>
    </Address>
    </Contact info>
    </Employee>
    </Employees>
    Also in the next step I need to read from XML file and transfer data to the Database.
    For this situation which way is the best one to generate XML file, using SQL/XML functions (XMLELEMENT, XMLAGG,... ) or using XSU?
    and which one is the best to extract data from XML file to Oracle database?
    Oracle DB version: 9.2.0.8.0
    SQL*Plus version: 10.2.0.1.0
    Thanks,
    Shiva

    I would do it from the database, but then again, I am a database / PL/SQL guy.
    IMHO the database will deliver you with more options. I don't know about "speed" between the two.

  • Logical Operations in SQL decode function ?

    Hi,
    Is it possible to do Logical Operations in SQL decode function
    like
    '>'
    '<'
    '>='
    '<='
    '<>'
    not in
    in
    not null
    is null
    eg...
    select col1 ,order_by,decode ( col1 , > 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , <> 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , not in (10,11,12) , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 ,is null , 0 , 1)
    from tab;
    Regards,
    infan
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:09 AM

    example:
    select col1 ,order_by,case when col1 > 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 &lt;&gt; 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 not in (10,11,12) then 0 else 1 end
    from tab;As for testing for null, decode handles that by default anyway so you can have decode or case easily..
    select col1 ,order_by,decode (col1, null , 0 , 1)
    from tab;
    select col1 ,order_by,case when col1 is null then 0 else 1 end
    from tab;

  • How to Passing clob to PL/SQL pipeline function

    I have a PL/SQL stored function which takes clob as input parameter and sends the results in a pipe line.
    create or replace function GetIds(p_list clob, p_del varchar2 := ',') return ideset_t pipelined is
    I am using ojdbc14.jar (Oracle 10g driver) with oracle 9i (9.2.0.1.0).
    I want to use the following SQL Query select * from table(GetIds(clob))
    Now the question is how can I pass the clob from JDBC?
    Here is my client code
    PreparedStatement stmt = con.prepareStatement("SELECT COLUMN_VALUE FROM TABLE(GETIDS(?, ','))");
    stmt.setCharacterStream(1, new StringReader(str), str.length());
    stmt.executeQuery();
    I get the following error when I try to run the program. The same thing works fine if the chracter lenght is less than some chaaracters.
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2960)
         at Test.main(Test.java:42)
    Exception in thread "main"
    The setChracterStream works for any insert/update clob. Example when I tried the query (INSERT INTO CLOB_TEST VALUES(?)) setCharacterStream just works fine.
    Please any one can help me how to solve this.
    Thanks in advance.

    Hóla LuÃs,
    when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
    In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
    When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
    The error message text can be specified in the validation definition, if I am not wrong.
    When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
    Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
    Hope it helps,
    Flavio

  • SQL query, function or SP for converting varbinary to image(.jpg format).

    Dear Sir/Mam
    I want SQL query, function or SP which converts binary data to image (.jpg format).
    I m able to convert image (.jpg format) to varbinary. But not able to convert vice versa.
    thanks in advance.

    Binary data is binary data - "image" is only an intrepretation of binary data.  Therefore your question makes little sense in the context of sql server since it does not have any facilities to utilize images.  Since you provide no context, I'm
    guessing that you are trying to retrieve an image stored in the database in a varbinary column and have your application use it as an image.  If so, you should post your question to a forum that is specific to your development environment.  

  • Query of queries disallows SQL right() function

    We're attempting to do a query of queries using the SQL
    right() function like this:
    select *
    from getresults
    where right([key],charindex('\',reverse([key]),1)-1) not in
    (#quotedvaluelist(getexcluded.file_name)#)
    We've even replaced that where clause with a much more simple
    where right([key])='m'
    just to make sure that it wasn't the nesting functions that
    were causing the problem.
    In either case, we get the error:
    Query of Queries syntax error.
    Encountered "right" at line 0, column 0. Incorrect
    conditional expression,
    Expected one of [like|null|between|in|comparison] condition,
    What SQL functions are disallowed from query of queries?
    Thanks,
    Kris

    Nasty stuff huh. Just happened to discover myself today that
    Left doesn't work. I'd suspect that Aggregate functions are the
    ONLY ones that will work. It would have been nice if they'd at
    least allowed CF vs DB functions in their own "database" language.
    BTW, also discovered that Count() returns Null rather than 0
    when there aren't any per your WHERE clause.

  • Extract function not working with tag attributes

    Hi all,
    I have an xml document stored in the db as an xmlType. I am trying to use the extract function to retrieve values. The extract will work fine on tags without attributes. Any tags with attributes or tags beyond the tags with attributes will not be accessible.
    <tag1>
    <tag2>hi</tag2>
    <tag3 att="hello">bye</tag3>
    <tag4> hi again </tag4>
    </tag1>
    In the example above I can extract tag2 values but not tag3 or tag4 values.
    here is my select statement
    works
    select e.xmlval.extract('/tag1/tag2').getStringval()
    from test_xml e;
    does not work
    select e.xmlval.extract('/tag1/tag2/tag3').getStringval()
    from test_xml e;
    does not work
    select e.xmlval.extract('/tag1/tag2/tag3/tag4').getStringval()
    from test_xml e;
    Any ideas?

    Hi all,
    Found the issue. The problem was that I was not specifying the second argument to the extract function.
    The tag attribute that I was not handling was xmlns="".
    I used this atttribute as the second argument in the extract function and now I am off and running.
    Hope this helps someone.
    Cheers

  • Incorrect syntax errors in sql server function. Please help.

    This is my sql server function:
    create function dbo.CleanTheStringAdv (@theString nvar
    char(500), @CleanMode as int) 
    returns nvarchar(500)  
    begin  
    --define variables
    declare @strAlphaNumeric nvarchar(500)  
    declare @i int
    declare @strChar nvarchar(500)
    declare @CleanedString nvarchar(500)
    --initiate values
    set @CleanedString =''  
    set @theString = @theString + ''
    SET @i = 1
    --Determine if we are looking for numeric values only or numbers and letters
    return case @CleanMode
       WHEN 1
       THEN @strAlphaNumeric = '0123456789'
       WHEN 2
       THEN @strAlphaNumeric = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
       WHEN 3
       THEN @strAlphaNumeric = '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
       else 0
     end 
    --Search through chars in the string passed to the function
        while (@i <= Len(@theString))
    begin
    @strChar = substring(@theString, @i, 1)
    If (charindex(@strAlphaNumeric, @strChar) <>0)
    --if the current char being reviewed is valid then add it to the new string
    begin
    @CleanedString = @CleanedString + @strChar
    end
    end
    return @CleanedString
    and below are the syntax errors I see when I press F5:
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 24
    Incorrect syntax near '='.
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 39
    Incorrect syntax near '@strChar'.
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 43
    Incorrect syntax near '@CleanedString'.
    Any help is highly appreciated.....

    Here is the full code for the function:
    create function dbo.CleanTheStringAdv (@theString nvarchar(500), @CleanMode as int)
    returns nvarchar(500)
    as
    begin
    --define variables
    declare @strAlphaNumeric nvarchar(500)
    declare @i int
    declare @strChar nvarchar(500)
    declare @CleanedString nvarchar(500)
    --initiate values
    set @CleanedString =''
    set @theString = @theString + ''
    SET @i = 1
    --Determine if we are looking for numeric values only or numbers and letters
    SET @strAlphaNumeric = case @CleanMode
    WHEN 1
    THEN '0123456789'
    WHEN 2
    THEN '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    WHEN 3
    THEN '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    else 0
    end
    --Search through chars in the string passed to the function
    while (@i <= Len(@theString))
    begin
    set @strChar = substring(@theString, @i, 1);
    If (charindex(@strAlphaNumeric, @strChar) <>0) --if the current char being reviewed is valid then add it to the new string
    begin
    SET @CleanedString = @CleanedString + @strChar;
    end
    END
    return @CleanedString;
    END

  • Problem with SQL Convert Function Junk Character

    Hi All,
    We have a database field that has a value of “2.020 OPERATOE’S CAB – GLASSES” on the front end of Oracle E-Business Suite. When we are spooling that column(in PLSQL) with the SQL covert function , one of the characters(’) in the string is not getting converted properly. It is displayed as a junk character in the spooled file.
    We used CONVERT(p_column,'WE8ISO8859P1','UTF8') for converting the string and utl_file api for spooling the output file. Please note that converted string is passed to utl_file.fopen directly.
    Following are the nls_parameters values.
    NLS_CHARACTERSET ~~ UTF8
    NLS_NCHAR_CHARACTERSET ~~ AL16UTF16
    Any inputs are welcome.
    Thanks
    gt1942

    Hello All,
    Sorry, If I am opening the blog in the wrong place as this is the first time.
    my out looks as follows.
    "02920  "
    but when i see in the application there is nuthing in the end.
    so I used regexp_replace(p_vendor_dtl,'[^[!-~]]*',''), But this is removing spaces also. I don't want to remove space. I want to remove this character only.
    Please help
    Thanks.

Maybe you are looking for

  • Satellite 1900-704 hard disk replacement

    Hi! I have problems with my hard disk, I think it's dying... So I want to replace it with a new one, but I don't know where the hard disk is located. Does anyone know where it is and if it is easy to remove? thank you ^_^

  • Integration with Apache 2.0?

    Is it possible to use Sun ONE App Server 7 with the latest Apache HHTP server release? The Release Notes state that only Apache 1.3 is supported...

  • Why do my photos duplicate every time my external hard drive is plugged in? iPhoto

    My photos are stored on my external hard drive and they duplicate every time I reconnect the EHD. Is there something in iPhoto preferences that will fix this?

  • Should I bother upgrading???

    Sup all... I got my G5 DC 2.0 almost a year ago now... I upgraded the memory with 2 X 512M chips and put a 300G hdd in it. Now, I am debating on whether I should get the wireless/bluetooth card to go in it and upgrade the hdd to a 10K RPM barracuda (

  • Invalid text

    Hi Can we pull invalid character while extracting material text in BW ? Regards