Why does Discoverer put my custom function into GROUP BY

To make things clear with simple example:
I have 10 id's from people (people.id) and sum function on their salary [sum(people.salary)] during a period of time that i set in my parameters.
The sql looks something like this:
SELECT PEOPLE.ID
,SUM(PEOPLE.SALARY)
FROM FRS_PEOPLE
WHERE [MY CONDITIONS]
GROUP BY PEOPLE.ID
I registered a function that uses people.id, and some other parameters to calculate something for each people.id!
I made a calculation:
MY_FUNCTION(people.id,'xxx','yyy')
,so my sql looks like this now:
SELECT PEOPLE.ID
,SUM(PEOPLE.SALARY)
,MY_FUNCTION(people.id,':xxx',':yyy')
FROM FRS_PEOPLE
WHERE [MY CONDITIONS]
GROUP BY PEOPLE.ID,MY_FUNCTION(people.id,':xxx',':yyy')
It runs but never finishes....?!
When i run my sql in sqlplus i do not put my function into group by, but discoverer does so, despite it already has people.id item in GROUP BY!
And if i put instead of people.id an actual id it works correctly and does not put my function into group by!
The sql i am looking for and works correctly is:
SELECT PEOPLE.ID
,SUM(PEOPLE.SALARY)
,MY_FUNCTION(people.id,'xxx','yyy')
FROM FRS_PEOPLE
WHERE [MY CONDITIONS]
GROUP BY PEOPLE.ID
Please someone help!
My select clause is much more complicated, with many outer joins so i made the above up just to explain to you what my problem is!
I hope i made my self clear!
Help would be very appreciated.

Hi,
I think there is a problem with your function. That fact that the report completes when an actual id is used must not when a people.id is used suggests that it works when the function is called once with an actual id but not when it is called many times with a people.id.
If the function is doing complex lookups and calculations to obtain a salary for each people.id then often this type of report will run quicker with the salary calculation is brought into the report SQL using joins etc.
Tracing the Discoverer session running the report will show you all the SQL processed by the database and the execution plans used. It will show you how often the function is being called and what SQL is being run by the function.
Rod West

