Not able to get the values of distict even after the definition of the FUNCTION of MEMBERSHIP card

Hello

I'm trying to get distinct values of a query to an array type. Please see the code below
CREATE OR REPLACE TYPE T_COPY_EVNT_DTL
IS
  OBJECT
  (
    eventId               VARCHAR2(100),
    eventDescription      VARCHAR2(100),
    promoMonthDescription VARCHAR2(100),
    promoStartDate        VARCHAR2(100),
    promoEndDate          VARCHAR2(100),
    PROMOCOSTSTARTDATE    VARCHAR2(100) ,
    ,
    MAP MEMBER FUNCTION sort_key
    RETURN VARCHAR2 );
CREATE OR REPLACE TYPE BODY T_COPY_EVNT_DTL
AS
  MAP MEMBER FUNCTION sort_key
  RETURN VARCHAR2
IS
BEGIN
  RETURN eventId ;
END;
END;
/
CREATE OR REPLACE TYPE T_EVENT_TABLE
IS
  TABLE OF T_COPY_EVNT_DTL; 

          with event_data as (
select '1' event,'event1' event_desc,'monthdesc1' promo_month_desc ,'01/01/2001' promo_start_date     ,'01/01/2002' promo_end_date,'01/02/2001' promo_cost_start_date from dual union all      
select '1' event,'event1' event_desc ,'monthdesc1'promo_month_desc ,'01/01/2001' promo_start_date     ,'01/01/2002' promo_end_date,'01/02/2001' promo_cost_start_date from dual union all
select '3' event,'desc3' event_desc ,'monthdesc3' promo_month_desc,'01/01/2001' promo_start_date     ,'01/01/2002' promo_end_date,'01/02/2001' promo_cost_start_date from dual union all
select '2' event ,'desc2' event_desc ,'monthdesc2' promo_month_desc ,'01/01/2001' promo_start_date     ,'01/01/2002' promo_end_date ,'01/02/2001' promo_cost_start_date from dual ) 
SELECT  cast(collect(distinct t_copy_evnt_dtl(event,
                                                                                                                    event_desc,
                                                                                                                    promo_month_desc,
                                                                                                                    promo_start_date,
                                                                                                                   promo_end_date,
                                                                                                              promo_cost_start_date) ORDER BY
                                                            event_desc,
                                                            promo_month_desc,
                                                            promo_start_date,                                                    
                                                            promo_end_date,                                            
                                                            promo_cost_start_date) as t_event_table)  from event_data;

result :

T_EVENT_TABLE('T_COPY_EVNT_DTL('2','desc2','monthdesc2','01/01/2001','01/01/2002','01/02/2001')',
          'T_COPY_EVNT_DTL('3','desc3','monthdesc3','01/01/2001','01/01/2002','01/02/2001')',
          'T_COPY_EVNT_DTL('1','event1','monthdesc1','01/01/2001','01/01/2002','01/02/2001')',
          'T_COPY_EVNT_DTL('1','event1','monthdesc1','01/01/2001','01/01/2002','01/02/2001')')
Please help me find the reason why it does not work...

Manjusha Muraleedas wrote:
Please see the link: http://www.oracle-developer.net/display.php?id=514
Title: using complex types

And as the article says, combining DISTINCT and ORDER BY does not work so well:

The diagram of the syntax in the documentation suggests that the two extensions can be combined to build ordered and distinct collections for each group.
However, in the version 11.2.0.1, this does not work.

I can confirm that this does work on 11.2.0.2 either.

As a solution, I would probably use a subquery or MULTISET:

select cast(
         multiset(
           select distinct
                  event
                , event_desc
                , promo_month_desc
                , promo_start_date
                , promo_end_date
                , promo_cost_start_date
           from event_data
           order by event_desc
                  ,     promo_month_desc
                  ,     promo_start_date
                  ,     promo_end_date
                  ,     promo_cost_start_date
         )
         as t_event_table
       )
from dual;

Tags: Database

