Search the xml node by attributes and display the entire row

I am having a table with two columns say
school_name string type
student_notebookprice xmldata
how do i search with oracle query having student_id=102 and schoolname="abc_school" with notebook price 20, how do i get only one single row
abc_school,
<students>
     <student id="101">
     <notebookprice>12</notebookprice>
     </student>
     <student id="102">
          <notebookprice>20</notebookprice>
          <notebookprice>30</notebookprice>
          <notebookprice>40</notebookprice>
</student>
</students>
def_school,
<students>
     <student id="301">
     <notebookprice>10</notebookprice>
     </student>
     <student id="302">
          <notebookprice>15</notebookprice>
          <notebookprice>16</notebookprice>
</student>
</students>

yes . what i want based on search criteria i need to display that row . initially i have tried with the below query
SELECT school_name,
extractvalue(value(x), '//id') as student_id ,
extractValue(value(x), '//teacher') AS teacher
FROM school t ,
TABLE( XMLSequence( Extract(t.obj_xml, '/students/student[id=101 and teacher="abc"]'))) x
where existsNode(t.obj_xml, '/students/student[id=101 and teacher="abc"]') = 1
but when i want to add the second student in the search , i am failed to produce the second student information in the output and i can able to add it to where clause and but how to display the student info in the output . The xmltable option that u have specified looks good but what i fear is , it produce multiple combination with all the tags in the xml with the other columns in the table . will it cause any performence issue .
<students>
<student >
<id>101</id>
<teacher>abc</teacher>
</student>
<student >
<id>102</id>
<teacher>xyz</teacher>
<teacher>onp</teacher>
<teacher>rsm</teacher>
</student>
</students>
SELECT school_name,
extractvalue(value(x), '//id') as student_id ,
extractValue(value(x), '//teacher') AS teacher
FROM school t ,
TABLE( XMLSequence( Extract(t.obj_xml, '/students/student[id=101 and teacher="abc"]'))) x
where existsNode(t.obj_xml, '/students/student[id=101 and teacher="abc"]') = 1
and existsnode(t.obj_xml, '/students/student[id=102 and teacher="xyz"]') = 1

