Report, SQL query based on the values of the elements (question SQL)

Hello

I use APEX 4.0 with Oracle 10 g r2 under Windows XP Pro SP3.

I have an interactive report and a menu with a few items to filter the report.

It works with most of the elements, but my problem is to select lists that have additional values, for example:
SELECT '(null)' display_value, 'NULL' return_value FROM DUAL
UNION ALL
select distinct(SPAT_AREA_NAME) display_value, SPAT_AREA_NAME return_value 
from SPATIAL_POINTS
order by 1
and I will return null as ' (return '%').

For example, if the user selects "(null)", the report should return all rows with a NULL value in the column AREA_NAME.
If he chooses "", the report should return all the lines. "
and if the user selects a value, the report should return all the lines containing the value in column AREA_NAME.

I don't know how to build my application. I tried with the CASE statements, DECODE, etc... but I still can't!

My report query is for now:
select SPAT_ID,
 SPAT_ACCL_NAME,
 SPAT_AREA_NAME,
 SPAT_CLASS,
 SPAT_NUMBER,
 SPAT_PT,
 SPAT_TYPE,
 SPAT_STATUS,
from SPATIAL_POINTS 
where 
 upper(SPAT_AREA_NAME) LIKE upper(:P3_FILTRE_AREA_NAME)  AND
 upper(SPAT_ACCL_NAME) LIKE upper(:P3_FILTRE_ACC_NAME) AND
 upper(SPAT_CLASS) LIKE '%'||upper(:P3_SPATIAL_CLASS)||'%' AND
 instr(upper(:P3_SPATIAL_TYPE_VALUES),upper(SPAT_TYPE)) > 0 AND
 instr(upper(:P3_SPATIAL_STATUS_VALUES),upper(SPAT_STATUS)) > 0 AND
 instr(upper(:P3_SPATIAL_POINT_VALUES),upper(SPAT_PT)) > 0
Any idea?

Thank you!

Yann.

Hello

Then, assuming that spat_accl_name is not a string value "NULL" then you can try this...

SELECT spat_id,
       spat_accl_name,
       spat_area_name,
       spat_class,
       spat_number,
       spat_pt,
       spat_type,
       spat_status,
       ROUND(spat_cumul,
             (SELECT up_number_precision
              FROM   user_preferences
              WHERE  UPPER(up_nice_login) = UPPER(v('APP_USER'))))
          AS "SPAT_CUMUL"
FROM   spatial_points
WHERE  :p3_filtre_acc_name IS NULL AND spat_accl_name IS NULL
       OR(CASE
             WHEN :p3_filtre_acc_name = '%' THEN NVL(spat_accl_name,'NULL')
             ELSE :p3_filtre_acc_name
          END = NVL(spat_accl_name, 'NULL'))

See you soon

Ben

Tags: Database