Similar Questions

  • Not able to get the value of the type defined in the other program

    Hi all

    I have create a type in a single package spec (Globally), now I'm using the same type in another package. Simply I'm calling the first package and try to store the value in the Type and use the same type in the second package.

    But I'm not able to get the value

    Type declaration

    Declared in package Spec
    
    TYPE t_aa_derive_tbl_type IS TABLE OF xxxx%ROWTYPE;
       t_aa_derive t_aa_derive_tbl_type;
    

    Package 1

    Package1. PROCEDURE name(
    some parameters);
    is
    Cursor
    c1 is Select * from dual;
    
    begin
          OPEN c_aa_derive;
            FETCH c_aa_derive
            BULK COLLECT INTO t_aa_derive;
            CLOSE c_aa_derive;
           
         END get_aa_derive;
    

    In my second package

    I'll call you

    Package1. PROCEDURE name(
    some parameters);
    
    and then i am trying to
    
    for i in 1 .. package1.t_aa_derive.COUNT
      LOOP
    
    ....
    
    ....
    ...
    
    end loop;
    

    I can not entered the loop for some reason any.

    Could someone guide me if anything I missed.

    See you soon,.

    San

    And what did you like refcursor c_aa_derive in the call to package1.name? Is it returns all rows? If this isn't the case, COUNT will be 0.

    SY.

  • I bought an iphone6.  I registered. On the apple's music. But I'm not able to get the free month trial subscription

    I bought an iphone6.  I registered. On the apple's music. But I'm not able to get the free month trial subscription

    What happens when you try?

  • Qosmio-F750-10N and Win8.1 - were not able to get the right BT drivers

    Hello

    Since upgrading my HARD drive and installing Windows 8 (.1), I was not able to get the right drivers for my Qosmio F750-10N Bluetooth.

    If I go through the section of drivers download site, the drop-down boxes of language and the region appear to be defective, so it shows me all the drivers.

    Tried to install a Toshiba Bluetooth stack generic but it doesn't seem to be able to recognize my Bluetooth device. Also tried to go through the Atheros website without much luck.

    Please could someone help or maybe post a link to a download mirror.

    Thank you very much.

    Hello

    First of all, it seems that the 8.1 win is not supported for Qosmio F750.
    So I might be difficult to operate BT

    However, AFAIK the Qosmio F750-10N was equipped with an Atheros AR9285 Wifi/BT card.

    This means that a single module shares the WiFi network and BT and you need to install the Atheros BT filter driver.
    Next to the BT filter installed, must install the driver of Toshiba system to win 8.1
    The pilot of this system must be installed before the filter of BT driver.

    But like I said: 8.1 win is not supported for this Qosmio unit and you won't find drivers Win 8.1 download section in the driver F750.

    But you should try the drivers released for the other, more recent Qosmio series; i.e. X 870

    Good luck

  • I'm not able to get the sound card drivers for a sony VAIO desktop computer

    I'm not able to get the audio drivers for a sony VAIO desktopPCV 2253 someone can help me get t for free

    Hello

    Check with the Sony Support, their drivers and documentation online and ask in their forums.

    Sony - Contacts
    http://eSupport.Sony.com/us/Perl/contact-land.pl

    Sony - drivers
    http://eSupport.Sony.com/Perl/select-System.pl

    Sony - Support
    http://eSupport.Sony.com/

    Sony - Forum
    https://Forum.sel.Sony.com/?XID=M:Showcase:eSupport

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Why you're not able to get the new June 20th, 2016 updates on your creative cloud, if you are running Windows 7.

    Why you're not able to get the new June 20th, 2016 updates on your creative cloud, if you are running Windows 7.

    So I spent all day on this because Adobe did not anywhere that I could find it. But I'm hoping some of you to save a lot of time wasted... you can't upgrade to the latest version of the application if you have not all updates to Windows 7.


    If you're like me and do not want anything to do with the Windows updates... you may encounter the same problem. Summer/don't I am not at all interested in Windows 10 (who they are sneaking into regular updates) so I don't usually have enabled updates. If you don't... you cannot upgrade your program to the latest version. Creative cloud not even give the option.


    I think it's the Microsoft Visual C++ or something like that who needs update to run the latest version of the software... If you do not have it on your system, you do not install the new updates properly, but be careful not to download sneaky windows 10 "update." Know how it's called blindly here before update you.

    I hope that helps some of you save a whole day unnecessarily.

    Some programs on a win os to visual c ++ 2015, Download Visual C++ Redistributable for Visual Studio 2015 of official Microsoft Download Center

  • Not able to get the page bean object bar button in the extended controller

    Hi all

    I'm not able to get the bean button object in my page. But I'm not able to get the buttonbar descriptor itself. any idea?

    Structure of the page is:

    PageLayout - having not controller
    -buttonbar
    -button1
    -submitbutton2
    -regiion1(stack layout)-controller assigned (seededCO)

    I extend the seededCO and I'm trying to get the handle of bean button1 by the following code.

    OAPageButtonBarBean pbb = (OAPageButtonBarBean) webBean.findIndexedChildRecursive ("buttonBar");
    if(PBB!=null)
    {
    System.out.println ("PBB" + PBB);
    BB = (OAButtonBean) pbb.findIndexedChildRecursive ("button1");
    }

    Hello

    Try like this,
    Import oracle.apps.fnd.framework.webui.beans.nav.OAPageButtonBarBean;
    Import oracle.apps.fnd.framework.webui.beans.nav.OAButtonBean;

    PBar = OAPageButtonBarBean
    (OAPageButtonBarBean) pageContext.getPageLayoutBean () .getPageButtons ();
    OAButtonBean = ctButton
    (OAButtonBean) pBar.findIndexedChildRecursive ("YourRequiredButtonName");

    Thank you

    With respect,
    Kali.
    OSSi.

  • Because getting an email that recurs every 5 minutes, we were not able to get the new email, even from block the bad email.

    An email was sent to our account from an iPhone; the e-mail contained two photos. For the next two days, that E-mail reproduces itself in our Inbox (with the same time/date) more than two hundred times... like every 8 minutes. I have blocked using the object, and those still in the Inbox disappeared. (We were constantly moving them to the trash). A computer guru suggested I unlock now, and he has not returned. However, because the e-mail arrived Wednesday morning we have not been able to get new emails. They appear on in Yahoo email, but nothing will come by Thunderbird. (Get new emails seems to be "stuck"). Our Norton account has done many tests, and that did not help. Can someone help us get our email back to normal? Moreover, the same email/photos were sent to two other people of the same phone I, and they had no problem at all with him.

    Menu help > troubleshooting information.

    Please copy to the Clipboard and paste the information into a message here so your settings can be checked.

    Connect to your e-mail account using a browser (webmail ;) and delete the e-mail following undownloaded (in case it is corrupted))

  • Not able to get the 192.168.1.1 console configuration in Bridge Mode only

    Hello

    I use the Linksys WAG200G wireless modem and connection mode is ' Bridge Mode Only ', in this mode I do not get the console configuration 192.168.1.1 and Wifi set-up. Please help me to solve these problems. Appreciate your help. Thank you.

    1. you set a static IP address, for example 192.168.1.2 mask 255.255.255.0 on the computer and he wire the WAG to get access.

    2. do not allow the wireless and basically anything else on the WAG during a bridge mode. In bridge mode, it works like a standard modem and all you can change is the modem related settings.

  • Why it is that I am still not able to get the promo email ' Promo time offer limited Add Windows Media Center for Windows 8 Pro?

    Waited for almost 12 hours for the email to arrive... still not able to receive it... have already sent around 2 to 4 times of request... still not received the email... Why is that i am not yet receive? already checked my spam and trash folder... its still not in there.what do?

    You should have around 24 hours after you provide your email address for this promotion.

  • How can I get my photoshop saved again when I'm not able to disable the function on the old computor

    Hi there at - there someone who can help me - my old computor totally crushed. I bought photoshop CS5 in December and it loaded on my old computor before the crash. Now, I am unable to turn it off before re - save on my new computor.

    Thanks Ria

    Hi Ria,

    Please contact customer service and they would be able to increase the number of activations for you as an exception in this case.

  • not able to get the response of an async bpel process

    How to get the answer of async bpel

    What DO YOU call the ASYNC SERVICE. USE INVOKE TO CALL AND USE A RECEIVE ACTIVITY TO RECEIVE THE RESPONSE.

    should work...

  • Not able to use the function

    Hello Experts!

    I am trying to write a FUNCTION that can return a line when I provide an employee ID. I created a function I have it gets compiled successfully. Now when I try to call this function, I get the error message saying
    Error at startup on line 2 of the command:
    run get_employee (100);
    Error report:
    ORA-06550: line 1, column 7:
    PLS-00221: 'GET_EMPLOYEE' is not a procedure or is not defined
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:

    I don't know why its not working. Can anyone help me please with it? I tried 2 different ways to call this function, but both give the same error (as above). Here are the ways I tried to call this function.

    -1 way
    Set serveroutput on
    run get_employee (100);


    -2 ways
    Set serveroutput on
    declare
    employees.employee_id%type ID: = 100;
    Start
    dbms_output.put_line (get_employee (ID));
    end;
    /
    print;


    And here's my functions
    create or replace FUNCTION get_employee (p_empid in employees.employee_id% TYPE)
    RETURN employees % rowtype as employees l_cust_record % rowtype;
    BEGIN
    Select * into l_cust_record
    employees
    where employee_id = p_empid;

    Return l_cust_record;
    end;


    Thank you very much in advance.

    Hello

    user10791378 wrote:
    ...
    -1 way
    Set serveroutput on
    run get_employee (100);

    Calling a user-defined function, that's like calling a built-in function.
    To call a function integrated, as ABOVE, you would say:

    cap_name := UPPER (name);
    

    To call a function of user-defined as get_employee:

    e_rec := get_employee (100);
    

    -2 ways
    Set serveroutput on
    declare
    employees.employee_id%type ID: = 100;
    Start
    dbms_output.put_line (get_employee (ID));
    end;

    Dbms_output.put_line argument is a VARCHAR2. The value returned by get_employee is used. ROWTYPE. These are two very different data types. You cannot use one when the other is needed.
    If one of the columns (ename, say) of emplyees is a VARCHAR2, then you can say:

    DECLARE
        e_rec    employees%ROWTYPE := get_employee (100);
    BEGIN
        dbms_output.put_line (e_rec.ename);
    END;
    

    or

    BEGIN
        dbms_output.put_line (get_employee (100).ename);
    END;
    
  • Series of printer HP Color LaserJet 2840: not able to configure the functionality of SCAN to e-mail or a folder

    Have a series of HP Color LaserJet 2840 printer on a local subnet for home with two computers that share.

    We can make regular features print very well.

    We cannot get the SCAN function to work for the scan to e-mail or in a folder.

    Went and used the HP Toolbox to set options analysis, but for some reason, they are not taken.

    The Guide of the user for this problem are usless (as usual with the documents of the user).

    I have spend too much time on this seemingly simple question, as usual.  (months of work on this periodically)

    I'm sure that's not that hard to implement.

    Can you please help or advise.

    Additional information:

    2 computers on the subnet local via 100MB ethernet switch and router (basic stuff)

    No problem of communication to the printer for print jobs or check on other orders of status.

    Some scanning configuration problems.

    Two client computers are running Windows Vista Home Premium SP1 32-bit

    I want to set up the printer so I can scan from the printer directly to a folder on the machine either or e-mail to each machine.

    I do the steps correctly, from what I can tell, but the info is not required or sent to the printer. ?

    If I add an e-mail through the box to tools, I can fill in the email field and the name field, but it will not show when I hit Add.

    Besides which should represent the box 'Host '?  The printer or my personal computer?

    If I try to add a file, it displays a browse box but never lets me select a folder to scan to?

    I don't understand.  Shouldn't be this embarrassing.  And if it is, (as usual), the stupid tech docs should do a better job MUUCCHH through it.  In fact, they don't even show or talk about the Host column.  So what is this for.

    Help, please...

    I'm sorry, but to get your question more exposure I suggest posting in the trade forums since it is a printer. You can do so at http://h30499.www3.hp.com/hpeb/

    I hope this helps.

  • I'm not able to get the value of an element in the region from the table using Java script

    I have a fixation with two columns area, when the user tries to add a new line without having to fill in the line above, then it should throw an exception. It is the custom page and the home region is located at the end of my page so normal exception raises at the top of the page where the end user referred to in the current. I need to go with popup warning. I built a java script in PR

    code:

    OkButton OASubmitButtonBean = (OASubmitButtonBean) webBean.findChildRecursive ("addrow");

    okButton.setOnClick ("javascript: a = document.getElementById ('prompt');" + "alert ('outside ' + (a.value));" +)

    "if ((a.value)! = ") {input = alert ('check' + (a.value)) ;}} else {alert (' inside the else'+ (a.value));} ");"

    The code above works for entering the message text in the header area, but it is does not make any value if the sub-region of table in advance. Kindly share your point of view on this issue.

    attach_js_issue.png

    This code will give you the same ID only.

    Check the "View Source" code generated from the browser.  https://support.Google.com/AdSense/answer/181951?hl=en

    See you soon

    AJ

