How to create a user_defined grouping function?

I need to create a user_defined function and use it in my sql statement.
I know the user_defined function can be used anywhere the build-in function can be used.In oracle,there are grouping functions.
How can I create a user_defined grouping function and I can use it in my sql statement.

Hi, can you explain exactly what you are trying to achieve:
SQL> create or replace function my_func return number as
  2  begin
  3    return 5;
  4  end;
  5  /
Function created.
SQL> select deptno,my_func(),max(sal)
  2  from emp
  3  group by deptno,my_func()
  4  /
    DEPTNO  MY_FUNC()   MAX(SAL)
        10          5       5000
        20          5       3000
        30          5       2850

Similar Messages

  • How to Create a Remotely Enabled Function Module

    Hi All,
    How to Create a Remotely Enabled Function Module.
    I Want to Create a FM Using Sample Data , This for Practice
    What Fields can i give in the Import and Export Parameters.
    Please Give me one Example
    Can Any one Give me the Steps to do this.
    Regards
    Vamsi

    Hi Vamsi,
    Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
    Do the following steps for creating RFC in server A.
    1. log on to server A
    2. go to se37
    3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
    4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
    5. go to attribute tab -> choose remote-enabled module from processing type.
    so that your FM will become RFC.
    6. provide the import parameter in import tab.
    we will provide only two import parameters.
    - parameter name : P_NUM1, typing: TYPE, associated type : I & <b>check the pass value</b> (all the parameters of RFC must pass by value).
    - parameter name : P_NUM2, typing: TYPE, associated type : I & <b>check the pass value</b>
    7. provide the export parameter in export tab.
    parameter name : P_SUM, typing: TYPE, associated type : I & <b>check the pass value</b>
    8. write the given simple code in source code tab.
    FUNCTION Z_TEST_RFC.
    P_TOT = P_NUM1 + P_NUM2.
    ENDFUNCTION.
    Do the following steps for creating ABAP program which will call the RFC in server B.
    1. se38 - > creat a program.
    2. write the given simple code.
    data tot type i.
    call function 'Z_TEST_RFC' destination '<b>XXXXXX</b>'
      exporting
        p_num1 = 10
        p_num2 = 15
      importing
        p_tot = tot.
    write tot.
    please note that <b>XXXXXX</b> is RFC connection which is avialable in <b>sm59</b> transaction in server A.
    -go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of <b>XXXXXX</b> in the code.
    finally you can execute the normal abap program that will call the RFC and display the result.
    Regards,
    Sukhee

  • How to create Infoset&user group query--(query report)

    Hi Guys,
      how to create Infoset&user group query--(query report),
      Pls send me the exact procedure with Example....
                                                                              Regards:
                                                                              Kumar .G

    goto SQ03 and create an User Group If U want to create Ur Own.
    Goto SQ02 to create Ur Infoset by Giving Logical database name or Simple Database table
    Then Choose What ever data U need to be included in The Qurey in field Groups.
    Then Generate the Infoset
    Now Assign the infoset to user group
    Now goto SQ01 and Click on Other user group Button and choose Ur user Group.
    Then in the USer group select Ur Infoset and then create Ur own Query and save this.
    Now select the infoset query and goto More functions under Query menu and Generate report name.
    Now Create a transaction code for the report name generated.
    Now use the Tcode.
    Hope U have got the basic idea of creating Queries.
    ~BiSu

  • How to create and execute a function whose return value is  a table

    hi folks ,
    i would like know how to create and execute a function whose return value is a table ,
    am new to pl/sql ,
    my statement for the function is
    SELECT ct.credential_code, c.expiration_date
    FROM certifications c, credential_types ct
    WHERE ct.crdnt_id = c.crdnt_id
    AND c.person_id = person_id;
    i would like to have the result of the above query as return value for the function.
    Thanks in advance ,
    Ashok.c

    hi Ps ,
    Can you please do small sample ,
    that would help me in clear understanding
    thanks in advance
    ashok.c

  • How to create Matrix with Group report layout in xml

    Hi,
    i would be glad if anyone could tell me How to create Matrix with Group report layout in xml?
    Here i am attaching the required design doc
    below is the code
    select COST_CMPNTCLS_CODE,
    -- crd.RESOURCES,
    NOMINAL_COST,
    cmm.COST_MTHD_CODE,
    -- crd.COST_TYPE_ID,
    gps.period_code
    -- ORGANIZATION_ID
    from CM_RSRC_DTL crd,
    gmf_period_statuses gps,
    CM_MTHD_MST cmm,
    CR_RSRC_MST crm,
    CM_CMPT_MST ccm
    where gps.period_id = crd.PERIOD_ID
    and crd.cost_type_id = cmm.cost_type_id
    and crd.RESOURCES = crm.RESOURCES
    and crm.COST_CMPNTCLS_ID = ccm.COST_CMPNTCLS_ID
    and gps.period_code in (:p_period1, :p_period2, :p_period3)
    group by COST_CMPNTCLS_CODE, cmm.COST_MTHD_CODE, gps.period_code,NOMINAL_COST
    order by 1,2,3,4.
    The o/p of the report shoud be as given below
              Period-1     Period-2     Period-3     Period-4
    COMPONENT                         
    LABOUR - DIRECT                         
         Actual     1     2     3     4
         Actual Rate     10     10     10     10
         Standard Rate                    
         Var%                    
    DEPRICIATION-DIRECT                         
         Actual                    
         Actual Rate                    
         Standard Rate                    
         Var%                    
    OVERHEAD - DIRECT                         
         Actual                    
         Actual Rate                    
         Standard Rate                    
         Var%                    
    LABOUR - IN DIRECT                         
         Actual                    
         Actual Rate                    
         Standard Rate                    
         Var%                    
    Thanks in advance

    Your friend is obviously not a reliable source of HTML
    information.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Mr.Ghost" <[email protected]> wrote in
    message
    news:f060vi$npp$[email protected]..
    > One of my friends advised me to develop my whole site on
    the layout mode
    > as its
    > better than the standard as he says
    > but I couldnot make an ordinary table with rows and
    columns in th layout
    > mode
    > is there any one who can tell me how to?
    > thanx alot
    >

  • How to create the change document functionality for a dependent objects?

    May I please know how to create the change document functionality for a dependent objects?
    I have done it follow the same process as for business process objects. But when i try to test it in BOBT, there is no records under "FIELD_CHANGE_WITH_FILTER". It seems the change hasn't been recorded.
    If the way I did to create change document for dependent object is correct, please also kindly advise the possibilities for why there is no record during testing.
    thanks in advance.

    I also have some doubts about the business object.In this case,one abstract BO hase a subnode wihich is root extended.I added the change document for this node under the category "root_extended" and then tested the function in BOBT.I got some error message "can't find the root key".Shall i redefine the method /BOFU/IF_CDO_CREATION~IS_CDO_CREATION_ACTIVE so as to solve the problem?
    Thx.

  • How to create new storage group and mailbox database on exchange 2007 CCR

    Hi, Our Environment:
    Exchange 2007 SP3 CCR.
    Now I want to create a new storage group with edb file and log files on the new drive.
    My plan is as below:
    Once we have new drive ready on both active node and passive node,
    1): Create new storage group with log files for this new storage group on other new drive from Active Node.
    2): Create new mailbox database under this newly created storage group with the DB file on the new drive from active node.
    My question is:
    1): Do I need to perform above steps from active node only? or Do I need to do it from both active node and passive node?
    2): How many storage groups can we create on one Exchange 2007 Enterprise server, we already have 25 SGs in place.
    Thanks in advance.

    Hi,
    Here are my answers you can refer to:
    1. We can just create new storage group on the active node. And it’ll be replicated to the passive node.
    We can use the following command in EMS to verify the new Storage Group is being replicated to the passive node:
    Get-StorageGroupCopyStatus "Second Storage Group" | Select SummaryCopyStatus,CCRTargetNode
    http://exchangepedia.com/blog/2007/08/how-to-create-new-storage-group-in-ccr.html
    2. For Exchange 2007 enterprise version, we can have up to 50 storage groups:
    http://www.computerperformance.co.uk/exchange2007/exchange2007_storage_groups.htm
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
    sure that you completely understand the risk before retrieving any suggestions from the above link.
    If you have any question, please feel free to let me know.
    Thanks,
    Angela Shi
    TechNet Community Support

  • How to Create a Facebook group subadmin where he cant remove actual admin

    how to Create a Facebook group subadmin where he cant remove actual admin
    This topic first appeared in the Spiceworks Community

    Hi
    Run pfcg and try to go to change with your restricted settings then click on the error message to get the table entries in performance assistant. Put those in prgn_cust via sm30.
    Then use 22 instead of 02 in newly called object S_USER_SAS.
    Make sure you have at least one user with * in that object for full access across the landscape before transporting the table.
    Cheers
    David
    Edited by: David Berry on Oct 23, 2010 10:25 AM
    Edited by: David Berry on Oct 23, 2010 10:26 AM
    Forgot to say - when you have the new object value 22 in your restricted role and assigned to test user prior to moving to PROD the only way to go into change mode is to first go to the USER tab and then press change. Anywhere else and you'll still get the 'you are not authorised' message.
    Edited by: David Berry on Oct 25, 2010 8:04 PM

  • How to create users and groups using WLST Offline with Weblogic 8.1.4

    How to create users and groups using WLST Offline with Weblogic 8.1.4?
    Any ideas?

    Hi this is how i created a user using WLST Offline?
    cd('/Security/' + domainName)
    # Delete the default user name weblogic
    # incase you want to remove the defualt user weblogic
    delete('weblogic','User')
    # Creating a new user defined
    create(userName, 'User')
    # Setting the password of the user you created.
    cd ('/Security/' + domainName + '/User/' + userName)
    cmo.setPassword(password)
    Regards
    Makenzo

  • How to create a field group.

    Hi all,
    Can anyone please explain how to create a field group for few fields?
    My requirement is i want to Create a specific fieldgroup for maintenance of the fields for the contacts TAB on the customer master
    KNVK-NAME1
    KNVK-NAMEV
    KNVK-ABTNR
    KNVK-PAFKT
    KNVK-BRYTH
    How todo this? please anyone can explain the steps.
    Mohana

    If you are creating these fields with Business Data Tool Set.
    Then you will have field group and fields.
    Field are attached to field groups,
    Field groups are attached to view
    Views are attached to Section
    Sections are attached screen : you are calling as a tab
    Regards,
    Shiva Kumar
    removed by moderator
    Edited by: Jan Stallkamp on Dec 19, 2008 2:33 PM

  • How to Create Multiple Distribution Groups

    How to Create Multiple Distribution Groups using power shell?
    i have created new csv file with below format
    Name,Type
    Test01,Distribution
    test02,Distribution
    Executed below command and it's prompting for each and every account to enter the sam account name.
    [PS] C:\Windows\system32>Import-CSV "c:\dl\users.csv" | foreach {new-distributiongroup -name $_.name type $_.Type}
    cmdlet New-DistributionGroup at command pipeline position 1
    Supply values for the following parameters:
    SamAccountName:
    is there any other way to create bulk DL groups?
    Aucsna

    Please check this here is a similar thread.
    http://social.technet.microsoft.com/Forums/exchange/en-US/0f86bb8a-63a2-44e5-921f-4a227221e71d/creating-distribution-groups
    Thanks, MAS
    Please mark as helpful if you find my comment helpful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you.

  • TS2370 how to create iphone contact group

    does anyone know how to create a contact group on the iphone?
    thanks.

    Read this:
    http://www.ehow.com/how_5937574_make-contact-group-iphone.html

  • How to create new field groups in AA master data screen layout?

    Hello,
    We are using ECC 6.0
    We have created bunch of new fields for asset master data, but we want to make them visible only for particular asset class. So we need to customize in SPRO Asset Master Data Screen Layout, but there no specific field groups that we can customize. So how to create and add new field groups to manage them by radiobuttons Required, Optional, No or Display?

    hi,
    think, it's not possible.
    look here:
    http://help.sap.com/saphelp_47x200/helpdata/en/4f/71e05a448011d189f00000e81ddfac/frameset.htm
    "The field groups and their respective fields are defined in system tables"
    kind regards
    Andreas

  • ActionsScript 3 how to create on key down function?

    Ok so I understand that you make an event listener and an
    event handler, but I do not understand how to create a function
    were I can hold down a key and the object keeps moving until the
    key is up.
    With the following function it only moves it every time I
    press a certain key. I need to move while the key is held down
    until released. I looked around with google and couldn't really
    find anything other than how to do this in AS2, which isn't
    helpful. Please help! :D
    stage.addEventListener(KeyboardEvent.KEY_DOWN, jumpEvent);
    private function jumpEvent(event:KeyboardEvent):void
    if(event.keyCode == 17)
    nissanZ.x += 10;

    hey thanks a bunch vario pegged!
    its working pretty well :D

  • How to create a security group to manage a Distribution list in exchange 2013

    Hi folks,
    We have AD synced with Online Exchange 2013. Dirsync is installed on AD. We would like to create a security group for a Distribution list(for instance: distribution list name is [email protected] and it is managed via a security group named "abc" ).
    How can this be achieved? I do see an option under Online Exchange console using browser-> Groups to create a new security group but it doesn't allow me to add the group created in AD-instead it ask us to create a new one. If we create a new one in Exchange
    online console- will it publish to our local AD?

    Hi TR,
    Thank you for your question.
    Are there any errors when we could not add group which is in local AD.
    When we could not add group which was created In AD, there are following options we could check:
    If current user who logon Exchange server has enough permission to add it
    The connection between Exchange server and AD
    If we create a new DG in Exchange online, it will be published to local AD.
    We could run the following command to create DG for abc.com:
    New-DistributionGroup -Name "abc" -Alias abc -Type "Security" -MemberJoinRestriction open
    We could refer to the following link to learn more about distribution group:
    https://technet.microsoft.com/en-us/library/bb124513%28v=exchg.150%29.aspx
    If there are any questions regarding this issue, please be free to let me know. 
    Best Regard,
    Jim
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Jim Xu
    TechNet Community Support

Maybe you are looking for