Similar Questions

  • How to view a report according to another region, the elements are filled.

    Using Apex 3.2.
    I have two reqions on the page, one being an interactive report, I won't show up until the search form box is populated.

    When they click on the button 'Search' I want the interactive report to display based on the values of completed from the search form.
    I hide a point on the page which is filled when the completed search engine which I use as a condition to hide/show the report.

    My problem is that I can never get the interactive report to display. My routine after process updated the element to hide but my shipment leaves me
    on the same page.

    How can I get the interactive report to show after the user clicks the search button?
    I thought that refreshing the page would help?

    Thank you

    And P3_SHOW_REPORT the value 'Y' in session state?

    What are the properties used Source, the Source Type and default value of the P3_SHOW_REPORTpoint?

  • IR report visible cell based on the value of the hidden highlight column

    I have an IR with a date in the format DD-MON-AA column.  I have an obligation to change the background color of the date cell according to the day of the week (2 yellow =, 3 = purple, etc.), where Monday is day 2, Tuesday is the day 3, etc.

    My idea on how to proceed was to create a hidden like this to_char (date_col, 'r') column, but I can not set the background color of the date column based on the value of another column (the column hidden in this case). 

    Any ideas on how I can do this?  Can I use the Expression of implementation form/HTML column on the column date to set the background color; If so, can you give an example?

    Thank you.

    Use column formatting

    #COLTOHIGHLIGHT #.

    Add css to the page

  • Result of the query based on the form of the parameter

    Good morning people. I really couldn't come up with a smart enough subject line, but I'll try and make up the body.

    I currently have a report that accepts parameters on the parameter form. They are extra employees and Number of Copies. The employee ID is stored in the Employee table, but the number of copies is not.

    The output of the report shows all the different addresses and phone numbers, the employee a. lets say, Employee ID 0001 has two addresses - home and office. In the report of my request, he'll give me two records in the repeating group. However, I have another parameter and the ID of the employee who is the number of Copies. In this case, if the number of Copies to be printed is 1, so it isn't a problem. However, if the Number of Copies is entered by the user is 4, I think in this case 4 x 2 = 8 pages of report output (4 with the address of the House) and 4 with the address of the office.

    I know there is a way to do this using a temporary table in AfterPForm and then using the results of the query by joining my request to the temporary table, but I was really hoping to avoid this situation if it can be treated through the query.

    Main request:
    SELECT    e.emp_no,
              e.saln||e.first_name||' '||e.last_name emp_name,
              a.street,
              a.city||' '||a.province||' '||a.postal_code city,
              '('||a.tel_area||') '||a.tel_number telephone
    FROM      employee e, emp_address a
    WHERE     e.emp_no = a.emp_no
    AND       e.emp_no = :P_EMP_NO;
    Any help is appreciated. Thank you!

    Hello

    Since you started a new thread in the forum SQL and PL/SQL {message identifier: = 10470358}, please mark this thread as "Answered" right away.

  • Query based on the partition of the date

    Hello

    I'm trying out only a professional successful integration in the last 24 hours of the day. If there is work that has the outcome of success and failure in the last
    24 hours for each day, I only managed the output. If there is no success for the same work, I pulled out as the last attempt at failed job.

    Here are my columns:
    current output:
     
    JOB_ID     JOBDATE               GROUP     PATH          OUTCOME          FAILED     LEVEL     ASSET
    3400908     7/27/2012 10:01:18 AM     polA     target1          Success          0     incr     clone1
    3400907     7/27/2012 10:01:09 AM     polA     target1          Failed          0     incr     clone1
    3389180     7/23/2012 10:01:14 AM     polA     target1          Failed          1     incr     clone1
    3374713     7/23/2012 10:01:03 AM     polA     target1          Success          0     incr     clone1
    3374712     7/22/2012 11:24:32 AM     polA     target1          Success          0     Full     clone1
    3367074     7/22/2012 11:24:00 AM     polA     target1          Failed          1     Full     clone1
    3167074     7/21/2012 10:01:13 AM     polA     target1          Success          0     incr     clone1
    336074     7/21/2012 10:01:08 AM     polA     target1          Success          0     incr     clone1
     
    desired output:
     
    JOB_ID     JOBDATE               GROUP     PATH          OUTCOME          FAILED     LEVEL     ASSET
    3400908     7/27/2012 10:01:18 AM     polA     target1          Success          0     incr     clone1
    3374713     7/23/2012 10:01:03 AM     polA     target1          Success          0     incr     clone1
    3374712     7/22/2012 11:24:32 AM     polA     target1          Success          0     Full     clone1
    3167074     7/21/2012 10:01:13 AM     polA     target1          Success          0     incr     clone1
    
    Here is a code I am trying to use without success:
    
    
    select *
     from
       (selectjob_id, jobdate, group, path, outcome, Failed, level, asset,
              ROW_NUMBER() OVER(PARTITION BY group, path, asset ORDER BY jobdate desc) as rn 
                   from job_table where jobdate between trunc(jobdate) and trunc(jobdate) -1 )
       where rn = 1
       order by jobdate desc;
    Thank you
    -Abe

    Hi, Abe,

    You are on the right track, using ROW_NUMBER to assign numbers and pick-up only #1 in the main query. The main thing you're missing is the PARTITION BY clause.
    You want to assign a #1 for each distinct combination of group_id, path, assets and calendar day , right?
    Then, you need to PARTITION BY group_id, path, assets and calendar day . I think you understand that when you called this thread "query based * on partition date."

    The next thing is the controlling ORDER BY clause. To know which line of each partition is assigned #1, you must order the lines of result ("Success" first, then "Failed") and after that, of jobdate (jobdate last first, which is in descending order).

    If so, that's what you want:

    WITH     got_r_num     AS
    (
         SELECT  j.*     -- or list columns wanted
         ,     ROW_NUMBER () OVER ( PARTITION BY  group_id     -- GROUP is not a good column name
                                   ,                    path
                             ,             asset
                             ,             TRUNC (jobdate)
                                   ORDER BY          CASE  outcome
                                                 WHEN  'Succcess'
                                         THEN  1
                                         ELSE  2
                                             END
                             ,             jobdate     DESC
                           )      AS r_num
         FROM    job_table  j
         WHERE     outcome     IN ('Success', 'Failed')
    --     AND     ...     -- Any other filtering, if needed
    )
    SELECT     *       -- or list all columns except r_num
    FROM     got_r_num
    WHERE     r_num     = 1
    ;
    

    If you would care to post CREATE TABLE and INSERT instructions for the sample data, and then I could test it.

    It seems that you posted several copies of this thread.  I bet that it's not your fault; This site can cause that.  Even if it's not your fault, please mark all versions duplicated this thread as "Answered" immediately and continue in this thread if necessary.

    Published by: Frank Kulash, 28 July 2012 23:47
    This site is crumbly than I thought! I saw at least 3 copies of this same thread earlier, but I'm not now.

  • Run one or the other query based on the result

    Hi all

    Is there anyway that I can design this query to run only a subquery based on the returned results.
    select to_char((NEXT_CHANGE# - 1),9999999999999999) latest_change 
    from v$archived_log 
    where SEQUENCE# =(select nvl(min(SEQUENCE#),0) 
                                   from v$archived_log 
                                   where ARCHIVED='YES' 
                                   and APPLIED='NO')
    
    If the above subquery returns 0, then I would like to execute the query below. Is there any way to embed multiple queries like case conditions ?
    
    select max(SEQUENCE#) 
                                   from v$archived_log 
                                   where ARCHIVED='YES' 
                                   and APPLIED='YES'
    Thank you

    G

    Edited by: USER101 December 9, 2010 09:34

    Hello
    Use the operator to decode your subquery:

    Select to_char ((NEXT_CHANGE #-1), 9999999999999999) latest_change
    v $ archived_log
    where SEQUENCE # = decode ((select nvl (min(SEQUENCE#), 0)))
    v $ archived_log
    When ARCHIVED = 'YES '.
    and APPLIED = 'NO'),
    0,
    (select max(SEQUENCE#)
    v $ archived_log
    When ARCHIVED = 'YES '.
    and APPLIED = 'YES'),
    (select nvl (min(SEQUENCE#), 0))
    v $ archived_log
    When ARCHIVED = 'YES '.
    and APPLIED = 'NO'));

  • SQL Query based on the timestamp

    Hi all

    I need to write a select statement that retrieves all records from the current time-2 hours previous.

    or current time at the present time - 2 hours.

    ID Timestamp
    111:09:21.994000000 10 OCTOBER 13: 00
    212:07:51.989000000 10 OCTOBER 13: 00
    301:11:04.621000000 10 OCTOBER 13: 00
    403:02:36.897000000 10 OCTOBER 13: 00

    Please suggest how can achieve us.

    TIA,

    Bob

    Select mytimestamp-(2/24) from myTable

    ----

    Ramin Hashimzade

  • Report view columns based on the selection of the month

    Hello

    I have an interactive report.
    In my report, I show the columns below. Let's say the show for months salary of the EMP for this month

    EmpID, ename, jan, Feb, mar, Apr, may, June, July, August, Sept, oct, nov, dec

    I have two selection lists (to filter the report) in my interface. P1_MONTH and P1_YEAR. These have static LOVs.
    Jan (Display) - 01 (Return)
    (Display) - 02 Feb (Return) and so on.

    I am facing problem while hiding under certain conditions the columns.
    For example, if the user selects the month "Mar." Then the report should display

    EmpID, ename, jan, Feb, mar

    Another example, if the month is "Jun" then

    EmpID, ename, jan, Feb, mar, Apr, may, June

    So he must hide under certain conditions the columns based on selection.
    I put the conditional 'view' in the column of the report for "expression of the ar-ticle/column value 1 = expression 2'.

    P1_MONTH (in the expression 1)
    + 06,07,08,09,10,11,12 (in the expression for the month of June selection 2) +.

    But doesn't the show/hide.
    Am I missing something? Please correct me if I'm wrong.

    I use APEX 4.1 & g 10 DB

    Thank you in advance,
    Daniel

    This

    value of item/column expression 1 = expression 2
    

    is equivalent to a PL/SQL expression, such as

    :P1_MONTH = '06,07,08,09,10,11,12'
    

    So maybe, select a PL/SQL expression condition and write something like that for the month of March - if I interpret correctly the your needs.

    TO_NUMBER(:P1_MONTH) <= 3
    

    Scott

  • Help - Tuning query based on the status column

    Hello
    I have a query in which I need to fetch records based on values in the status column. It can contain the values 'A' and 'P '. A record can have an "A" record and a record of 'P '. My conditions are,
    (1) when it is only 'A' record, can return 'A' record.
    (2) for the 'A' and 'P' folder is there, then return 'A' record.
    (3) when 'P' registration is only, then return 'P' registration.
    There are about 3 records 'A' Lake and 3K 'P '. I tried to use 'by' clause queries, but performance are too bad and I am not able to use it. When running as independent queries 'A' retrieval of documents is faster compared to the records of 'P '. When running in 'by' clause of the query is suspended. Please can anyone help how can be managed?

    Due to restrictions, I won't be able to view the actual code. I post here a sample.

    Example code:
    WITH q1 AS
         (SELECT *
            FROM tab
           WHERE status = 'A'),
         q2 AS
         (SELECT *
            FROM tab
           WHERE status = 'P'),
         q3 AS
         (SELECT *
            FROM q1
          UNION ALL
          (SELECT *
             FROM q2
            WHERE NOT EXISTS (SELECT 1
                                FROM q1)))
    SELECT *
      FROM q3
     WHERE ROWNUM < 501;
    Thank you
    Kadoch

    One way is to use analytics like this:

    SELECT *
    FROM (SELECT t.*, ROW_NUMBER() OVER (PARTITION BY 
                                         ORDER BY t.status) rn
          FROM tab t
          WHERE t.status IN ('A', 'P'))
    WHERE rn = 1
    

    John

  • Create a report of material based on the category tag?

    Hey guys!

    I am creating a report on the hardware of all virtual machines with a certain category of tag.  The most important things I need are really CPU, memory and disk size.  I modified a report I found that the inventory of all virtual machines in a data center and return this information.  I'm not sure what I missed at the top when trying to convert to return information to the material in the category 'SAMPLE '.  Is there someone who can take a look at this and point me in the right direction?

    Thank you!

    $VmInfo = ForEach ($VM in (Get-TagAssignment-category 'SAMPLE' |)) Sort - Object - property name)) {}

    "" | Select-Object - property @{N = "VM"; E = {$VM. Name}},

    @{N = "VM CPU #";} E = {$vm. ExtensionData.Config.Hardware.NumCPU/$vm. ExtensionData.Config.Hardware.NumCoresPerSocket}},

    @{N = "" VM CPU Core # ";"} E = {$vm. NumCPU}},

    @{N = 'Host'; E = {$vm. VMHost.Name}},

    @{N = 'Hard drive'; E = {$harddisk. Name}},

    @{N = "Datastore"; E = {$harddisk. FileName.Split("]") [0]. TrimStart("[")}},

    @{N = "VMDKpath"; E = {$harddisk. FileName}},

    @{N = 'VMDK size'; E = {($vm.extensiondata.layoutex.file|?)} ({$_ .name - contains $harddisk.filename.replace(".","-flat.")}). size/1 GB}},

    @{N = "size walk"; E = {$harddisk. CapacityGB}}

    }

    $VmInfo | Export-Csv - NoTypeInformation - UseCulture-Path "c:\scripts\reports\report.csv".

    Try like this

    $tagCat = get-TagCategory-name "SAMPLE".

    $tags = get-Tag-category $tagCat

    $VmInfo = ForEach ($VM in (Get-VM-Tag $tags |)) Sort - Object - property name)) {}

    foreach ($Harddisk in Get-disk hard - VM $VM) {}

    "" | Select-Object - property @{N = "VM"; E = {$VM. Name}},

    @{N = "VM CPU #";} E = {$vm. ExtensionData.Config.Hardware.NumCPU/$vm. ExtensionData.Config.Hardware.NumCoresPerSocket}},

    @{N = "" VM CPU Core # ";"} E = {$vm. NumCPU}},

    @{N = 'Host'; E = {$vm. VMHost.Name}},

    @{N = 'Hard drive'; E = {$harddisk. Name}},

    @{N = "Datastore"; E = {$harddisk. FileName.Split("]") [0]. TrimStart("[")}},

    @{N = "VMDKpath"; E = {$harddisk. FileName}},

    @{N = 'VMDK size'; E = {($vm.extensiondata.layoutex.file|?)} ({$_ .name - contains $harddisk.filename.replace(".","-flat.")}). size/1 GB}},

    @{N = "size walk"; E = {$harddisk. CapacityGB}}

    }

    }

    $VmInfo | Export-Csv - NoTypeInformation - UseCulture-Path "c:\scripts\reports\report.csv".

  • Query based on the date of

    I have a request (I'll call him main_query) which returns a recordset that looks like this.

    PRODUCT_ID SALE_DATE QT

    1 1000 2014 - 10 - 01

    1 1500 2014-10-02

    2 300 2014-10-01

    For each product, I have a date of sale and the quantity sold.

    Now I have another table (BUY) with orders. It contains the product Id, id purchase and purchase date.

    PRODUCT_ID PURCHASE_ID PURCHASE_DATE

    1 9999 2014 - 09 - 17

    1 10000 2014 - 09 - 28

    2 10001 2014 - 08 - 10

    My goal is to find the Id of the last purchase BEFORE each date of sale.

    The result should be:

    PRODUCT_ID PURCHASE_ID SALE_DATE

    1 10000 2014-10-01

    1                    10000               2014-10-02

    2 10001 2014-10-01

    I tried something like this

    SELECT PRODUCT_ID, SALE_DATE

    (SELECT MAX (PURCHASE_ID) TO BUY WHERE TO BUY.) PRODUCT_ID = PRODUCT_ID AND

    PURCHASE_DATE < = SALE_DATE) LAST_BUY

    OF (main_query);

    But I still have the "ORA-00979: not a GROUP BY expression" error.

    Thank you for the help

    Hi Nuno,

    with things like BUY. PRODUCT_ID = PRODUCT_ID> I would you like to live dangerously... I suggest that you use ALIASES all initially, then see this error message you still or not...

    SELECT m.product_id

    m.sale_date

    (SELECT MAX (b.purchase_id)

    B buys

    WHERE b.product_id = m.product_id

    AND b.purchase_date<= m.sale_date="" )="">

    M (main_query)

    ;

    Best regards

    Bruno Vroman.

    P.S.: maybe a missing comma in your statement (between sale_date and (SELECT MAX)?

  • XML Query when all the elements are not defined.

    I have the following:

    We could have a situation that elements of PRICES are not defined, but all others are. I can t solve this problem by performing a union query. Is there a way appropriate or better?

    Thank you

    DECLARE

    x_xml CLOB

    " : = ' < OTA_ResRetrieveRS xmlns =" http://www.OpenTravel.org/OTA/2003/05 "" xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance " Version = "7" "xsi: schemaLocation =" http://www.OpenTravel.org/OTA/2003/05 OTA_ResRetrieveRS.xsd "TimeStamp =" 2015-05 - 20 T 14: + 00:00 40:44.000000 "Target ="Test"TargetName ="AUS"TransactionIdentifier ="2716181"> " ""

    < success / >

    < errors >

    < error Type = '0' doc = "None" / >

    < / errors >

    < ReservationsList >

    < HotelReservation RoomStayReservation = "true" ResStatus = "Internal" >

    < Type UniqueID = "14" ID = "514803980" / >

    < services >

    < Service >

    < TPA_Extensions >

    < TPA_Extension >

    < WiFiFees NumberConnections = '2' = ConnectionType "F" LengthOfStay = "4" / > "

    <!-RATES DAYS = '7' UPGRADE = LEVEL-10 "20.65" = "21.95' LEVEL-20 ="39.95"/ >

    < RATES DAYS = UPGRADE '3' = '8.85"LEVEL-10 = '13.95' LEVEL-20 ="23.95"/ >

    < RATES DAYS = UPGRADE '1' = "2.95" LEVEL-10 = "5.95" LEVEL-20 = "9.95" /-->

    < / TPA_Extension >

    < / TPA_Extensions >

    < / service >

    < / services >

    < ResGuests >

    < ResGuest >

    profile of <>

    < ProfileInfo >

    < Type UniqueID = "21" ID = "356321732" / >

    < profile >

    < TPA_Extensions >

    < TPA_Extension >

    < DRI_INFO MemberLevel = GuestType 'SAM' = 'GST' OwnerStay = "N" / >

    < / TPA_Extension >

    < / TPA_Extensions >

    < customer >

    < PersonName >

    Tomas < name > < / name >

    Lane Donald < GivenName > < / GivenName >

    < / PersonName >

    < / customer >

    < / profile >

    < / ProfileInfo >

    < ProfileInfo >

    < Type UniqueID = "21" ID = "356321734" / >

    < profile >

    < TPA_Extensions >

    < TPA_Extension >

    < DRI_INFO MemberLevel = GuestType 'SAM' = 'GST' OwnerStay = "N" / >

    < / TPA_Extension >

    < / TPA_Extensions >

    < customer >

    < PersonName >

    James < name > < / name >

    Amanda < GivenName > < / GivenName >

    < / PersonName >

    < / customer >

    < / profile >

    < / ProfileInfo >

    < / profile >

    < / ResGuest >

    < / ResGuests >

    < RoomStays >

    < ideal >

    < BasicPropertyInfo HotelCode = "LOL" / >

    < price >

    < RoomRate RoomID = code '17105' = 'SAM' >

    < GuestCounts >

    < GuestCount Count = "1" / >

    < / GuestCounts >

    < / RoomRate >

    < / price >

    < TimeSpan Start = end of the '2015-05-20' = "2015-05-24" / >

    < / ideal >

    < / RoomStays >

    < / documents >

    < / ReservationsList >

    < / OTA_ResRetrieveRS > ';

    BEGIN

    I'm

    IN (SELECT x1.roomnumber

    x1.property

    x2.days

    x2.upgrad

    x2.lev1

    x2.lev2

    x3.folio

    x3.lastname

    x3.firstname

    x1.connections

    x1.connecttype

    FROM XMLTABLE)

    xmlnamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05"")

    , ' / OTA_ResRetrieveRS/ReservationsList/documents ".

    PASSAGE xmltype (x_xml)

    COLUMNS Numerobureau VARCHAR2 (2000) PATH 'RoomStays/RoomStay/RoomRates/RoomRate/@RoomID '.

    , property VARCHAR2 (2000) PATH 'RoomStays/RoomStay/BasicPropertyInfo/@HotelCode '.

    , rates XMLTYPE PATH "Services, Services, TPA_Extensions, TPA_Extension.

    , profiles XMLTYPE PATH "ResGuests/ResGuest/profiles/ProfileInfo.

    , connections VARCHAR2 (2000)

    Path "Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@NumberConnections".

    , connecttype VARCHAR2 (2000)

    Path "Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@ConnectionType") x 1

    , XMLTABLE (xmlnamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05'), ' / TPA_Extension/RATES " )

    PASSAGE x1.rates

    Days of COLUMNS VARCHAR2 (2000) PATH '@DAYS '.

    , upgrad VARCHAR2 (2000) PATH '@UPGRADE '.

    , lev1 VARCHAR2 (2000) PATH ' @LEVEL-10'.

    LEV2 VARCHAR2 (2000) PATH "(@LEVEL-20') x 2.

    XMLTABLE)

    xmlnamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05'), ' / ProfileInfo'

    PASSAGE x1.profiles

    Folio VARCHAR2 COLUMNS (2000) PATH 'UniqueID/@ID '.

    , name VARCHAR2 (2000) PATH ' profile/client/PersonName/family name.

    First name VARCHAR2 (2000) PATH 'Profile, customer, PersonName, GivenName') x 3

    the Union - is - it possible to get results without it?

    SELECT x1.roomnumber

    x1.property

    null

    null

    null

    null

    x3.folio

    x3.lastname

    x3.firstname

    x1.connections

    x1.connecttype

    FROM XMLTABLE)

    xmlnamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05"")

    , ' / OTA_ResRetrieveRS/ReservationsList/documents ".

    PASSAGE xmltype (x_xml)

    COLUMNS Numerobureau VARCHAR2 (2000) PATH 'RoomStays/RoomStay/RoomRates/RoomRate/@RoomID '.

    , property VARCHAR2 (2000) PATH 'RoomStays/RoomStay/BasicPropertyInfo/@HotelCode '.

    , rates XMLTYPE PATH "Services, Services, TPA_Extensions, TPA_Extension.

    , profiles XMLTYPE PATH "ResGuests/ResGuest/profiles/ProfileInfo.

    , connections VARCHAR2 (2000)

    Path "Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@NumberConnections".

    , connecttype VARCHAR2 (2000)

    Path "Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@ConnectionType") x 1

    XMLTABLE)

    xmlnamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05'), ' / ProfileInfo'

    PASSAGE x1.profiles

    Folio VARCHAR2 COLUMNS (2000) PATH 'UniqueID/@ID '.

    , name VARCHAR2 (2000) PATH ' profile/client/PersonName/family name.

    First name VARCHAR2 (2000) PATH 'Profile, customer, PersonName, GivenName') x 3

    ORDER BY 8)

    LOOP

    Dbms_output.put_line (i.roomnumber

    || ' '

    || students

    || ' '

    || i.Days

    || ' '

    || i.upgrad

    || ' '

    || i.Lev1

    || ' '

    || i.Lev2

    || ' '

    || i.Folio

    || ' '

    || i.LastName

    || ' '

    || i.FirstName

    || ' '

    || i.Connections

    || ' '

    || i.CONNECTType);

    END LOOP;

    END;

    I can t solve this problem by performing a union query. Is there a way appropriate or better?

    Yes, you can use an OUTER JOIN:

    SELECT x1.roomnumber

    x1.property

    x2.days

    x2.upgrad

    x2.lev1

    x2.lev2

    x3.folio

    x3.lastname

    x3.firstname

    x1.connections

    x1.connecttype

    FROM XMLTABLE)

    XmlNamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05')

    , ' / OTA_ResRetrieveRS/ReservationsList/documents ".

    PASSAGE xmltype (x_xml)

    COLUMNS Numerobureau PATH VARCHAR2 (2000) 'RoomStays/RoomStay/RoomRates/RoomRate/@RoomID '.

    , the path of the VARCHAR2 (2000) 'RoomStays/RoomStay/BasicPropertyInfo/@HotelCode '.

    , rates XMLTYPE PATH "Services, Services, TPA_Extensions, TPA_Extension.

    , profiles XMLTYPE PATH "ResGuests/ResGuest/profiles/ProfileInfo.

    , connections VARCHAR2 (2000) path 'Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@NumberConnections '.

    , connecttype PATH VARCHAR2 (2000) 'Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@ConnectionType '.

    ) x 1

    XMLTABLE)

    XmlNamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05')

    , ' / TPA_Extension/PRICE.

    PASSAGE x1.rates

    Days of COLUMNS VARCHAR2 (2000) '@DAYS '.

    , upgrad VARCHAR2 (2000) path '@UPGRADE '.

    , lev1 PATH VARCHAR2 (2000) ' @LEVEL-10'.

    , lev2 PATH of VARCHAR2 (2000) ' @LEVEL-20'.

    ) (+) x 2

    XMLTABLE)

    XmlNamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05'), ' / ProfileInfo'

    PASSAGE x1.profiles

    Folio VARCHAR2 COLUMNS (2000) path 'UniqueID/@ID '.

    , name VARCHAR2 (2000) PATH ' profile/client/PersonName/family name.

    , name VARCHAR2 (2000) PATH "profile, customer, PersonName, GivenName".

    ) x 3

  • NUMBER based on the elements implemented.

    Hi all

    Sorry I cound not think of a better.

    I've been hitting my head against the wall, all that for about a week and the only thing I have to show that it is a headache.

    My table examples

    WITH tests,)
    SELECT 1 AS 'ID', 'Reading' AS 'TEST_TTILE', TO_DATE (null) AS 'EFFECTIVE_DATE', TO_DATE (null) AS "Correspondents" OF the DOUBLE
    UNION ALL
    SELECT 2, 'Writing', TO_DATE (null), (null) TO_DATE FROM DUAL
    UNION ALL
    SELECT 3, 'Arithmetic', TO_DATE (null), (null) TO_DATE FROM DUAL
    UNION ALL
    4. SELECT "basket weaving 101", TO_DATE('01-FEB-2009'), TO_DATE (null) FROM DUAL.
    UNION ALL
    SELECT 5, "basket weaving 102", TO_DATE('01-FEB-2009'), TO_DATE('28-FEB-2009') FROM DUAL
    UNION ALL
    SELECT 6, 'prehistoric history', TO_DATE (null), TO_DATE('31-JAN-2009') FROM DUAL
    )
    SELECT * FROM test


    WITH STUDENTS HAVE)
    SELECT 1 AS ID, 'Read' AS 'TEST_TTILE', TO_DATE('01-JAN-2009') AS 'TEST_DATE' OF the DOUBLE
    UNION ALL
    SELECT 1, 'Writing', TO_DATE('02-JAN-2009') OF the DOUBLE
    UNION ALL
    SELECT 1, 'Arithmetic', TO_DATE('03-JAN-2009') OF the DOUBLE
    UNION ALL
    SELECT 1, 'prehistoric history', TO_DATE('04-JAN-2009') OF the DOUBLE
    UNION ALL
    SELECT 2, 'Read', TO_DATE('01-JAN-2009') OF the DOUBLE
    UNION ALL
    SELECT 2, 'Writing', TO_DATE('02-JAN-2009') OF the DOUBLE
    UNION ALL
    SELECT 2, 'Arithmetic', TO_DATE('03-JAN-2009') OF the DOUBLE
    UNION ALL
    SELECT 3, 'Read', TO_DATE('15-FEB-2009') OF the DOUBLE
    UNION ALL
    SELECT 3, 'Writing', TO_DATE('15-FEB-2009') OF the DOUBLE
    UNION ALL
    SELECT 3, 'Arithmetic', TO_DATE('15-FEB-2009') OF the DOUBLE
    UNION ALL
    SELECT 3, 'Basket weaving 101', TO_DATE('15-FEB-2009') OF the DOUBLE
    UNION ALL
    SELECT 3, 'basket weaving 102', TO_DATE('15-FEB-2009') OF the DOUBLE. "
    UNION ALL
    Select OPTION 4, 'Writing', TO_DATE('01-MAR-2009') OF the DOUBLE
    UNION ALL
    Select OPTION 4, "Arithmetic", the DOUBLE TO_DATE('01-MAR-2009')
    UNION ALL
    4. SELECT "basket weaving 101", TO_DATE('01-MAR-2009') OF the DOUBLE ".
    UNION ALL
    SELECT 5, 'Read', TO_DATE('15-FEB-2009') OF the DOUBLE
    UNION ALL
    SELECT 5, 'Writing', TO_DATE('01-MAR-2009') OF the DOUBLE
    UNION ALL
    SELECT 5, "Arithmetic", the DOUBLE TO_DATE('01-MAR-2009')
    UNION ALL
    SELECT 5, "Basket weaving 101", the DOUBLE TO_DATE('01-MAR-2009')
    UNION ALL
    SELECT 5, "basket weaving 102', TO_DATE('01-MAR-2009') OF the DOUBLE".
    )
    SELECT * FROM STUDENTS


    Students take tests in a certain order,
    but the existence of a test in a date selection will trigger the search for all the tests in force.

    "In force" is
    WHERE STUDENTS. TEST_DATE BETWEEN TESTS. TESTS AND EFFECTIVE_DATE. CORRESPONDENTS.
    AND THE STUDENTS. TEST_TITLE IS TESTING. TEST_TITLE

    What is in effect is always subject to change at the whim of those in "userland".

    Date selection could be as close as a day or as wide as infinity.
    but the outcome of each student in the trials should be counted only once and
    counted as 1 no matter how much testing is in effect at the time.

    It is possible for the same student to do the same test several times, but all the tests in force is supposed to be counted.

    TESTS of null. EFFECTIVE_DATE indicates the date of entry into force is the beginning of time.
    TESTS of null. EFFECTIVE_DATE indicates the expiry date is the end of time.

    Charges will be consolidated on MAX (STUDENTS. TEST_DATE) AS "COMPLETION_DATE" for STUDENTS.ID.

    Student 1 is counted because all tests in force have been taken.
    Student 2 is not counted as test "Prehistoric history" was in force but not taken.
    Student 3 is running out because all the tests in force have been taken.
    4 student is not counted because test in force, but not 'Read' was taken.
    5 student is counted for all the tests in force have been taken.

    Can someone show me how to go in the right direction please?

    I tried to clarify this but if it does not please let me know.

    Thanks in advance for your help,

    Lou

    Published by: wind on May 11, 2009 14:16

    Published by: wind on May 11, 2009 14:20

    Hey, Lou,

    I'm still not clear about the criteria of selection.
    I understand that each student must have completed all the tests that were in force for a certain period, but I don't know what it is from the period.
    After reading your last post, I guess the time is actually just a point in time, to the point where the student took his last test (i.e. MAX (test_date).
    If I guessed wrong, you may only change the definition of begin_date in the subquery student_date_range, below.

    If this query gets good results of your test data, but I don't know it's for the right reason, and this is why I'm not sure that it will work on all the data.

    WITH     student_date_range  AS
    (
         SELECT       id
         ,       MAX (test_date)     AS begin_date
         ,       MAX (test_date)     AS end_date
         FROM       students
         GROUP BY  id
    )
    SELECT     end_date
    ,     COUNT (*)     AS total
    FROM     student_date_range     m
    WHERE     NOT EXISTS (
                     SELECT  test_ttile
                 FROM        tests
                 WHERE   NVL (effective_date,  m.begin_date) <= m.end_date
                 AND        NVL (expiration_date, m.end_date)   >= m.begin_date
                 MINUS
                 SELECT  test_ttile
                 FROM        students
                 WHERE   id     = m.id
                     )
    GROUP BY  end_date
    ORDER BY  end_date;
    

    As you can see, it's just a matter of seeing if there are all the exams the student should have taken, but did not.
    I looked in the NOT EXISTS subquery
    b - tests to find which tests the student should have taken, then I looked
    (b) to students to see those who take the student.
    Find if there is in the first peloton which are not in the second one is simply an operation LESS: (a) (b).

    Published by: Frank Kulash, May 11, 2009 18:43

  • analyzing XML based on the elements of the array...

    Hello

    I wonder why two of my three tracks below are undefined or 'white', I think that everything is set up the way it should be, however, when I try and draw the attributes, they are not defined. What I am doing wrong? I hope it's an easy place for someone, my head popped up a bit (I show my naiviety).

    I will not go into why I do it this way, but I'm trying to get this data model to work.

    Thanks for any help,

    Chipleh

    var teamXML:XML = <team headerText="Field1,Field2,Field3,Field4,Field5,Field6,Field7" hitsFieldNumber="5">
      <player Field1="BLAH 1" Field2="BLAH 2" Field3="BLAH 3" Field4="BLAH 4" Field5="BLAH 5" Field6="BLAH 6" Field7="BLAH 7"/>
    </team>
                    
        var xmlHeaderText:XMLList = teamXML.@headerText;        
        var headerTextArray:Array = [];    
        var headerTextString:String = teamXML.@headerText;        
        headerTextArray = headerTextString.split(",");
        trace("headerTextArray = "+ headerTextArray);
        for(var i:int = 0;i<headerTextArray.length;i++)
        {
            trace(i + " : " + headerTextArray[i]);        
            trace("teamXML.player.@headerTextArray[i] = " + teamXML.player.@headerTextArray[i]);        
            var theField:String = headerTextArray[i];
            trace("teamXML.player.@headerTextArray[i] = " + teamXML.player.@theField);        
        }    
        
    
    use:
    
    var teamXML:XML = 
      
    
    
        var xmlHeaderText:XMLList = teamXML.@headerText;
        var headerTextArray:Array = [];
        var headerTextString:String = teamXML.@headerText;
        headerTextArray = headerTextString.split(",");
        trace("headerTextArray = "+ headerTextArray);     for(var i:int = 0;i 
               
  • How to display the value of an element based on another element

    Hello
    In a page, I have to display name for the corresponding id displayed in id element. I can write a query based on the id and full name as soon as I enter this item.if, so is there any properties that I need? I'm looking for just post_text_item functionality in forms?

    Thank you
    Manoi

    Hello Eric,

    You must alert gReturn instead of get.
    But it is your call to this public page? And Page 0 requires an authorization?

    Greetings,
    Roel

    http://roelhartman.blogspot.com/

Maybe you are looking for

  • Why is the worksheet grid is distorted

    I built a spreadsheet catalog for months. Today the right-hand side is distorted: repeated and overlap. (see extracts attached). The spreadsheet will export to Excel and re - import numbers, but in the process, I lose some formatting, and (for reason

  • Apple Watch don't pair after the recent software update

    I've just updated my software and now my iPhone and watch will not pair. Am I missing something?

  • Satellite L750 Fn buttons not work & close does not work either

    I used my L750 for about 3 weeks now and all of a sudden the function keys (using the FN + F keys) have stopped working. In addition, the stop, when I go to start, then press stop, my laptop used to actually stop. Now all that I can click is either s

  • SIT error 14104, dll runs on the host, but not on the target

    Hello I have problems of deployment dll (compiled in 2007 with Microsoft Visual C++ .NET 2003) Simulink in LabVIEW (2009 SP1). My target system is a desktop PC with LabVIEW Real-time 9.0 installed. I created a simple Simulink model which mulitplies a

  • Chart based on the irregular time

    Hi, I'm continually acquire voltage with a compaqdaq. I want to do is chart as the voltage (Y) versus time (X). The problem I have is that the time between measurements is not constant, so I can't put a time constant to rate and graph XY or equivalen