Maybe you are looking for

  • New MacBook Pro lost internet connection

    Fortunately brought my MacBook Pro retina display 15 "and connected to a Dell monitor. (Hours of hassle, but I have another question/problem). After using it for a while, I lost my connection to my home network. But my older MacBook Pro 13 and my iMa

  • PRINTER CARTRIDGE HP F4480 - CAN I USE THE CARTRIDGE PG-640

    I HAVE THE F4480 PRINTER, IT IS RUNNING OUT OF INK, BETAI I HAVE A CARTRIDGE OF PG-640 640 PIXMA BLACK WHICH IS QUIET SIMILLER, CAN WE USE IT IN THE HP F4480? I NEED AN ANSWER DO NOT KNOW IF IT WILL WORK

  • 7.24 Skype crashes on CTRL + A

    This morning I noticed my 7.24 Skype crashing when I hit the key combination CTRL + A (select all) in the chat. Reinstalled. No effect. Skype has Parisians work. External exception 505. I must say I'm impressed. This happens on Windows 10 and Skype i

  • Equium M50-164: IE does not display the pages correctly

    I have a new Toshiba Equium M50-164, but it does not correctly display the my internet page at http://myweb.tiscali.co.uk/lorne.anderson/Bridge/ It should look like this:http://myWeb.tiscali.co.UK/Lorne.Anderson/NormalView.gifwith the bridge in the h

  • Astrophotography Focus problem

    Hello I have the NEX 6 (with the SALT 50 mm F1.8 lens) and most of the time to enjoy. I bought it mainly for astrophotography and need tips for image correctly targeted (during playback or downloaded on my computer). I can't seem to get a clear focus