How to show multiple values for Unique records in Report

Here's my question/problem:
I've joined two tables, one table (TBL1) contains an object id (OBJ_ID) that repeats and the other table (TBL2) contains a date (DT), object type id (OBJ_TYP_ID), and object type description (OBJ_TYP_DES). The tables are joined by an inventory id (INV_ID).
The OBJ_ID repeats and has a Date value for each record. I want to report an unique OBJ_ID and show each Date for a particular OBJ_ID in multiple Columns.
An example of the current resultset looks like this:
OBJ_ID OBJ_TYP_ID OBJ_TYP_DES DATE
1 1 TYPE1 4/1/2009
2 1 TYPE1 4/1/2009
3 1 TYPE1 4/10/2009
1 2 TYPE2 5/3/2009
3 1 TYPE1 3/30/2005
4 1 TYPE1 4/1/2009
5 1 TYPE1 4/1/2009
5 2 TYPE2 5/1/2009
1 1 TYPE1 4/3/2007
1 1 TYPE1 3/30/2005
I want to express the resultset like this:
OBJ_ID OBJ_TYP_ID OBJ_TYPE_DES DATE1 DATE2 DATE3
1 1 TYPE1 4/1/2009 4/3/2007 3/30/2005
1 2 TYPE2 5/3/2009
2 1 TYPE1 4/1/2009
3 1 TYPE1 4/10/2009 3/30/2005
4 1 TYPE1 4/1/2009
5 1 TYPE1 4/1/2009
5 2 TYPE2 5/1/2009
What technique is best to use to do this? I know I could create another table and populate the rows/columns by reading data from this query, but is there a better way?

Hi,
cclemmons wrote:
I want to express the resultset like this:
OBJ_ID OBJ_TYP_ID OBJ_TYPE_DES DATE1 DATE2 DATE3
1 1 TYPE1 4/1/2009 4/3/2007 3/30/2005
1 2 TYPE2 5/3/2009
2 1 TYPE1 4/1/2009
3 1 TYPE1 4/10/2009 3/30/2005
4 1 TYPE1 4/1/2009
5 1 TYPE1 4/1/2009
5 2 TYPE2 5/1/2009
What technique is best to use to do this? I know I could create another table and populate the rows/columns by reading data from this query, but is there a better way?Absolutely! You seem to have an instictive feeling that creating a separate table just for a query is inefficient. You instinct is 100% correct. Maybe in Oracle 7 there was a reason to do that, but today you can query results of other queries as if they were tables, so temporary tables like you describe are very rarely necessary, let alone convenient.
What you want to do is pivot the date columns. Here's one way
WITH     original_query     AS
     SELECT  obj_id
     ,     obj_typ_id
     ,     obj_typ_des
     ,     dt          -- date is not a good column name
     FROM     ...          -- the rest of your original query goes here
,     got_rnum     AS
     SELECT     oq.*
     ,     ROW_NUMBER () OVER ( PARTITION BY  obj_id
                               ,                    obj_typ_id
                         ,             obj_typ_des
                         ORDER BY        dt     DESC
                       )         AS rnum
     FROM    original_query        oq
SELECT       obj_id
,       obj_typ_id
,       obj_typ_des
,       MAX (CASE WHEN rnum = 1 THEN dt END)     AS dt1
,       MAX (CASE WHEN rnum = 2 THEN dt END)     AS dt2
,       MAX (CASE WHEN rnum = 3 THEN dt END)     AS dt3
,       MAX (CASE WHEN rnum = 4 THEN dt END)     AS dt4
,       MAX (CASE WHEN rnum = 5 THEN dt END)     AS dt5
FROM       got_rnum
GROUP BY  obj_id
,       obj_typ_id
,       obj_typ_des
;As you can see, this adds two layers of queries on top of your original query. One of those layers is probably not needed; depending on what you're doing in your original main query, you can probably compute rnum there, and omit the got_rnum sub-query.
Also, depending on the relationship of obj_id, obj_typ_id and obj_typ_des, some of what I posted above may not be needed but including it won't really hurt.
If you want to know more about this technique, search for "pivot" or "rows to columns". A <tt>SELECT ... PIVOT ...</tt> keyword was introduced in Oracle 11, but most of what you'll find when you search for "pivot" doesn't assume you have Oracle 11 (nor does the query above require Oracle 11).
This assumes you know an upper limit (5 in the example above) of dts that can appear in any line of output.
See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3527823&#3527823] for a discussion of some alternatives.