Similar Messages

  • Why does SQL execute inner selected functions again in the outer select?

    Hi,
    Why does SQL execute inner selected functions again in the outer select?
    Given:
    CREATE OR REPLACE FUNCTION K_TEST
    RETURN NUMBER IS
    BEGIN
    RETURN 1;
    END;
    SELECT K_TEST, K_TEST FROM DUAL;Will (logically) execute the function twice.
    SELECT intest, intest
    FROM (SELECT K_TEST intest FROM DUAL);Will execute the function twice too!
    Why can't SQL buffer the inner result?
    Does anyone have an idea on how to achieve executing the function only once? My original called function is quite heavy and returning a user defined type. Adding predicates, the function is executed 3 or 4 times!
    Thanks for any tips,
    K.

    Hello
    Depending on your version of Oracle, Sub query caching could help....
    XXXX> create sequence seq_1
      2  /
    Sequence created.
    Elapsed: 00:00:00.07
    XXXX> CREATE OR REPLACE FUNCTION K_TEST
      2  RETURN NUMBER IS
      3
      4      ln_Ret  NUMBER;
      5
      6  BEGIN
      7      SELECT
      8          seq_1.NEXTVAL
      9      INTO
    10          ln_Ret
    11      FROM
    12          dual;
    13
    14      RETURN ln_Ret;
    15  END;
    16  /
    Function created.
    Elapsed: 00:00:00.60
    XXXX>
    XXXX> SELECT K_TEST, K_TEST FROM DUAL;
        K_TEST     K_TEST
             1          2
    1 row selected.
    Elapsed: 00:00:00.06
    XXXX> SELECT K_TEST, K_TEST FROM DUAL;
        K_TEST     K_TEST
             3          4
    1 row selected.
    Elapsed: 00:00:00.01
    XXXX> SELECT intest, intest
      2  FROM (SELECT K_TEST intest FROM DUAL);
        INTEST     INTEST
             5          6
    1 row selected.
    Elapsed: 00:00:00.10
    XXXX> SELECT
      2      intest,intest
      3  FROM
      4      (
      5          SELECT (SELECT K_TEST FROM dual) intest
      6          FROM
      7          dual
      8
      9      )
    10  /
        INTEST     INTEST
             7          7
    1 row selected.
    Elapsed: 00:00:00.03
    XXXX> /
        INTEST     INTEST
             8          8
    1 row selected.
    Elapsed: 00:00:00.01THis last example takes advantage of a specific optimisation for calling functions in a subquery. Not sure if it would suit your circumstance though...
    Alternatively - again depending on your version - you might be able to look at function result caching...
    HTH
    David
    Edited by: Bravid on Feb 1, 2012 12:32 PM

  • Why does Parallels put MacFuse in my System Preferences?

    Why does Parallels put MacFuse in my System Preferences?
    Anyone have any idea why? Can I just remove it?

    Mac OS only supports reading NTFS, so in order to write, you need a 3rd party driver.
    And good ol' Bing/Google:
    http://www.macupdate.com
    http://en.wikipedia.org/wiki/FilesysteminUserspace
    http://code.google.com/p/macfuse/wiki/FAQ
    http://code.google.com/p/macfuse/w/list

  • So, why does a faithful BT customer like meend up ...

    So, why does a faithful long-standing BT customer like myself end up being hounded down by a debt collector acting on behalf of BT? It seems that after I paid a fee by card over the phone 18 months ago, it has only now come to light that you didn't take the payment. An admin error on your part surely, and not my responsibility. So why are you now threatening to send the debt collectors to my home and why are you charging me admin fees for the privilege? Perhaps you could shed some light on why I should a) pay for your mistake and b) remain a BT customer? I look forward to hearing your response and hope it is more coherent and understanding than the response I received after spending an hour on the phone to your operatives this morning. Thanks

    Hi Clairecopemen,
    Welcome to the forum and thanks for posting. I can  look into this for you. Drop me an email with the account details and a link to this post for reference. You’ll find the contact us form in the about me section in my profile.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Why does SharePoint put in character code 8203 in a richtext field?

    I use some RichHtmlField controls (PublishingWebControls) in different pagelayouts. I edit the pages, put some text in the fields and publish. It all seems to work fine, but I've noticed that SharePoint saves an extra character to my string. Usually it's
    added at the beginning of the string, but sometimes at the end.
    You cannot see it using the ordinary browser window, because it's a zero width space character. But if you right click and select View source, it's visible as a big space. 
    It's possible to copy the text from the view source window to a text editor preserving this character, so I pasted it as a string in a c# program. When I loop through every character in the string to check its ascii value, this particular character shows as
    8203.
    I used CAML Builder to check what my string looked like in the database. I couln't see anything strange, but when I copied the string from the CAML Builder result tab and pasted it into a hex editor, you could clearly see that the strange character was there.
    The problem is that we translate our pages to different languages and this character makes the translation engine go bananas.
    Has anyone experienced this before or has any idea how this could be solved?

    I wrote this little gem which is a bit DOM-intensive but it does the job...
    function spCleanup(code){
    if(code.children().length > 0){
    code.html(jQuery('<div>').append(code.children().clone()).html().replace(/&nbsp;|&#160;|\r\n|\n|\r|\t/g,'').replace(/\s{2,}/g,' '));
           code.children().each(function(){
    spCleanup(jQuery(this));
    spCleanup(jQuery('#s4-bodyContainer'));

  • Why does the System message-"Customer Num of customer is on hold" appear

    Hi,
    I created a UDO form with a field named “Customer Code” that represents a code of a customer.
    Pressing TAB over the field enables to choose a customer from a list.
    The list is based on Choose From List system object.
    When I choose a customer, who is on hold, I get a system message:
    “Customer <Number of customer> is on hold. Changes cannot be saved. Do you want to proceed?”
    This message is irrelevant because the purpose of the form is searching and displaying data.
    Why does this message appear, and how can I avoid it?
    Thanks in advance.
    Shai.

    Maybe, just after you select the customer from the choose from list, and just before you show it in you form, thus, making the msgbox appear, you can check if the bp is frozen and manage to click in the ok button of the msgbox using UI api....
                       Hope it helps,
                              Jon Arranz

  • RSPAN does not put IPv6 multicast traffic into port

    Hi.
    There is two switches in the equation:
    WS-C2960-24TT-L    12.2(55)SE5           C2960-LANBASEK9-M
    and stack of
    Switch Ports Model              SW Version            SW Image
         1 12    WS-C3750G-12S      12.2(55)SE8           C3750-IPSERVICESK9-M
         2 12    WS-C3750G-12S      12.2(55)SE8           C3750-IPSERVICESK9-M
    *    3 24    WS-C3750G-24T      12.2(55)SE8           C3750-IPSERVICESK9-M
    3 is a master
    There is VTP domain with pruning off and RSPAN VLAN 1001
    core#sho vlan remote-span
    Remote SPAN VLANs
    1001
    there is RSPAN session on first:
    #sho monitor session 1
    Session 1
    Type                   : Remote Source Session
    Source Ports           :
        Both               : Fa0/11
    Dest RSPAN VLAN        : 1001
    Port Fa0/11 is in access mode, VLAN 303
    and on second:
    core#sho monitor session 1
    Session 1
    Type                   : Remote Destination Session
    Source RSPAN VLAN      : 1001
    Destination Ports      : Gi3/0/2
        Encapsulation      : Native
              Ingress      : Disabled
    Problem is that i can't see any IPv6 multicast traffic (like ICMPv6 RA or such) on Gi3/0/2 which is absolutely sure there, because if i remove monitoring session on core switch and put Gi3/0/2 into trunk mode, i can see packets i need in vlan 1001:
    # tcpdump -s0 -nnvei eth1 vlan 1001 and ip6
    tcpdump: WARNING: eth1: no IPv4 address assigned
    tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
    14:17:37.059045 50:57:a8:f0:72:1b > 33:33:ff:00:00:01, ethertype 802.1Q (0x8100), length 90: vlan 1001, p 0, ethertype IPv6, (class 0xe0, hlim 255, next-header ICMPv6 (58) payload length: 32) 2abc:abc:1:600b::2 > ff02::1:ff00:1: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2abc:abc:1:600b::1
              source link-address option (1), length 8 (1): 50:57:a8:f0:72:1b
    14:17:38.083266 50:57:a8:f0:72:1b > 33:33:ff:00:00:01, ethertype 802.1Q (0x8100), length 90: vlan 1001, p 0, ethertype IPv6, (class 0xe0, hlim 255, next-header ICMPv6 (58) payload length: 32) 2abc:abc:1:600b::2 > ff02::1:ff00:1: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2abc:abc:1:600b::1
              source link-address option (1), length 8 (1): 50:57:a8:f0:72:1b
    14:17:39.107068 50:57:a8:f0:72:1b > 33:33:ff:00:00:01, ethertype 802.1Q (0x8100), length 90: vlan 1001, p 0, ethertype IPv6, (class 0xe0, hlim 255, next-header ICMPv6 (58) payload length: 32) 2abc:abc:1:600b::2 > ff02::1:ff00:1: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2abc:abc:1:600b::1
              source link-address option (1), length 8 (1): 50:57:a8:f0:72:1b
    There is no such problem with usual unicast and broadcast traffic.
    Any suggestions?

    Interestingly, i've found bug CSCsr64007 which i stubmbled upon on one of my switches during troubleshooting. The effect of this bug was that RSPAN took IPv6 multicast packets from unrelated VLANs and forwarded them into monitor port.
    Looks like they have "fixed" it filtering IPv6 multicast completely.

  • Import PB12.6 Custom Function into PB11.2 InfoMaker PBL

    I've developed a PowerBuilder function for use within InfoMaker using version 12.6.  My client is using InfoMaker version 11.2 with no access to PowerBuilder.  The function is straightforward and compatible, but I have no way of adding the function to the version 11.2 PBL file without using PowerBuilder 11.2. 
    Can anyone suggest any options for importing this function into the lower version PBL file?

    Hi Mitch;
      You can export the Function from your PB IDE environment and then import it into IM by the following registry changes that will enable the Import/Export icons in IM's Library Painter toolbar ...
    Windows Registry Editor
    [HKEY_CURRENT_USER\Software\Sybase\InfoMaker\11.0\Toolbar\1004 0]
    "Items"="1610 1268 -1 1630 1262 1618 1266 1614 1616 1620 1612 1456 -1 1622
    1624 -1 1614 1616"
    The last two items in this list are the Import & Export options.
    HTH
    Regards ... Chris
    PS: IF the "1004 0" toolbar entry is not there, modify the toolbar in the IM IDE by (for example) adding a space (-1 value) somewhere. This should force the registry entry to now be written & visible. Now you can edit the toolbar values - adding the two extra ones at the end. If you add a -1 before this pair, you will get a separator as well.

  • Why does my nonwireless keyboard stop functioning out of the blue?

    Quad 2.5 10.4.6
    keyboard works on my other G5
    when i restart it works
    why does it stop working about once a month out of the blue
    cant type etc unless i restart
    repaired perms and first aide ok
    everything else seems fine
    ??? ?? ?? ????

    I was just about to post a similar thing, but mines alittle more bizaar. I can type in safari and firefox but not in the search bar in the finder or to rename a folder. Using dual 2.3 , X 10.4.5?????

  • Why does my iPad freeze 10 min into every video I watch?

    I have abc, NBC, A&amp;E, and Netflix apps. They are all freezing up after 10 minutes of play. What is going on?

    There are not too many ways to fix an iPad.  Try these.  Could try to hock up to iTunes and read the logs.
    Re-boot ipad.
    Press and hold the Sleep/Wake button until a red slider appears, then drag the slider. Then press and hold the Sleep/Wake button until the Apple logo appears.  page 128 iPad user manual.
    force power down if the above give you trouble.
    Hold down both the Sleep/Wake button and the Home button. Ten seconds or more.  Hold until the Apple logo appears.
    more details on re-booting:
        http://ipad.about.com/od/iPad_Guide/ss/How-To-Reboot-Your-iPad-Power-Off.htm
    Restore to factory settings by loading the latest version of ios that your machine will support:
       Do a full backup of your device.  Twice is best -- cloud and computer.
       "You can use iTunes to restore your iPhone, iPad, or iPod touch to factory settings and the latest version of iOS."
       http://support.apple.com/kb/HT1414?viewlocale=en_US&locale=en_US
       "You can put your iOS device into recovery mode, then restore it using iTunes.:
       http://support.apple.com/en-us/HT201263
    At last resort you could consider DFU (Device Firmware Update).  This could void your warranty.
        http://www.imore.com/tip-put-iphone-ipad-dfu-mode

  • Why does Adobe try to trick us into installing Chrome and the Google toolbar?

    Why does Adobe try to trick me in an underhand way to install Chrome and the Google toolbar?

    In a word... "Money"

  • Why does Mail require "Re:" subject prefix to group conversations properly?

    When the Apple Mail program (using Mavericks 10.9.1) is configured to "View:Organize by Conversation", it is necessary for the email subject line to be prefixed with "Re:" in order for the email from different senders to be grouped into the same conversation, even if the emails contain proper "In-Reply-To" header fields.  Why does the program require this subject line prefix, versus just using the In-Reply-To field values to group conversations?  Many automated systems that generate emails (e.g., web-based helpdesk systems) will send email with the proper In-Reply-To field values to associate emails for the same topic/case, but they do not use the "Re:" subject line prefix.  This seems to be a defect with the design of the Mail program to require this prefix for the conversation grouping to work properly.
    Does anyone know if there is legitimate rationale for this behavior?  Does anyone know if there is a work-around for this problem (short of changing these other systems to prefix the subject line)?
    Thanks, Steve

    Hi
    You asked about a recommendation for an app to paste a group of addresses into the To, Cc or Bcc fields of an email?
    Our "MailShot Pro" app is the only one we know of on the App Store that creates special "group contacts" in your address book which contain all your groups email addresses, but can be used just like regular contacts from most of your favourite apps. We now have nearly 50000 people using it, and growing steadily every day.
    Here is a link if you would like to know more “MailShot Pro” (itunes link).
    A free version is also available if you'd like to try it out with a small nmber of contacts.
    If you need any customer support just contact us at the website, we're always happy to help.
    Peter
    www.solubleapps.com
    Disclosure: I am the developer of this app and may benefit from its sale- (but so might you)

  • Why does iPhone put photos into random folders like "965YOKDJ" in windows explorer? I want all photos in one folder, not separated in a seemingly random manner.

    When I plug my iphone 5s into my windows computer and open it in windows explorer, all the photos are separated into folders like "965YOKDJ" and "823WGTMA". The photos don't seem to be separated in a logical way. I would rather them to all be in one folder or, if they are separated, at least have them separated in a logical way like date or something. I doubt, with it being an Apple product, there would be a setting I can change on the iPhone to change the way it labels photos and folders but if anyone knows a way to make this easier and more logical can you tell me? Also if any Apple employees happen to read this could you perhaps improve the way the iphone labels its photos?

    Thats the way the files have been configured since the original iPhone so I don't think they are going to change it anytime soon (since it's been 7 years) but you can certainly put in some feedback on apple.com/feedback
    I feel you pain somewhat on this one (at least back when I owned a PC).  The folders are not logical nor the naming scheme.  There is no setting you can change to change this as this is created by the operating system.  I would have to assume it is some sort of code.  I have noticed that when I do not take a picture for a long while, a new folder is formed, but again, I'm not sure of the criteria on how the iOS knows when to make a new folder inside the DCIM, but I have also seen with with some digital cameras that are not phones  

  • What is google analytica and why does Firefox put it on my computer?

    Firefox has put google analytica on my browser. Why did you do that and how do I get it off?
    == This happened ==
    Every time Firefox opened

    There are pages that I try to log onto, such as when I go to gjsentinel.com and then click on any of their stories. It will blink the story briefly and then then the screen goes black and at the bottom of my window (Firefox) it continually says "Waiting for google-analytics.com" and just stays there. However, the address line at the top continues to say http://www.gjsentinel.com/ This does not happen when I use Safari.

  • Why does Mail keep reloading old emails into my inbox as if they are new?

    Ill be doing homework at like 2-3am and all of the sudden Mail will say I have 157 new emails in my inbox. When I go look at them, it just reloads all the messages in my gmail inbox into my Mail inbox. To prevent it from happening I have to keep moving my gmail messages into folders. Is there anyway to fix this?? Maybe it is the way I have it set up??? Someone please help, it happens like 3 times a week at least and is super annoying!!!
    -A distressed student

    Travis,
    You have posted in the Mail & AB forum for Leopard, and not Snow Leopard, and the system info posting below any of your responses reports 10.5.6 -- you should correct the latter.
    For some using Snow Leopard and using Time Machine, this has been leading edge issue, and one that hopefully will be dealt with by the next update to SL. What seems to happen with Mail 4.x and use of Time Machine, is that the file that in normal use prevents duplicate downloads gets restored to an old version, and thus Mail does not know it has downloaded the messages previously. Purging the MessageUidsAlreadyDownloaded3 file will cure briefly (after enduring one more download of all messages on the server, but the problem will return because of Time Machine. Are you using Time Machine?
    As for housekeeping, if you quit Mail, and then shut down your laptop (or maybe even if only putting it to sleep by closing the lid), then Mail housekeeping tasks, which include keeping the index up-to-date do not get finished, and then can be problems. Now that I know you are using Snow Leopard, I am less suspicious of that.
    Ernie

Maybe you are looking for