Similar Messages

  • How to retrieve xml file from BLOB and display on browser with css/xslt

    Hi All,
    I am new to xml. I am storing my xml file into BLOB in database. Now in my jsp page I want to retrieve this xml file from BLOB and display in HTML/CSS/XSLT form...
    Pl. guide me.. any docs..?? Logic...??
    Thanks in Advance.
    Sandeep Oza

    Hello Sandeep!
    I'm not familiar with jsp but logic should be as follows:
    -in jsp page instantiate XML parser
    -load specified BLOB into parser
    Now you may traverse the XML tree or you might load XSL file and use transform method to transform XML according to XSL file.
    I have an example where I'm selecting XML straight from relational database and then transform it using XSL into appropriate HTML output, but it's written in PSP.
    You can try http://www.w3schools.com/default.asp for basics on XML, CSS, XSL. It's easy to follow with good examples.
    Regards!
    miki

  • How to search the entire catalog

    Question: I've got loads of folders in my library, and they span over several pages on the Folders section in the Library module. But, when I want to search for a photo using the Library filter, I need to always first, move my mouse and click manually over the Folders section to the top Parent folder before I can do a search on the entire catalog.
    I was wondering how you go about searching the entire catalog, but with a quicker solution? I don't want to always have to find the most parent folder and click on it before I do a search across the entire library.
    Thanks in advance!

    shaibn wrote:
    Question: I've got loads of folders in my library, and they span over several pages on the Folders section in the Library module.
    Maybe time to think about re-organising folders into sub-folders?  I got into the same position, and then created folders for each year, so I don't see individual folders unless I want to:
    If you do that, remember to do it from inside Lightroom (just drag folders around) or Lightroom gets thoroughly confused. 

  • Can i search a document for text in column a to return the entire row if column a matches in a separate sheet?

    Can i search multiple sheets in a document for text in column a to return the entire row if column a matches in a
    separate sheet?

    Thank you, Barry. That was helpful, and am hopeful that what I want to do is possible.
    I am creating a spreadsheet that currently has 20 sheets, of which certain sheets have more than one table.  I will be adding more sheets.  I would like to return results for all occurences of the search string.  Preferably into a seperate spreadsheet.  It would be perfect if that seperate sheet updated whenever I update information in the first spreadsheet.  To give an example:
    Sheet:     baskets
         Tables:         straw
                             wire
    Sheet:      barware
         Tables:          glasses
                              decanters
                              coasters
    My tables all have the same titiels:
    Vendor      Description     Cost     Selling Price
    Since I will have upwards of 100 sheets, with multiple tables, and most of my vendors will fit into multiple sheet categories, it would be helpful if I could also see what my order will be from each vendor, not just who I will be ordering each item from.  How would I do that? 
    I hope I conveyed that properly. 
    Thank you in advance for your help,
    Rana

  • How can we pass the entire rows of a table to a web service in a VC model ?

    Hi,
    On the click of the submit button, I have to pass the rows of two tables into an enterprise service. This service also takes other fields of a form as an input.
    How can we pass the entire rows of a table into a service ?
    Regards,
    Nitin

    Hi Nitin,
    It seems that you have two or three different structures to pass data using your webservice. In your main question, two tables, you can join both in one table and from there call the webservice. In order to pass the entire table you need:
    1. Draw a line between your joinned table and your service,
    2. Map the fields,
    3. Create a 'SUBMIT' in your table tool bar. Right click on your table and choose 'Create Toobar', '+', name and choose 'Submit' as your event.
    4. Go to Configure Element (Table View) 'Multiple' at Selection Mode.
    Reward points if helps you to solve your question.
    Regards,
    Gilson Teixeira

  • How to return the entire row from a table

    Hi guys,
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100),
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    Now how can i return the entire row from table A with the datatype and its length.
    Any help would be appreciated ?
    Here is the query I wrote but it how to take the datatype and its length..
    create or replace procedure disp_table_data
    as
    type r_cursor is REF CURSOR;
    c_A r_cursor;
    er A%rowtype;
    begin
    open c_A for select * from A;
    loop
    fetch c_A into er;
    exit when c_A%notfound;
    dbms_output.put_line(er.FirstName||'--'||er.Age);
    end loop;
    close c_A;
    END;
    /

    Guys,
    I want column value from table A and its corresponding data_type and length from table B. I think I cant do it through joins.
    Any idea would be appreciated ?.
    Example ..
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100)
    insert into A values('John',24,'Boston');
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    insert into B values('FirstName','varchar2',10); -- this is coming from table A.
    Output should be like this...
    John,Varchar2,10
    Here (John is the FirstName - coming from table A, Varchar2 is a Datatype and 10 is the Length which are coming from table B ). Only column values are coming from table A , corresponding datatype and length are coming from B.
    Any idea would be appreciated ?
    Thanks.

  • Read a XML node value/attribute value from a CLOB

    Hello,
    I can write SQL/ - PL/SQL "straightforward" but now I have a problem what is to big for me.  I hop that someone can help.
    We create by code a xml structure and write these into the oracle database CLOB field. I'm sorry to say that a xml text structure is written into a clob in stead of a xmltype field. (it's a design failure?) It's a large xml structure. I believe I can't attach a file so I put at the end of this discussion a light example of the xml structure.
    It's a xml with quartervalue's, so there are 35040 detail rows (24h * 4 * 365days). I want to accumulate the the attribute Amount value 9. The amount value is in the Detail node a attribute but at the end you can see that for the DST are also 4 value's, but these are not attribute value's but node value's. (In this case it are four value's in some cases there is one DST amount value.
    Can somebody help me how to accumulate all the detail attribute value Amount with the node value Amount of the DST tag?
    XML structure:
    <?xml version="1.0"?>
    <Message xmlns:ns1="http://automaticdealcapture/">
        <BusinessDocument messageDateTime="2013-10-25T13:59:31+02:00" ediReference="LO-461967" messageName="New" businessSector="Z" documentFunction="Original">
            <DocumentData>
                <ns1:Adcs>
                    <ns1:Package>
                        <ns1:Deal>
                            <ns1:ProductCode>PWCODE</ns1:ProductCode>
                            <ns1:Action>NEW</ns1:Action>
                            <ns1:Memo1>MemoField</ns1:Memo1>
                            <ns1:Details>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="00:00:00" Timee="01:00:00" Amount="0.0153" Price="11.111"/>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="01:00:00" Timee="02:00:00" Amount="0.015" Price="22.222"/>
                                etc. 350040 detail rows.
                            </ns1:Details>
                            <ns1:DSTS>
                                <ns1:Year Val="2014">
                                    <ns1:DST Period="1">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="2">
                                        <ns1:Amount>0.0222</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="3">
                                        <ns1:Amount>0.0444</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="4">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                </ns1:Year>
                            </ns1:DSTS>
                        </ns1:Deal>
                    </ns1:Package>
                </ns1:Adcs>
            </DocumentData>
        </BusinessDocument>
    </Message>

    From what I know, extracting the "Amount" values in the Details section and the "Amount" values in the DSTS section would be two different SELECT statements.
    Both of these will use XMLTable() to extract the values.
    BTW - If you need more information on this, post up in the XML/XML DB forum section for more complex help.  (eg getting YEAR with the DSTS Amount values)
    as far as XML size goes, I've seen oracle handle a 100MB XML document without problems.
    (just understand, it will be 'slow')
    This one will give you the Amount values from the DSTS section:
    with xml_data as ( SELECT
    XMLType('<?xml version="1.0"?>
    <Message xmlns:ns1="http://automaticdealcapture/">
        <BusinessDocument messageDateTime="2013-10-25T13:59:31+02:00" ediReference="LO-461967" messageName="New" businessSector="Z" documentFunction="Original">
            <DocumentData>
                <ns1:Adcs>
                    <ns1:Package>
                        <ns1:Deal>
                            <ns1:ProductCode>PWCODE</ns1:ProductCode>
                            <ns1:Action>NEW</ns1:Action>
                            <ns1:Memo1>MemoField</ns1:Memo1>
                            <ns1:Details>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="00:00:00" Timee="01:00:00" Amount="0.0153" Price="11.111"/>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="01:00:00" Timee="02:00:00" Amount="0.015" Price="22.222"/>
                            </ns1:Details>
                            <ns1:DSTS>
                                <ns1:Year Val="2014">
                                    <ns1:DST Period="1">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="2">
                                        <ns1:Amount>0.0222</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="3">
                                        <ns1:Amount>0.0444</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="4">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                </ns1:Year>
                            </ns1:DSTS>
                        </ns1:Deal>
                    </ns1:Package>
                </ns1:Adcs>
            </DocumentData>
        </BusinessDocument>
    </Message>') as XMLDATA from dual
    select Y.amount
    from xml_data X,
      XMLTable(  XMLNAMESPACES( 'http://automaticdealcapture/' as "ns1"),
       '/Message/BusinessDocument/DocumentData/ns1:Adcs/ns1:Package/ns1:Deal/ns1:DSTS/ns1:Year/ns1:DST'
        passing X.XMLData
      COLUMNS
        amount Number PATH '/ns1:DST/ns1:Amount'
      ) Y;
    Replace the XMLTable() with the one below to get the Amount from the Details section:
      XMLTable(  XMLNAMESPACES( 'http://automaticdealcapture/' as "ns1"),
       '/Message/BusinessDocument/DocumentData/ns1:Adcs/ns1:Package/ns1:Deal/ns1:Details/ns1:Detail'
        passing X.XMLData
      COLUMNS
        amount number PATH '/ns1:Detail/@Amount'
      ) Y;

  • XML tag with attributes and one value via XSU

    I need to generate a XML structure with attributes in the opening tag, and just one value in the body, like this:
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">9.99</PRODUCT-LIST-PRICE>
    Without an object type, I can just create tags like this
    XML3
    <PRODUCT-LIST-PRICE>9.99</PRODUCT-LIST-PRICE>
    (with no attributes, but a single value) via the followig statement
    SELECT sys_xmlgen ('9.99',
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML3"
    FROM DUAL;
    Having an object "productlisteprice_type", defined by
    CREATE OR REPLACE TYPE productlisteprice_type AS OBJECT
    "@NET-PRICE" VARCHAR2(10),
    "@CURRENCY" VARCHAR2(10),
    "PRICE" VARCHAR2(20)
    I just get XML like this
    XML2
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">
    <PRICE>9.99</PRICE>
    </PRODUCT-LIST-PRICE>
    (with attributes, but no direct value beneath the "PRODUCT-LIST-PRICE" tag) via the following statement
    SELECT sys_xmlgen ( productlisteprice_type(0,'USD','9.99'),
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML2"
    FROM DUAL;
    Not what I need :-(
    Are there any possibilities in XSU to get the needed XML code? Or do I have to do some post-production via XSQL???
    Another question: Is it possible to use specific keywords like "online" as XML tagnames, via objects? The objects don't allow "online" as a field name...
    Thanks in advance,
    Holger

    I need to generate a XML structure with attributes in the opening tag, and just one value in the body, like this:
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">9.99</PRODUCT-LIST-PRICE>
    Without an object type, I can just create tags like this
    XML3
    <PRODUCT-LIST-PRICE>9.99</PRODUCT-LIST-PRICE>
    (with no attributes, but a single value) via the followig statement
    SELECT sys_xmlgen ('9.99',
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML3"
    FROM DUAL;
    Having an object "productlisteprice_type", defined by
    CREATE OR REPLACE TYPE productlisteprice_type AS OBJECT
    "@NET-PRICE" VARCHAR2(10),
    "@CURRENCY" VARCHAR2(10),
    "PRICE" VARCHAR2(20)
    I just get XML like this
    XML2
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">
    <PRICE>9.99</PRICE>
    </PRODUCT-LIST-PRICE>
    (with attributes, but no direct value beneath the "PRODUCT-LIST-PRICE" tag) via the following statement
    SELECT sys_xmlgen ( productlisteprice_type(0,'USD','9.99'),
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML2"
    FROM DUAL;
    Not what I need :-(
    Are there any possibilities in XSU to get the needed XML code? Or do I have to do some post-production via XSQL???
    Another question: Is it possible to use specific keywords like "online" as XML tagnames, via objects? The objects don't allow "online" as a field name...
    Thanks in advance,
    Holger

  • Rollup and Display Non Existing Rows

    This query produces the results except that I would like to have a final total and overal average (excluding the "No GPA"). Shown as XXX in the output sample. Can this be done in one query or do I need to union for the summary?
    Additionally, if possible, how can I write some statements so that rows that may not exist can be displayed on the output? Example: there are no GPAs in the range of 0.1 thru 0.9. My query results do not show the first two rows, however, the users would like to see these rows displayed regardless of the existence or not.
    GPARange            Count  Avg
    0.1 - 0.6  (F )            0      0.00
    0.7 - 0.9  (D-)            0      0.00
    1.0 - 1.2  (D )            1     
    1.3 - 1.6  (D+)            1    
    1.7 - 1.9  (C-)            4     
    2.0 - 2.2  (C )           20   
    2.3 - 2.6  (C+)           81
    2.7 - 2.9  (B-)          189
    3.0 - 3.2  (B )          387
    3.3 - 3.6  (B+)          452
    3.7 - 4.9  (A )          316
    NO GPA                   271
    TOTAL                   XXXX    X.XX
    SELECT academic_period,
           stu_population,
           College, 
            CASE
                WHEN ((MBA_GPA)) <= 0.6 then '0.1 - 0.6 (F )'
                WHEN ((MBA_GPA)) <= 0.9 then '0.7 - 0.9 (D-)'
                WHEN ((MBA_GPA)) <= 1.2 then '1.0 - 1.2 (D )'
                WHEN ((MBA_GPA)) <= 1.6 then '1.3 - 1.6 (D+)'
                WHEN ((MBA_GPA)) <= 1.9 then '1.7 - 1.9 (C-)'
                WHEN ((MBA_GPA)) <= 2.2 then '2.0 - 2.2 (C )'
                WHEN ((MBA_GPA)) <= 2.6 then '2.3 - 2.6 (C+)'
                WHEN ((MBA_GPA)) <= 2.9 then '2.7 - 2.9 (B-)'
                WHEN ((MBA_GPA)) <= 3.2 then '3.0 - 3.2 (B )'
                WHEN ((MBA_GPA)) <= 3.6 then '3.3 - 3.6 (B+)'
                WHEN ((MBA_GPA)) >  3.6 then '3.7 - 4.9 (A-)'
                WHEN ((MBA_GPA)) is null then 'No GPA'
            ELSE
                'What Happened'
           END as GPARange,
           count(id), round(avg(mba_gpa),2) AVG_GPA
    FROM gpa_stat
    where stu_population='F'
    and academic_period ='200940'
    GROUP BY  stu_population, 
              academic_period,
            CASE
                WHEN ((MBA_GPA)) <= 0.6 then '0.1 - 0.6 (F )'
                WHEN ((MBA_GPA)) <= 0.9 then '0.7 - 0.9 (D-)'
                WHEN ((MBA_GPA)) <= 1.2 then '1.0 - 1.2 (D )'
                WHEN ((MBA_GPA)) <= 1.6 then '1.3 - 1.6 (D+)'
                WHEN ((MBA_GPA)) <= 1.9 then '1.7 - 1.9 (C-)'
                WHEN ((MBA_GPA)) <= 2.2 then '2.0 - 2.2 (C )'
                WHEN ((MBA_GPA)) <= 2.6 then '2.3 - 2.6 (C+)'
                WHEN ((MBA_GPA)) <= 2.9 then '2.7 - 2.9 (B-)'
                WHEN ((MBA_GPA)) <= 3.2 then '3.0 - 3.2 (B )'
                WHEN ((MBA_GPA)) <= 3.6 then '3.3 - 3.6 (B+)'
                WHEN ((MBA_GPA)) >  3.6 then '3.7 - 4.9 (A-)'
                WHEN ((MBA_GPA)) is null then 'No GPA'
            ELSE
                'What Happened'
           END,
              rollup(college)
    order by 1, 2, 3, 4;

    Hi,
    user1069723 wrote:
    This query produces the results except that I would like to have a final total and overal average (excluding the "No GPA"). Shown as XXX in the output sample. Can this be done in one query or do I need to union for the summary?Yes, you can do that in one query, using ROLLUP. You don't need a UNION.
    Additionally, if possible, how can I write some statements so that rows that may not exist can be displayed on the output? Example: there are no GPAs in the range of 0.1 thru 0.9. My query results do not show the first two rows, however, the users would like to see these rows displayed regardless of the existence or not.That's exactly what outer joins do: they display data from one table with matching data from a second table, if any matching data is found. The data from the first table is displayed whether or not there is a match. If there is no match, all columns from the second table are NULL. If you want to treat those NULLs as 0's, use NVL, as I did when displayijng the average, below.
    In this problem, what is the first table, the table that has one row per grade range, and will be displayed even if no row in the result set falls into that grade range?
    You ought to have such a table. The information about where the ranges begin and end, what letter grades are associated with each, and so on, is data. Data belongs in tables, not hard-coded into queries. If, next year, they decide to change where the boundary between D+ and C- falls, or to add an A group, an authorized user can make the change to one table. No matter how many queries use grade ranges, no programmer will have to change any query.
    Here's how you might create such a table:
    CREATE TABLE     GPA_Range
    AS
    SELECT  0.0 AS low_gpa, 0.7 AS high_gpa, '0.1 - 0.6 (F)'  AS display_txt, 'F'  AS letter_txt     FROM dual     UNION ALL
    SELECT  0.7 AS low_gpa, 1.0 AS high_gpa, '0.7 - 0.9 (D-)' AS display_txt, 'D-' AS letter_txt     FROM dual     UNION ALL
    SELECT  1.0 AS low_gpa, 1.3 AS high_gpa, '1.0 - 1.2 (D)'  AS display_txt, 'D'  AS letter_txt     FROM dual     UNION ALL
    SELECT  1.3 AS low_gpa, 1.7 AS high_gpa, '1.3 - 1.6 (D+)' AS display_txt, 'D+' AS letter_txt     FROM dual     UNION ALL
    SELECT  1.7 AS low_gpa, 2.0 AS high_gpa, '1.7 - 1.9 (C-)' AS display_txt, 'C-' AS letter_txt     FROM dual     UNION ALL
    SELECT  2.0 AS low_gpa, 2.3 AS high_gpa, '2.0 - 2.2 (C)'  AS display_txt, 'C'  AS letter_txt     FROM dual     UNION ALL
    SELECT  2.3 AS low_gpa, 2.7 AS high_gpa, '2.3 - 2.6 (C+)' AS display_txt, 'C+' AS letter_txt     FROM dual     UNION ALL
    SELECT  2.7 AS low_gpa, 3.0 AS high_gpa, '2.7 - 2.9 (B-)' AS display_txt, 'B-' AS letter_txt     FROM dual     UNION ALL
    SELECT  3.0 AS low_gpa, 3.3 AS high_gpa, '3.0 - 3.2 (B)'  AS display_txt, 'B'  AS letter_txt     FROM dual     UNION ALL
    SELECT  3.3 AS low_gpa, 3.7 AS high_gpa, '3.3 - 3.6 (B+)' AS display_txt, 'B+' AS letter_txt     FROM dual     UNION ALL
    SELECT  3.7 AS low_gpa, 999 AS high_gpa, '3.7 - 4.9 (A-)' AS display_txt, 'A-' AS letter_txt     FROM dual     UNION ALL
    SELECT  NULL,            NULL,             'No GPA',                         NULL             FROM dual;As always, document everything, especially non-intuitive or potentially misleading things:
    COMMENT ON COLUMN gpa_range.low_gpa IS 'Lowest numerical grade inside this range.';
    COMMENT ON COLUMN gpa_range.low_gpa IS 'Lowest numerical grade in THE NEXT range.  This value is OUTSIDE of the range';You might prefer to assign impossible low_gpa and high_gpa values (like -2 and -1) to the 'No GPA' row. It's completely arbitrary, non-intutive and potentially confusing, but it would make joining easier.
    If you can't create such a table, you can use a sub-query almost identical to the CREATE TABLE statement above in every query that needs it.
    Here's the main query to do what you requested:
    WITH      interesting_gpa_stat     AS
         SELECT     college
         ,     mba_gpa
         FROM     gpa_stat
         WHERE     stu_population     = 'F'
         AND     academic_period     = '200940'
    ,     all_colleges     AS
         SELECT DISTINCT     college
         FROM             interesting_gpa_stat
    SELECT        c.college
    ,        r.display_txt           AS gparange
    ,        COUNT (s.college)             AS count
    ,        NVL ( AVG (s.mba_gpa)
                , 0
                )               AS avg
    FROM                all_colleges          c
    CROSS JOIN        gpa_range          r
    LEFT OUTER JOIN        interesting_gpa_stat     s     ON (     c.college     =  s.college
                                                AND     r.low_gpa     <= s.mba_gpa
                                              AND     r.high_gpa     >  s.mba_gpa
                                  OR (     c.college     =  s.college
                                     AND     r.low_gpa     IS NULL
                                           AND     s.mba_gpa     IS NULL
    GROUP BY  ROLLUP ( c.college
                      , r.display_txt
    ORDER BY  c.college
    ,            r.display_txtWithout any sample data and the results you want from that data, I had to make several assumptions.
    For example, I assumed you wanted to have several colleges in the same result set. For each college, there will be one row of output for every grade range in the gpa_range table, regardless of whether any matches are found in the gpa_stat table. It's okay if there happens to be only one college if the result set.
    The query includes a total for each college, and a grand total for the entire result set.
    Any filtering (such as stu_population='F') should be done in the interesting_gpa_stat sub-query. You could get by without this sub-query, but any filtering conditions that would be in the WHERE clause would have to be added to outer-join conditions.
    NULL values are ignored in all aggregate funcitons, so nothing special has to be done to keep rows in the 'No GPA' group from distorting the averages. The NVL function that presents 0 as the average when no grades were found in the other ranges always causes this average to apperar as 0 in the 'No GPA' rows, too. If you would prefer NULL in that column, then put the NVL inside a CASE expression.
    Edited by: Frank Kulash on Jun 28, 2009 5:03 AM

  • HT1692 My calendar search only goes back 12 months is there a way to search the entire calendar?

    My calendar search only goes back 12 months is there a way to extend this to the entire calendar?

    I wish.
    If you find out, let me know!

  • Referencing the entire row in an insert trigger

    I am trying to replace having to do the following sort of queries repeatedly by using a trigger to handle the second 2:
    My first query inserts a row and the following 2 queries insert a reference to that row into 2 other tables
    so I want to create a trigger which will insert the reference into the 2 other tables.
    my problem: how do I get this reference in the trigger? I know I can get individual values using :NEW.Column but I can't seem to figure out how to get the whole row.
    I can't select the row because its inside the trigger responding to it being inserted so I'd get that mutator error.

    Not sure why I sql*plus gives those errors. I get the same.
    When I tried to use
    print_obj(:new.object_value);
    heres the results
    SQL> CREATE OR REPLACE TRIGGER TR_BOOKING_INS AFTER INSERT ON BOOKING
    2 FOR EACH ROW
    3 DECLARE
    4 ecode NUMBER(38);
    5 thisproc CONSTANT VARCHAR2(50) := 'trap_errmesg';
    6
    7 BEGIN
    8 print_obj(:new.object_value);
    9 EXCEPTION
    10 WHEN OTHERS THEN
    11 ecode := SQLCODE;
    12 dbms_output.put_line(thisproc || ' - ' || ecode);
    13 dbms_output.put_line('fucking errors');
    14 END TR_BOOKING_INS;
    15 /
    Warning: Trigger created with compilation errors.
    SQL> show err
    Errors for TRIGGER TR_BOOKING_INS:
    LINE/COL ERROR
    6/5 PL/SQL: Statement ignored
    6/5 PLS-00201: identifier 'PRINT_OBJ' must be declared
    heres the results from 2 trigger attempts where I'm trying to do what I am wanting to do
    SQL> CREATE OR REPLACE TRIGGER TR_BOOKING_INS
    2 AFTER INSERT ON BOOKING
    3 FOR EACH ROW
    4 BEGIN
    5 INSERT INTO TABLE(SELECT G.BOOKED_FOR FROM GUEST G WHERE G.GUEST_NO = :
    NEW.GUEST_NO)
    6 VALUES (:new.object_value);
    7 EXCEPTION
    8 WHEN OTHERS THEN
    9 raise_application_error(-20001, 'Database Error');
    10 END TR_BOOKING_INS;
    11 /
    Warning: Trigger created with compilation errors.
    SQL> show err
    Errors for TRIGGER TR_BOOKING_INS:
    LINE/COL ERROR
    2/5 PL/SQL: SQL Statement ignored
    3/16 PL/SQL: ORA-00932: inconsistent datatypes: expected REF
    DANIEL.BOOKING_TY got DANIEL.BOOKING_TY
    SQL> CREATE OR REPLACE TRIGGER TR_BOOKING_INS
    2 AFTER INSERT ON BOOKING
    3 FOR EACH ROW
    4 BEGIN
    5 INSERT INTO TABLE(SELECT G.BOOKED_FOR FROM GUEST G WHERE G.GUEST_NO = :
    NEW.GUEST_NO)
    6 VALUES (REF(:new.object_value));
    7 EXCEPTION
    8 WHEN OTHERS THEN
    9 raise_application_error(-20001, 'Database Error');
    10 END TR_BOOKING_INS;
    11 /
    Warning: Trigger created with compilation errors.
    SQL> show err
    Errors for TRIGGER TR_BOOKING_INS:
    LINE/COL ERROR
    2/5 PL/SQL: SQL Statement ignored
    3/19 PL/SQL: ORA-01747: invalid user.table.column, table.column, or
    column specification
    SQL>

  • How to get a value from User's AD attribute and Display it on a SharePoint page ?

    Forum,
    We have a specific attribute in Active Directory for every single user. Meaning: In our Active Directory we have an attribute e.g. "UserType" and the value of this attribute is different from user to another.
    Requirement: I need to display the value of this attribute on the SharePoint page - How to do so?
    I don't think using the User Profile properties is the way to go. So, Could you please guide me on how to use C# or JavaScript to retrieve the value from AD attribute of each user and show it on the SharePoint site?
    Thanks for your inputs !

    Using C# or javascript to authenticate the user to AD to read the property directly will be very difficult. Creating a custom user profile property and adding a sync from AD to that property is definitely the easiest way to do what you are describing.
     Once its in User Profiles there are lots of samples on how to add it to the page.  
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Inserting XML files with attribute and frontslash(/) in database

    Hi,
    I want to get and insert the data from XML file into database. Below is the XML file:
    <bne:document xmlns:bne="http://www.oracle.com/bne" bne:apiVersion="1.0">
         <bne:workspace>
              <bne:layout id="242:AMW_PROC_UPLOAD">
                   <header><line/>
                   </header>
              </bne:layout>
         </bne:workspace>
         <bne:collection id="collection_1">
              <bne:data bne:id="data_1" bne:integrator="242:AMW_PROCESS_IMPORT_INTG" bne:layout="242:AMW_PROC_UPLOAD" bne:date_format="yyyy-MM-dd" bne:validation="full" bne:recreate="TRUE" bne:columns_mapped="FALSE" bne:nls_numeric_characters=".,">
                   <header AMW_PROCESSES_INTERFACE.HEADER_PARENT_PROCESS_ID="All Processes">
                   <line bne:IDX="1"
    AMW_PROCESSES_INTERFACE.PROCESS_DISPLAY_NAME="Process test 1" AMW_PROCESSES_INTERFACE.SIGNIFICANT_PROCESS_FLAG="Yes"
    AMW_PROCESSES_INTERFACE.REVISE_PROCESS_FLAG="N"
    AMW_PROCESSES_INTERFACE.PROCESS_CATEGORY="Routine"
    AMW_PROCESSES_INTERFACE.APPROVAL_STATUS="Approved"
    AMW_PROCESSES_INTERFACE.STANDARD_PROCESS_FLAG="Yes"
    AMW_PROCESSES_INTERFACE.PROCESS_OWNER_ID=""
    AMW_PROCESSES_INTERFACE.FINANCE_OWNER_ID=""
    AMW_PROCESSES_INTERFACE.APPLICATION_OWNER_ID=""
    AMW_PROCESSES_INTERFACE.PARENT_PROCESS_NAME=""/>
                   </header>
              </bne:data>
         </bne:collection>
    </bne:document>
    and the table structure is:
    12:53:58 SQL> desc bne
    Name Null? Type
    HEADER_PARENT_PROCESS_ID VARCHAR2(80)
    PROCESS_DISPLAY_NAME VARCHAR2(80)
    SIGNIFICANT_PROCESS_FLAG VARCHAR2(3)
    REVISE_PROCESS_FLAG VARCHAR2(1)
    PROCESS_CATEGORY VARCHAR2(30)
    APPROVAL_STATUS VARCHAR2(30)
    STANDARD_PROCESS_FLAG VARCHAR2(3)
    PROCESS_OWNER_ID VARCHAR2(80)
    FINANCE_OWNER_ID VARCHAR2(80)
    APPLICATION_OWNER_ID VARCHAR2(80)
    PARENT_PROCESS_NAME VARCHAR2(80)
    So I want specific attribute values to be inserted into this table. I know the way to insert the simple XML document into database by using DBMS_XMLSave methods, but in this case I need to extract specific attribute values. I have learned that in order to use XML SQL Utility to "auto-load" XML into relational tables, I have to transform this XML file into Oracle's "canonical XML format" perhaps by using XSLT, not sure.
    Can someone please advise the correct way to accomplish above thing.
    Thanks in Advance.
    Manoj

    Great detective work. It's odd how that click-to-call extension creates such random issues...

  • Change XSD / XML dataset during runtime and display texts in field explorer

    Hi there,
    I am changing the datasource of a report during runtime. Afterwards, I would like to change the texts of the fields appearing in the field explorer.
    I tried:
    CrystalDecisions.ReportAppServer.DataDefModel.XMLDataSetClass xmlDS =
    new CrystalDecisions.ReportAppServer.DataDefModel.XMLDataSetClass();
    byte[] xmlContent = reportContent.getXmlContent();
    byte[] xsdContent = reportContent.getXsdContent();
    CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray xmlData =
    new CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray();
    CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray xsdData =
    new CrystalDecisions.ReportAppServer.CommonObjectModel.ByteArray();
    xmlData.ByteArray = xmlContent;
    xmlDS.XMLData = xmlData;
    xsdData.ByteArray = xsdContent;
    xmlDS.XMLSchema = xsdData;
    rasDoc.DatabaseController.SetDataSource(xmlDS, "", "");
    rasDoc.Database.Tables[0].Description = "POMMES";
    for (int i = 0; i < rasDoc.DatabaseController.Database.Tables[0].DataFields.Count; i++)
    rasDoc.Database.Tables[0].DataFields.Name = "TEST";
    MessageBox.Show(rasDoc.Database.Tables[0].DataFields.Name);
    rasDoc.Database.Tables[0].DataFields.HeadingText = "HOORAY";
    rasDoc.Database.Tables[0].DataFields.Description = "NOPE";
    MessageBox.Show(rasDoc.Database.Tables[0].DataFields.Description);
    MessageBox.Show(rasDoc.Database.Tables[0].DataFields.HeadingText);
    When running this, the message boxes include the right strings I set before but when this is done, the filed explorer still shows no changes. What am I doing wrong?
    Also, I would like to change the field texts that are displayed in the field explorer. How can this be done?
    Thanks,
    Pascal

    Also, I do not understand why I am not able to change the display of the fields in the filed explorer.
    This coding does not change a bit, but why??
    //preparation
    string tableName = reportDataSet.Tables[0].TableName;
                  // Get the table definition exactly like the definition of my own dataset.
                  CrystalDecisions.ReportAppServer.DataDefModel.Table table = GetTable(tableName);
                  table.ConnectionInfo = connectionInfo;
                  //delete all existing tables if there are any
                  foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table oldTable in rasDoc.DatabaseController.Database.Tables)
                      rasDoc.DatabaseController.RemoveTable(oldTable.Name);
                  //add my new table with the IDs of the XSD
                  rasDoc.DatabaseController.AddTable(table, null);
                  //now I want to change the displayed fields texts
                  CrystalDecisions.ReportAppServer.DataDefModel.Tables modifyTables =
                      rasDoc.DatabaseController.Database.Tables;
                  CrystalDecisions.ReportAppServer.DataDefModel.Table myTable =
                      (CrystalDecisions.ReportAppServer.DataDefModel.Table)modifyTables[0];
                  Fields fields = myTable.DataFields;
                  for (int i = 0; i < fields.Count; i++)
                      ISCRField field = fields<i>;
                      ResultFieldController resultFieldController =
                         rasDoc.DataDefController.ResultFieldController;
                      try
                          resultFieldController.Remove(field);
                          string sText = "";
                          sText = "Bäschreibung" + i.ToString();
                          field.Description = new string(sText.ToCharArray());
                          sText = "Häding" + i.ToString();
                          field.HeadingText = new string(sText.ToCharArray());
                          //sText = "Näme" + i.ToString();
                          //field.Name = new string(sText.ToCharArray());
                          resultFieldController.Add(-1, field);
                      catch (Exception exp)
                          MessageBox.Show(exp.Message);
    I am completely stuck.
    Thanks for any help.
    Pascal
    Edited by: Pascal Schmidt-Volkmar on Sep 30, 2008 9:31 AM

  • Get user count from two tables and display in 1 row

    I have 2 tables.....
    Table1 Table2
    user date user date
    With 1 query, I want to display the user, the count of the number of times a user appears in Table1.user as count1 and the count of the number of times that same user appears in Table2.user as count2 between a specific time period. I have looked and tried things including joins, unions, nested loops but can't get anything to work. The result would appear like this:
    USER COUNT1 COUNT2
    john 100 2
    doe 1000 200
    Thank you for your time. I'm really stuck and confused.

    Hi,
    Welcome to the forum!
    I think the easiest way to do this is to do a GROUP BY query on each table separately, and then combine the results, using FULL OUTER JOIN or UNION.
    WITH     union_data     AS
         SELECT       user_name
         ,       COUNT (*)     AS count1
         ,       0              AS count2
         FROM       table1
         WHERE       dt     >= &start_dt
         AND       dt      <  &end_dt + 1
         GROUP BY  user_name                             -- Forgot this originally!
    UNION ALL
         SELECT       user_name
         ,       0              AS count1
         ,       COUNT (*)     AS count2
         FROM       table2
         WHERE       dt     >= &start_dt
         AND       dt      <  &end_dt + 1     
         GROUP BY  user_name                             -- Forgot this originally!
    SELECT       user_name
    ,       SUM (count1)     AS count1
    ,       SUM (count2)     AS count2
    FROM       union_data
    GROUP BY  user_name
    ;Edited by: Frank Kulash on Jul 29, 2009 1:34 PM
    Edited by: Frank Kulash on Jul 29, 2009 2:46 PM
    As Solomon pointed out, I forgot the GROUP BY clauses in the sub-query.
    Without the tables, I can't test it.

Maybe you are looking for

  • I trashed my mimetypes.rdf file to reset download actions, and now Firefox won't open because profile missing, please advise

    Up until recently, when I would download a pdf file, it would automatically open, and recently, for some reason, it stopped opening automatically and just downloaded to my desktop where I wanted it. I found instructions on Mozilla if files downloaded

  • Need help with finding a workaround: the shotcut ctrl+click opens 2 tabs in my case

    Hello! I have several links with an onclick event, which contains some javascript handling and window.open() after it, and they have attribute href="javascript:void(0);" as well. When user try Ctrl+click Firefox opens him 2 tabs: the first one with "

  • KT4 : PB CPU thermal protection

    I Got an issue with a KT4 Ultra, an AMD 2400+ (volcano 7) My PC shuts as soon as the CPU temp is 53° Celsius. Is there a way to disable the CPU thermal protection or to modify the value for shuting down? Is there someone who got this issue and solve

  • Love the iPhone, Verizon is not the same.

    My other half purchased an iPhone for me two weeks ago.  I have had zero problems with the iPhone itself and I am very pleased.  No freezing, crashing, dropped calls (unless there is little or no signal) it's really helpful to me and my busy life. Up

  • How to remove all transitions?

    I used the automate to sequence with default transition. A few dozens of transitions were added to the sequence. How to remove all the transitions without deleting the sequence and starting from scratch please? Thanks in advance.