Similar Messages

  • How to show multiple messages for a single exception

    hi
    Please consider this example application created using JDeveloper 11.1.1.3.0
    at http://www.consideringred.com/files/oracle/2010/MultipleMessagesExceptionApp-v0.01.zip
    It has a class extending DCErrorHandlerImpl configured as ErrorHandlerClass in DataBindings.cpx .
    Running the page and entering a value starting with "err" will result in an exception being thrown and multiple messages shown.
    See the screencast at http://screencast.com/t/zOmEOzP4jmQ
    To get multiple messages for a single exception the MyDCErrorHandler class is implemented like
    public class MyDCErrorHandler
      extends DCErrorHandlerImpl
      public MyDCErrorHandler()
        super(true);
      @Override
      public void reportException(DCBindingContainer pDCBindingContainer,
        Exception pException)
        if (pException instanceof JboException)
          Throwable vCause = pException.getCause();
          if (vCause instanceof MyMultiMessageException)
            reportMyMultiMessageException(pDCBindingContainer,
              (MyMultiMessageException)vCause);
            return;
        super.reportException(pDCBindingContainer, pException);
      public void reportMyMultiMessageException(DCBindingContainer pDCBindingContainer,
        MyMultiMessageException pException)
        String vMessage = pException.getMessage();
        reportException(pDCBindingContainer, new Exception(vMessage));
        List<String> vMessages = pException.getMessages();
        for (String vOneMessage : vMessages)
          reportException(pDCBindingContainer, new Exception(vOneMessage));
    }I wonder if calling reportException() multiple times is really the way to go here?
    question:
    - (q1) What would be the preferred use of the DCErrorHandlerImpl API to show multiple messages for a single exception?
    many thanks
    Jan Vervecken

    fyi
    Looks like using MultipleMessagesExceptionApp-v0.01.zip in JDeveloper 11.1.1.2.0 (11.1.1.2.36.55.36) results in a different behaviour compared to when used in JDeveloper 11.1.1.3.0 (11.1.1.3.37.56.60)
    see http://www.consideringred.com/files/oracle/img/2010/MultipleMessages-111130versus111120.png
    When using JDeveloper 11.1.1.2.0 each exception seems to result in two messages where there is only one message (as intended/expected) per exception when using JDeveloper 11.1.1.3.0 .
    (Could be somehow related to the question in forum thread "multiple callbacks to DCErrorHandlerImpl".)
    But, question (q1) remains and is still about JDeveloper 11.1.1.3.0 .
    regards
    Jan

  • How to passing multiple values for a parameter of discoverer(url parameters

    Hi All,
    I am trying to pass multiple values for a parameter of disco report. I am trying to include my url for discoverer viewer report. the values has the following
    'jeff,mark'
    'sfophiee,angela'
    Thanks and Regards
    Venkat

    Hello Venkat,
    I know there are some problems with 10.1.2.0.2, maybe if you haven't done yet you can try with 10.1.2.2, assuming this version should be working for multiple parameter values :
    OracleAS Discoverer 10.1.2.2 is installed with the following patch :
    Patch 4960210 PLACEHOLDER BUG FOR AS/DS 10G R2 PATCH SET 2 10.1.2.2
    So, once installed you can try adding your parameter as param_<parameter_name>='sfophiee,angela'
    Hope this helps, otherwise feel free to log a Service Request to Support.
    Best Regards,
    Gianluca

  • How to show default values for properties managed by UUP

    Is there a way to load default values of properties from an external source while
    associating a user with property sets managed by UUP ?
    We are trying to write a Custom User Profile using UUP so that some of the User
    Profile attributes can be stored using an existing Oracle database schema. But
    the values for some of these properties(Profile property set attributes) has to
    come from another table which already exist. So the idea is that when a new user
    is being associated with the Custom property set using Portal Admin Tool, the
    available values for an individual property has to be pulled from from a database
    table. Like when selecting a user's home city he can select the name of all cities
    already existing in a database table.
    I couldn't find a way to do this using the EntityPropertyManager. Anyone has
    any idea how to do this?
    Thomas.

    Hi Thomas,
    Yes, the UUP framework is flexible enough for you to easily load default
    values of properties from some external source. You can do this if you
    deploy your own UserProfileManager that uses a custom PropertySetManager.
    When UserProfileManager.getProperty() is called, it looks for the property
    for that user and then for the user's implicit and explicit successors
    (implicit = persisted for that property set, explicit = given as an argument
    in the method call)...if it doesn't find the property (gets null) then it
    does this:
    PropertySet set = getPropertySetManager().getPropertySet(
    getPropertySetType(), propertySet );
    if ( set != null )
    PropertyDefinition def =
    set.getPropertyDefinition( propertyName );
    if ( def != null )
    result = def.getDefaultValue();
    Check out the javadoc for the classes I have mentioned and check out the
    ejb-jar.xml depoyment descriptor for the UserProfileManager in usermgmt.jar:
    <!-- property set manager -->
    <ejb-ref>
    <ejb-ref-name>ejb/PropertySetManager</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.bea.p13n.property.PropertySetManagerHome</home>
    <remote>com.bea.p13n.property.PropertySetManager</remote>
    </ejb-ref>
    There are two options for deploying a UUP: 1) use the default
    UserProfileManager deployment with your custom EntityPropertyManager
    deployment, or 2) use your custom deployment of the UserProfileManager with
    your custom EPM deployment.
    In almost all cases, option 1) is done. However, in your case, you need to
    modify the behavior of the UserProfileManager so you must redeploy a
    custom-configured version. This means you will have to register a new
    ProfileType for your users with the DD for the UserManager EJB (because your
    special users don't use the default UserProfileManager) like this:
    <ejb-ref>
    <ejb-ref-name>ejb/ProfileType/WLCS_Customer</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.bea.commerce.ebusiness.customer.CustomerProfileManagerHome</home>
    <remote>com.bea.commerce.ebusiness.customer.CustomerProfileManager</remote>
    </ejb-ref>
    If you didn't need to retrieve the default values from your own data source,
    here is how you could get the default values using the default deployment of
    the UserProfileManager:
    * use the EBCC to create a property set (a.k.a "user profile") that matches
    your UUP property set name. Create the properties in this pset and the
    default values. When the UserProfileManager.getProperty() call fails to
    find the property value in your UUP (gets null) it will use the default
    PropertySetManager to get metadata about that property from the Portal
    schema (which you just set up using the EBCC) and it will return the default
    value that you set in the EBCC.
    I recommend you study the 2 options for deploying a UUP, especially the
    option for deploying a custom version of the UserProfileManager by checking
    out the sample UUP on dev2dev.bea.com and by looking at the Portal 4.0 docs.
    I don't know if the 7.0 docs have as much detail about this. Also, when you
    sit down to implement your custom PropertySetManager you may have to contact
    support for some of the details. For instance, how to instantiate a
    PropertySet.
    Ture Hoefner
    BEA Systems, Inc.
    www.bea.com
    "Thomas KJ" <[email protected]> wrote in message
    news:[email protected]...
    >
    Is there a way to load default values of properties from an externalsource while
    associating a user with property sets managed by UUP ?
    We are trying to write a Custom User Profile using UUP so that some of theUser
    Profile attributes can be stored using an existing Oracle database schema.But
    the values for some of these properties(Profile property set attributes)has to
    come from another table which already exist. So the idea is that when anew user
    is being associated with the Custom property set using Portal Admin Tool,the
    available values for an individual property has to be pulled from from adatabase
    table. Like when selecting a user's home city he can select the name ofall cities
    already existing in a database table.
    I couldn't find a way to do this using the EntityPropertyManager. Anyonehas
    any idea how to do this?
    Thomas.

  • OIM 9.x is showing multiple requests for unique request under pending appro

    Hi OIM Guru,
    We are using oim 9.x and seeing multilple entries for single request id under pending approval page.
    Support request id is 100 and once you go to pending approval page :-
    you will be able to multiple entries for request id 100. (Hope i am clear enough on this front.)
    any idea on this front ?
    What could be the possible reason for it?

    What is the BP that you are using? there is a bug related of this issue. Please update your OIM to latest BP and let me know.
    I hope this helps,
    Thiago Leoncio

  • List View Showing Multiple Entries for Certain Records

    I've been updating my large mp3 library with album art in order to make the list view more useful and fun to look at. With just a handful of records however I've noticed that they're getting split into multiple entries. For instance, Album X shows up twice, with one entry displaying only song 1 and the other entry displaying the rest of the songs.
    I've looked hard at the tags but I don't see any difference. All the records in question were ripped using iTunes so they're not coming from different sources either.
    Any thoughts would be hugely appreciated! Cheers.

    Thanks again; I tried the solution this morning and it fixes the problem. I've marked the thread as such. Unfortunately it's a lot of fiddly updating, but hey, it's better than no workaround at all.

  • How to get Multiple Values for a key from a session object?

    Hi,
    It might seem dumb but I am facing a problem here with the session object. I'll paste the session object's content from the netbeans "Local Variables" window for clarity -
    Name Type Value
    hsession StandardSessionFacade #66
    session LWSFSession #69
    inherited
    attributes Hashtable #80
    [0] Hashtable$Entry "cart"=>#115
    key String "cart"
    value DummyCart #115
    item null
    submit null
    v Vector
    [0] String Full Metal Jacket
    [1] String As Good As It Gets
    [2] String Tim
    What I want is to get the values "Full Metal Jacket", "As Good As It Gets" and "Tim" from the session obejct?
    The problem I am facing is that if I do a session.getAttribute("cart"), I'll get a single value in return. What will that value be? Will it be "item", "submit" or "v"? And if I want all the values in v above, how can I get them?
    Thanks.

    None of the above.
    HttpSession.getAttribute() will return what you put into it using HttpSession.setAttribute(). In your case, it'll return an Object which you need to cast to DummyCart. Then you can access the data in DummyCart using the API of the DummyCart class.
    hth

  • How to get Multiple Values for a single Variable in BPS.......

    Hi Gurus:
    I have a layout for planning, where I can plan for 5 days of the week. I also have a day column (yesterday) where I have the actual values. Users want to edit/foecast the next 5 days values. I am using a Variable to get the Date column which uses the System Date. However, since I am getting just one date in the Function Module (Code given below), the remaining days are greyed out and I can not enter the forecast values. I would like the same variable to get a series of dates in the same function module. What changes do I nee dto make in the ABAP code so that the remaining columns (Date) becaoe available for editing??
    The FM code I have to get "Today's Date" is as follows:
    FUNCTION ZCSHFL_GET_TODAY.
    ""Local Interface:
    *" IMPORTING
    *" REFERENCE(I_AREA) TYPE UPC_VAR-AREA
    *" REFERENCE(I_VARIABLE) TYPE UPC_Y_VARIABLE
    *" REFERENCE(I_CHANM) TYPE UPC_Y_CHANM
    *" REFERENCE(ITO_CHANM) TYPE UPC_YTO_CHA
    *" EXPORTING
    *" REFERENCE(ETO_CHARSEL) TYPE UPC_YTO_CHARSEL
    data: ls_charsel type upc_ys_charsel.
    ls_charsel-seqno = 1.
    ls_charsel-sign = 'I'.
    ls_charsel-opt = 'EQ'.
    ls_charsel-CHANM = I_chanm.
    ls_charsel-low = sy-datum.
    insert ls_Charsel into table eto_charsel.
    ENDFUNCTION.
    I want to get the Yestarday's Date as weel as dates for next 4 days from Today for this variable which are being used in the layout. Can anyone suggest the code tor this please.
    Thanks very much in advance......
    Best.... ShruMaa

    Hi,
    What I understand you need to return those dates from function module using parameter ETO_CHARSEL , right? If so just use this code:
    ls_charsel-seqno = 1.
    ls_charsel-sign = 'I'.
    ls_charsel-opt = 'BT'.  "we are giving ranges, so days between...
    ls_charsel-CHANM = I_chanm.
    ls_charsel-low = sy-datum - 1.  "...first day is yesterday
    ls_charsel-high = sy-datum + 4. "...and last day is 4 days from today
    insert ls_Charsel into table eto_charsel.
    This way you provide 5 days starting from yesterday till 4 days from today.
    Regards
    Marcin

  • How to pass multiple values from master to child report

    Hello,
    How would I pass multiple prompts from the master to child report? So for example, say I want to pass a 'Country' value along with a 'City' value
    Would it be?
    ="<a href=\"../../opendoc/openDocument.jsp?iDocID=ASQlgCemIOlEid1HHUlzyPs&sDocName=DocTest&sIDType=CUID&sType=wid&sWindow=Same&lsSCountry="+[Country]+"&lsSCity="+[City]+"\</a>"
    Thanks,
    Carter

    Carter,
    what is the syntax for this?
    It is exactly how you have posted in your original note.
    "&lsSCountry="+[Country]+"&lsSCity="[City]
    This will work providing the target report has a prompt called "Country" and another prompt called "City".  Note that your prompt and what you pass between the &lsS and the equal (=) must match exactly, otherwise OpenDocument will not communicate the prompt title to InfoView properly and InfoView will stop and execute the prompt to get the info it needs before running the report.  Have you tried what you've posted originally to see if it executes without a problem?
    Thanks,
    John

  • Multiple value variable - not showing Multiple values in the report

    Hi,
    I have careated a Multiple value variable for one of the characteristics in my Query. however, When i run the Query and select multiple values for the same, the report displays values for only the first selection.
    Could you help me resolve this ?
    Rgds
    Shweta

    Hello Shweta,
       Are you running the report in the Analyzer excel or Web?
    May be you can check the following:
    1. Use the latest FEP. It is working for me.
    2. May be the other values that you selected do not have corresponding keyfigures values. Hence it is showing only the first one.
    Try selecting other values ( except first one selected this time )
    Regards,
    Sheik Bilal

  • Multiple values for single field

    hi
    In order to upload Purchase order details, how you handle multiple values for a single field? 
          Eg: Item field may contain no. of values for a record

    Hi,
    It is generally taken care using BDC's by Table Control, and if you are using BAPI's then there are tables for ITEMS.
    Regards,
    Atish

  • Create URL with multiple values for one parameter

    Post Author: cbamberg
    CA Forum: General
    While I have no problems to create the URL to open a report with a single value for a parameter from my Java application, I don't know how to format multiple values for a parameter when I want to pass the "&prompt0=" value. The values I want to pass are numbers, not strings.
    Anyone can help?

    Hi gayatri,
    you need to select both the product id and custname.put a count on the prodid column and write a condition of count>1 and apply it.
    Thanks
    Hari

  • How to have a unique value for each record??

    could any 1 help me out in this...
    I want to have a column name 'Order No' which should be unique.
    How to generate a unique value for each record.??

    could any 1 help me out in this...
    I want to have a column name 'Order No' which should be unique.
    How to generate a unique value for each record.?? If you are using SQL PLUS to create the table try something like
    this:
    CREATE TABLE ORDER_TEST (
    ORD_NO NUMBER (8) NOT NULL PRIMARY KEY,
    ORDERDATE DATE,
    CUSTID NUMBER (8) NOT NULL,
    SHIPDATE DATE,
    TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
    (TOTAL >= 0),
    CONSTRAINT ORD_FOREIGN_KEY FOREIGN KEY (CUSTID) REFERENCES
    CUSTOMER (CUSTID),
    CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
    -- or a simpler table example
    DROP TABLE ORDER_TEST;
    CREATE TABLE ORDER_TEST (
    ORD_NO NUMBER (8),
    ORDERDATE DATE,
    CUSTID NUMBER (8) NOT NULL,
    SHIPDATE DATE,
    TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
    (TOTAL >= 0),
    CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
    note: ORD_NO can also be a primary key
    If you are doing the INSERT during runtime from a form first
    create a sequence in SQL PLUS to handle the ORD_NO value:
    Create SEQUENCE ORDERNO_UNIQUEVAL_sqnc
    START WITH 000001
    NOMAXVALUE
    NOCACHE;
    and reference it as the ORD_NO parameter in your INSERT
    statement:
    ORDERNO_UNIQUEVAL_sqnc.NEXTVAL
    note: to maintain data integrity you must use the sequence
    everytime you insert a new order to table. To start a new
    sequence drop the sequence and re-create it with whatever "START
    WITH" value you want.
    Hope this helps
    Kevin

  • How to show multiple records in JDeveloper automatically

    Hi, you guys,
    May I ask you how to show multiple records, say consecutive three records, of a View object in JDeveloper?
    I know that we can just drag and drop a view object as a child (Table) of a scrollPane.
    Are there any other approaches?
    Thanks a lot for your time.
    damon

    Thanks for your reply.
    You are right.
    Table binding is the best solution for that.
    But in my mind, a record in a table is always shown in one row (or one line), am I right?
    If so, it is not convient to show records with multitple columns.
    Let's say, there are 20 columns to show for each record. Then we should display a record in, say 3 lines.
    How can we do that?
    Are there any suggestions?
    I am thinking that maybe I can use secondary row set iterators for that since we can create two or more row set iterators for the same view object.
    Assume I want to show three consecutive records. I can use attribute binding to show the current record in three lines by dragging attributes one by one from Data Control Palette to Design Window as Child | TextField;
    But I do not know how to use a secondary row set iterator for the next record. Where shall I create a secondary row set ietrator such that I can use it to create and synchronize the bindings.
    Thanks a lot
    Damon
    Message was edited by:
    user599641

  • How to select XML value for a namespace when multiple namespaces

    Hi,
    I'm a beginner with this, but I'm doing well with your help from this forum in a recent post selecting out all the detail from my xml
    out into my oracle relational tables. Stumped, though, on how to select a value for xml tag value referenced by a defined namespace.
    Version, XML, what I want to select, and attempted sql is below. Thanks in advance!
    select * from V$VERSION
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for Solaris: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    drop table TRANSCRIPT;
    create table TRANSCRIPT (
    CONTENT xmltype
    <?xml version="1.0" encoding="UTF-8"?>
    <arb:AcademicRecordBatch xmlns:arb="urn:org:pesc:message:AcademicRecordBatch:v1.0.0">
      <hst:HighSchoolTranscript xmlns:hst="urn:org:pesc:message:HighSchoolTranscript:v1.0.0" xmlns:ct="http://ct.transcriptcenter.com">
       <TransmissionData>
          <DocumentID>2013-01-02T09:06:15|D123456789</DocumentID>
       </TransmissionData>
       <Student>
                <Person>
                    <Name>
                        <FirstName>John</FirstName>
                        <LastName>Doe</LastName>                   
                    </Name>
                </Person>
                <AcademicRecord> 
                    <AcademicSession>
                        <Course>
                            <CourseTitle>KEYBOARD 101</CourseTitle>
                            <UserDefinedExtensions>
                              <ct:TranscriptExtensions>
                                 <NCESCode>01001E010456</NCESCode>
                                 <CourseRigor>1</CourseRigor>
                              </ct:TranscriptExtensions>
                          </UserDefinedExtensions>
                        </Course>
                        <Course>
                            <CourseTitle>SCIENCE 101</CourseTitle>
                            <UserDefinedExtensions>
                              <ct:TranscriptExtensions>
                                 <NCESCode>01001E010457</NCESCode>
                                 <CourseRigor>2</CourseRigor>
                              </ct:TranscriptExtensions>
                          </UserDefinedExtensions>                       
                        </Course>
                    </AcademicSession>
                    <AcademicSession>
                        <Course>
                            <CourseTitle>MATH 201</CourseTitle>
                            <UserDefinedExtensions>
                              <ct:TranscriptExtensions>
                                 <NCESCode>01001E010458</NCESCode>
                                 <CourseRigor>2</CourseRigor>
                              </ct:TranscriptExtensions>
                          </UserDefinedExtensions>                                 
                        </Course>
                    </AcademicSession>
             </AcademicRecord>
       </Student>
      </hst:HighSchoolTranscript>
    </arb:AcademicRecordBatch>I want to be able to select the NESCODE associated to each coursetitle (01001E010456, 01001E010457, 01001E010458), with NESCode defined by namespace, but getting out NULL.
    DOCUMENTID     LASTNAME     COURSETITLE     NCESCODE
    2013-01-02T09:06:15|D123456789     Doe     KEYBOARD 101     
    2013-01-02T09:06:15|D123456789     Doe     SCIENCE 101     
    2013-01-02T09:06:15|D123456789     Doe     MATH 201     
    My SQL is below. You'll see where I commented out a couple failed alternatives too. Thanks again in advance for any guidance.
       select x0.DocumentID
             ,x1.LastName
             , x3.CourseTitle
             ,x3.NCESCode
      from TRANSCRIPT t
         , xmltable(                                                                                   
             xmlnamespaces(
               'urn:org:pesc:message:AcademicRecordBatch:v1.0.0' as "ns0"
             , 'urn:org:pesc:message:HighSchoolTranscript:v1.0.0' as "ns1"
            --, 'http://ct.transcriptcenter.com'                               as "ns1b" 
          , '/ns0:AcademicRecordBatch/ns1:HighSchoolTranscript' 
            passing t.content
            columns DocumentID       varchar2(40) path 'TransmissionData/DocumentID'
                       , Student xmltype      path 'Student'     
          ) x0
       , xmltable(
            '/Student'
            passing x0.Student
            columns LastName varchar2(20) path 'Person/Name/LastName'                       
                        ,AcademicRecord   xmltype      path 'AcademicRecord' 
          ) x1          
       , xmltable(
            '/AcademicRecord/AcademicSession' 
            passing x1.AcademicRecord
            columns GradeLevel varchar2(20) path 'StudentLevel/StudentLevelCode'
                  , Courses      xmltype      path 'Course'
          ) x2
              , xmltable(
              xmlnamespaces('http://ct.transcriptcenter.com'  as "ns2b")
              , '/Course'
            passing x2.Courses
            columns CourseTitle varchar2(40) path 'CourseTitle'
                         ,NCESCode  varchar2(20) path 'UserDefinedExtensions/ns2b:ct/NCESCode'
                         --,NCESCode  varchar2(20) path 'UserDefinedExtensions/ns2b:ct/TranscriptExtensions/NCESCode'                     
          ) x3
               

    <<I'm assuming there is more to your XML than you showed, since
    StudentLevel/StudentLevelCode
    is not in the XML, but is in your query. >>
    Yes, to simplify, I left out some of the additional XML data, which is typically present, sorry for any confusion. I should have removed those references to that data in my example which was failing to retrieve the NCESCode data which was denoted by that namespace.
    Thank you very much! Your correction worked. I was not understanding until your correction how to properly reference in the XPATH for that namespace value. I'm a newbie at this, and this is my second post. But I've been able to populate quite a few relational tables and that was the first of several namespace tags I will have to deal with next, and with that help, I should be good with that syntax now.
    Thanks again for your help on this.

Maybe you are looking for