Query quiz find a query for sine function distribution

Let me tell you something about distribution function.
Here, i use the term, 'distribution function' differently from what we use in general mathematics.
See the following query which generates self-counting sequence.
SELECT     TRUNC (1 / 2 + SQRT (2 * LEVEL)) level#
      FROM DUAL
CONNECT BY LEVEL <= 1000LEVEL#
1
2
2
3
3
3
4
4
4
4
5
5
5
5
5
and, if we add some group by and counting to the above query...
SELECT   level#
       , LPAD ('*', COUNT (*), '*')
    FROM (SELECT     TRUNC (1 / 2 + SQRT (2 * LEVEL)) level#
                FROM DUAL
          CONNECT BY LEVEL <= 1000)
GROUP BY level#we can see a graph like below
LEVEL# LPAD('*',COUNT(*),'*')
1      *
2      **
3      ***
4      ****
5      *****
6      ******
7      *******
8      ********
9      *********
10     **********
11     ***********
12     ************
13     *************
14     **************
15     ***************
16     ****************
17     *****************
18     ******************
19     *******************
20     ********************
...As we all know, this is like a function f(x) = x.
i use the term, 'distribution function' as this meaning!
Distribution of numbers of data values.
Now, my question is this.
Find a query that generates distribution function f(x) = sin(x)
(Here, any amplitude and any period of sine function is allowed except zero.
And only the form of sine function is important.
No subquery factoring or user-defined function or procedure is allowed.
Use simple select statement only.)
And now, have a good challenge!
SELECT   level#
       , LPAD ('*', COUNT (*), '*')
    FROM (
   -------- some query -------------------
GROUP BY level#
LEVEL# LPAD('*',COUNT(*),'*')
0      *
1      **
2      *******
3      *************
4      *****************
5      **********************
6      **************************
7      ******************************
8      **********************************
9      **************************************
10     ****************************************
11     ********************************************
12     *********************************************
13     ************************************************
14     *************************************************
15     *************************************************
16     **************************************************
17     **************************************************
18     *************************************************
19     ************************************************
20     ***********************************************
21     ********************************************
22     ******************************************
23     ***************************************
24     ***********************************
25     ********************************
26     ****************************
27     ************************
28     *******************
29     **************
30     *********
31     *****Query Your Dream & Future at
http://www.soqool.com

It's cheating but, hey I wanted to draw pretty pictures too... :o))
SQL> SELECT rn as degrees, decode(sign(val),-1,lpad(' ', scale-abs(val), ' ')
  2                        ||lpad('*',abs(val),'*'), lpad(' ', scale, ' ')||lpad('*',val,'*')) as graph
  3  from
  4  (select rownum-1 rn, (sin(((rownum-1)/180)*acos(-1))) * x.scale as val, x.scale
  5  from dual, (select 50 as scale from dual) x
  6  connect by rownum <= 360);
   DEGREES GRAPH
         0
         1
         2                                                   *
         3                                                   **
         4                                                   ***
         5                                                   ****
         6                                                   *****
         7                                                   ******
         8                                                   ******
         9                                                   *******
        10                                                   ********
        11                                                   *********
        12                                                   **********
        13                                                   ***********
        14                                                   ************
        15                                                   ************
        16                                                   *************
        17                                                   **************
        18                                                   ***************
        19                                                   ****************
        20                                                   *****************
        21                                                   *****************
        22                                                   ******************
        23                                                   *******************
        24                                                   ********************
        25                                                   *********************
        26                                                   *********************
        27                                                   **********************
        28                                                   ***********************
        29                                                   ************************
        30                                                   *************************
        31                                                   *************************
        32                                                   **************************
        33                                                   ***************************
        34                                                   ***************************
        35                                                   ****************************
        36                                                   *****************************
        37                                                   ******************************
        38                                                   ******************************
        39                                                   *******************************
        40                                                   ********************************
        41                                                   ********************************
        42                                                   *********************************
        43                                                   **********************************
        44                                                   **********************************
        45                                                   ***********************************
        46                                                   ***********************************
        47                                                   ************************************
        48                                                   *************************************
        49                                                   *************************************
        50                                                   **************************************
        51                                                   **************************************
        52                                                   ***************************************
        53                                                   ***************************************
        54                                                   ****************************************
        55                                                   ****************************************
        56                                                   *****************************************
        57                                                   *****************************************
        58                                                   ******************************************
        59                                                   ******************************************
        60                                                   *******************************************
        61                                                   *******************************************
        62                                                   ********************************************
        63                                                   ********************************************
        64                                                   ********************************************
        65                                                   *********************************************
        66                                                   *********************************************
        67                                                   **********************************************
        68                                                   **********************************************
        69                                                   **********************************************
        70                                                   **********************************************
        71                                                   ***********************************************
        72                                                   ***********************************************
        73                                                   ***********************************************
        74                                                   ************************************************
        75                                                   ************************************************
        76                                                   ************************************************
        77                                                   ************************************************
        78                                                   ************************************************
        79                                                   *************************************************
        80                                                   *************************************************
        81                                                   *************************************************
        82                                                   *************************************************
        83                                                   *************************************************
        84                                                   *************************************************
        85                                                   *************************************************
        86                                                   *************************************************
        87                                                   *************************************************
        88                                                   *************************************************
        89                                                   *************************************************
        90                                                   **************************************************
        91                                                   *************************************************
        92                                                   *************************************************
        93                                                   *************************************************
        94                                                   *************************************************
        95                                                   *************************************************
        96                                                   *************************************************
        97                                                   *************************************************
        98                                                   *************************************************
        99                                                   *************************************************
       100                                                   *************************************************
       101                                                   *************************************************
       102                                                   ************************************************
       103                                                   ************************************************
       104                                                   ************************************************
       105                                                   ************************************************
       106                                                   ************************************************
       107                                                   ***********************************************
       108                                                   ***********************************************
       109                                                   ***********************************************
       110                                                   **********************************************
       111                                                   **********************************************
       112                                                   **********************************************
       113                                                   **********************************************
       114                                                   *********************************************
       115                                                   *********************************************
       116                                                   ********************************************
       117                                                   ********************************************
       118                                                   ********************************************
       119                                                   *******************************************
       120                                                   *******************************************
       121                                                   ******************************************
       122                                                   ******************************************
       123                                                   *****************************************
       124                                                   *****************************************
       125                                                   ****************************************
       126                                                   ****************************************
       127                                                   ***************************************
       128                                                   ***************************************
       129                                                   **************************************
       130                                                   **************************************
       131                                                   *************************************
       132                                                   *************************************
       133                                                   ************************************
       134                                                   ***********************************
       135                                                   ***********************************
       136                                                   **********************************
       137                                                   **********************************
       138                                                   *********************************
       139                                                   ********************************
       140                                                   ********************************
       141                                                   *******************************
       142                                                   ******************************
       143                                                   ******************************
       144                                                   *****************************
       145                                                   ****************************
       146                                                   ***************************
       147                                                   ***************************
       148                                                   **************************
       149                                                   *************************
       150                                                   *************************
       151                                                   ************************
       152                                                   ***********************
       153                                                   **********************
       154                                                   *********************
       155                                                   *********************
       156                                                   ********************
       157                                                   *******************
       158                                                   ******************
       159                                                   *****************
       160                                                   *****************
       161                                                   ****************
       162                                                   ***************
       163                                                   **************
       164                                                   *************
       165                                                   ************
       166                                                   ************
       167                                                   ***********
       168                                                   **********
       169                                                   *********
       170                                                   ********
       171                                                   *******
       172                                                   ******
       173                                                   ******
       174                                                   *****
       175                                                   ****
       176                                                   ***
       177                                                   **
       178                                                   *
       179
       180
       181
       182                                                 *
       183                                                **
       184                                               ***
       185                                              ****
       186                                             *****
       187                                            ******
       188                                            ******
       189                                           *******
       190                                          ********
       191                                         *********
       192                                        **********
       193                                       ***********
       194                                      ************
       195                                      ************
       196                                     *************
       197                                    **************
       198                                   ***************
       199                                  ****************
       200                                 *****************
       201                                 *****************
       202                                ******************
       203                               *******************
       204                              ********************
       205                             *********************
       206                             *********************
       207                            **********************
       208                           ***********************
       209                          ************************
       210                         *************************
       211                         *************************
       212                        **************************
       213                       ***************************
       214                       ***************************
       215                      ****************************
       216                     *****************************
       217                    ******************************
       218                    ******************************
       219                   *******************************
       220                  ********************************
       221                  ********************************
       222                 *********************************
       223                **********************************
       224                **********************************
       225               ***********************************
       226               ***********************************
       227              ************************************
       228             *************************************
       229             *************************************
       230            **************************************
       231            **************************************
       232           ***************************************
       233           ***************************************
       234          ****************************************
       235          ****************************************
       236         *****************************************
       237         *****************************************
       238        ******************************************
       239        ******************************************
       240       *******************************************
       241       *******************************************
       242      ********************************************
       243      ********************************************
       244      ********************************************
       245     *********************************************
       246     *********************************************
       247    **********************************************
       248    **********************************************
       249    **********************************************
       250    **********************************************
       251   ***********************************************
       252   ***********************************************
       253   ***********************************************
       254  ************************************************
       255  ************************************************
       256  ************************************************
       257  ************************************************
       258  ************************************************
       259 *************************************************
       260 *************************************************
       261 *************************************************
       262 *************************************************
       263 *************************************************
       264 *************************************************
       265 *************************************************
       266 *************************************************
       267 *************************************************
       268 *************************************************
       269 *************************************************
       270 **************************************************
       271 *************************************************
       272 *************************************************
       273 *************************************************
       274 *************************************************
       275 *************************************************
       276 *************************************************
       277 *************************************************
       278 *************************************************
       279 *************************************************
       280 *************************************************
       281 *************************************************
       282  ************************************************
       283  ************************************************
       284  ************************************************
       285  ************************************************
       286  ************************************************
       287   ***********************************************
       288   ***********************************************
       289   ***********************************************
       290    **********************************************
       291    **********************************************
       292    **********************************************
       293    **********************************************
       294     *********************************************
       295     *********************************************
       296      ********************************************
       297      ********************************************
       298      ********************************************
       299       *******************************************
       300       *******************************************
       301        ******************************************
       302        ******************************************
       303         *****************************************
       304         *****************************************
       305          ****************************************
       306          ****************************************
       307           ***************************************
       308           ***************************************
       309            **************************************
       310            **************************************
       311             *************************************
       312             *************************************
       313              ************************************
       314               ***********************************
       315               ***********************************
       316                **********************************
       317                **********************************
       318                 *********************************
       319                  ********************************
       320                  ********************************
       321                   *******************************
       322                    ******************************
       323                    ******************************
       324                     *****************************
       325                      ****************************
       326                       ***************************
       327                       ***************************
       328                        **************************
       329                         *************************
       330                         *************************
       331                          ************************
       332                           ***********************
       333                            **********************
       334                             *********************
       335                             *********************
       336                              ********************
       337                               *******************
       338                                ******************
       339                                 *****************
       340                                 *****************
       341                                  ****************
       342                                   ***************
       343                                    **************
       344                                     *************
       345                                      ************
       346                                      ************
       347                                       ***********
       348                                        **********
       349                                         *********
       350                                          ********
       351                                           *******
       352                                            ******
       353                                            ******
       354                                             *****
       355                                              ****
       356                                               ***
       357                                                **
       358                                                 *
       359
360 rows selected.
SQL>

Similar Messages

  • Sql query to find the balances for a customer account wise.

    Hi,
    Could someone help me with the sql query to find the balances for each customer account wise. This is need to generate the report.
    presently we are using this query, but the output doesnot return the expected result.
    SELECT sum(nvl(ps.acctd_amount_due_remaining,0)) "Balance"
    FROM      ra_cust_trx_line_gl_dist_all gld,
              gl_code_combinations c,
              ar_payment_schedules_all ps,
              RA_CUSTOMER_TRX_ALL rat,
              ra_customers rc
    WHERE      c.CHART_OF_ACCOUNTS_ID = 101
    and gld.code_combination_id = c.code_combination_id
         and rat.CUSTOMER_TRX_ID=gld.CUSTOMER_TRX_ID
         and rat.CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
    and ps.customer_id=rc.customer_id
         and ps.status='OP'
         and ps.gl_date <= :PDATE
         and ps.org_id=:PORGID
         and ps.class in ('GUAR','INV','DM','DEP')
    and c.SEGMENT4=:Account_id
    and ps.customer_id=:Customer_id
    Thanks in advance.
    Kalyan.

    Can someone help us with this.

  • Sql query to find all contacts for an account

    I wonder if someone wrote an sql query to find all contacts for an account number in Oracle customer master. We are on EBS 11.5.10.
    I am also looking for sql query to find all ship to addresses for an account number.
    Thanks.

    Can you also post the query for people who read this post and are also looking for an answer?
    Regards,
    Johan Louwers.

  • Correlated query to find cheapest manufacturer for a product

    Hi,
    I have a SQL Query that returns me:
    - the "product code" i must purchase,
    - the "quantity" to purchase for this product
    - and if it's in "promotion or not".
    Based on this result, i must to look at "manufacturer" table and find the cheapest "price" for each product to purchase and the quantity available at the manufacturer.
    If "quantity to order" (e.g. 20) is higher than "quantity available" (e.g. 12) at "cheapest manufacturer", i must order the missing quantity (8) to the next cheapest manufacturer.
    How can i do that ?
    thx

    ​Hi
    >>correlated query to find cheapest manufacturer for a product
    I have created two table [ProdTable] , [Product Code] to get the cheapeast manufacturer  for a product  which you can refer to .
    [Product Table]
    [Prod Table]
    select [ProdTable].[S_Prod_Code],Min([ProdTable].[Prod_Cost]) as MiniCost
    from [ProdTable] inner join [Product Table] on [ProdTable].[S_Prod_Code]=[Product Table].[Product Code]
    Where [Product Table].[Promotion]<>"YES"
    group by [ProdTable].[S_Prod_Code]
    Using the above query ,you can get the cheapest  cheapeast manufacturer  for a product , which the promotion is not YES
    >>for promotional products, i must firstly check if the cheapest manufacturer has enough prod in stock. If not, i order all the prod in stock the manufacturer has, and i must order to missing ones to the next cheapest manufacturer
    Are you looking for a select query or an update to the table or form design ?Can you separate your business rules with the technolege ?  So more people could understand your issues well to give you more help.
    Thanks for your understanding
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Query to find supervisor_id hierarchy for a person

    Hi,
    I have a requirement, where i have to find the supervisor id hierarchy (bottom up) for a person. I am using below query to get it.
    SELECT LEVEL ,LPAD ( ' ', 7 (LEVEL-1)) || paaf.person_id AS person_id*
    FROM   per_all_assignments_f paaf
    WHERE sysdate between paaf.effective_start_date and paaf.effective_end_date
    START WITH paaf.person_id=2338
    CONNECT BY PRIOR paaf.supervisor_id  =  paaf.person_id
    Above query is returning the follwing results as i expected.
    1 2338
    2 2212
    3 2105
    Here, for 2338 supervisors is------> 2212 supervisor is -----------> 2105
    Now, my requirement is, for each person i have to find the direct reporteee list in separate column.
    for 2338, need to find direct reportees--------> for 2212, find direct reportees--------> for 2105, find direct reportees in separte column
    Note: I am developing a reporting to display the results like above.
    Any help is appreciated.
    Thanks in advance.

    Please use the below query it may help you get the employee & supervisor
    SELECT ROWNUM
    , pax.supervisor_id
    , pax.person_id
    , ppx.employee_number
    , mgx.employee_number supervisor_staff_number
    , REPLACE (ppx.full_name, '''', ' ') full_name
    , REPLACE (mgx.full_name, '''', ' ') supervisor_full_name
    , pj.NAME job_name
    , LEVEL
    FROM per_assignments_x pax
    , per_people_x ppx
    , per_people_x mgx
    , per_jobs pj
    WHERE ppx.person_id = pax.person_id
    AND ppx.current_employee_flag = 'Y'
    AND mgx.person_id = pax.supervisor_id
    AND pj.job_id = pax.job_id
    START WITH ppx.employee_number = :p_emp_num
    CONNECT BY NOCYCLE PRIOR mgx.employee_number = ppx.employee_number
    --ORDER BY   1 ASC;
    Sandeep Yaparla

  • Query to find Org ID for a respnsibility

    Hi,
    I do not have access to Application.
    Can any one suggest me, how to find the org_id for a particular responsibility?
    Thanks,
    Santhosh

    Hi Satyaki_De,
    Thanks for the response.
    I'm talking about Oracle Apps 11i (Application), for which I do not have access as of now. (do not have login ID/pwd)
    How can I find the org_id for the responsibility, 'Inventory organization' (Inv ADM Support, responsibility name)
    I could get the responsibility ID from the table, FND_RESPONSIBILITY_TL
    How do I match this with profile table to get Org_id?
    Thanks,
    Santhosh

  • Need Query to find Pending Quantity for Receipts

    Hi all,
    Can any one please help me in finding the pending quantity for a particular Receipt.
    ex. If a receipt has
    transaction_type Quantity
    Receive 15
    Accept 5
    Deliver 5
    then my accepted quantity should be (Receive-Deliver) = 10
    I have written a query
    SELECT RSH.RECEIPT_NUM RECEIPT_NUM, RSH.CREATION_DATE CREATION_DATE, RT.TRANSACTION_TYPE TRANSACTION_TYPE, NVL(RT.QUANTITY, 0) QUANTITY,rt.destination_type_code destination_type_code,
                   RT.UNIT_OF_MEASURE UNIT_OF_MEASURE, RSL.ITEM_DESCRIPTION ITEM_DESCRIPTION, NVL(RT.PO_UNIT_PRICE, 0) PO_UNIT_PRICE,
                   RT.CURRENCY_CODE CURRENCY_CODE, NVL(RT.CURRENCY_CONVERSION_RATE,0) RATE, RSL.SHIPMENT_LINE_ID SHIPMENT_LINE_ID,
                   NVL(RT.QUANTITY * RT.PO_UNIT_PRICE * RT.CURRENCY_CONVERSION_RATE ,0) VALUE               
         FROM RCV_TRANSACTIONS RT, RCV_SHIPMENT_HEADERS RSH, RCV_SHIPMENT_LINES RSL, PO_VENDORS POV, PO_VENDOR_SITES POVS,
              ORG_ORGANIZATION_DEFINITIONS ORG, HR_LOCATIONS_ALL_TL HRL, PO_LOOKUP_CODES PLC,
              RCV_SUPPLY RS
         WHERE RSH.SHIPMENT_HEADER_ID = RT.SHIPMENT_HEADER_ID
              AND RSH.SHIPMENT_HEADER_ID = RSL.SHIPMENT_HEADER_ID
              AND RSH.RECEIPT_NUM IS NOT NULL
              AND POV.VENDOR_ID (+) = RSH.VENDOR_ID
              AND POVS.VENDOR_SITE_ID (+) = RSH.VENDOR_SITE_ID
              AND HRL.LOCATION_ID (+) = RSH.SHIP_TO_LOCATION_ID AND HRL.LANGUAGE(+) = USERENV('LANG')
              AND ORG.ORGANIZATION_ID (+) = RSH.ORGANIZATION_ID AND RSH.RECEIPT_SOURCE_CODE = PLC.LOOKUP_CODE
              AND PLC.LOOKUP_TYPE = 'SHIPMENT SOURCE TYPE'
              AND RS.RCV_TRANSACTION_ID = RT.TRANSACTION_ID
              AND RT.SHIPMENT_LINE_ID = RSL.SHIPMENT_LINE_ID
              AND RT.TRANSACTION_TYPE IN ('RECEIVE','TRANSFER')
         ORDER BY 1
    I want want the pending quantity...
    Please help

    You can get the quantities in po line locations, then you can find the balance quantity to be received.
    you can get the following from po line locations.
    quantity
    quantity_received
    quantiy_accepted
    quantity_rejected
    quantity_billed
    quantity_cancelled
    --Prasanth                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL Query to find cumulative values for a Financial Year

    Dear users,
    My requirement is to create a SQL query for a table/view where I have day-wise data. I want to find out cumulative values for financial year by giving any date. It should add the values from start of financial year till that date in the financial year.
    I think creating a view of such type will post heavy burden on resources since accuimulation will be done for each day upto that day.
    Thanks

    Dear users,
    My requirement is to create a SQL query for a
    table/view where I have day-wise data. I want to
    find out cumulative values for financial year by
    giving any date. It should add the values from start
    of financial year till that date in the financial
    year.
    I think creating a view of such type will post heavy
    burden on resources since accuimulation will be done
    for each day upto that day.
    ThanksKumar's solution will serve yours purpose but m not agreed
    I think creating a view of such type will post heavy
    burden on resources since accuimulation will be done
    for each day upto that day. Khurram

  • Query to find attachement information for wip operation seq number

    Hi Experts,
    I am working on EBS 11.5.10 and database 9i. I want table link to find attachments for particular operation sequence number.
    Navigation:
    WORK IN PROCESS --> DISCRETE JOBS --> OPERATIONS --> ATTACHMENTS(IN MENU YOU CAN FIND).
    In operations screen, for each operation sequence number, you can have attachement.In attachement, i want to pick the remarks column.
    Table: OPERATIONS -- WIP_OPERATIONS
    ATTACHEMENTS - FND_ATTACHED_DOCS_FORM_VL
    REMARKS - fnd_documents_short_text
    Link between FND_ATTACHED_DOCS_FORM_VL and fnd_documents_short_text is media_id. But i am not able to find the link between wip_operations and fnd_attached_docs_form_vl.
    Could anybody help me how to get attachement data for a particular operation sequence number.
    Thanks in advance.

    The link is
    entity_type = 'WIP_DISCRETE_OPERATIONS' and
    pk1_value =wip_entity_id and
    pk2_value = operation_seq_num and
    pk3_value = organization_idHope this answers your question,
    Sandeep Gandhi

  • Query to find all dependencies for a lookup type

    I have a lookup type and i need to find all the concurrent programs using it.

    Need dependencies for a particular Flexfield structure too.. pls help !!

  • QUERY TO FIND FREE DISKSPACE IN SCCM 2012 DISTRIBUTION POINT

    this is the query to get free disk space on distribution point ,but this is not working for sccm 2012 ,please help
    Select
    Distinct
    SD
    .Name0,
    SR
    .RoleName,
    LD
    .DeviceID0,
    LD
    .FreeSpace0
    * 100
    /  LD.Size0
    'Free Disk Space'
    From
    v_R_System SD
    Join
    v_Gs_Logical_Disk LD on SD.ResourceId
    = LD.ResourceId
    Join
    v_SystemResourceList SR on SD.Netbios_Name0
    = SR.ServerName
    Where
    LD.DriveType0
    = 3
    and
    SR.RoleName
    =
    'SMS Distribution Point'
    ankith

    you're probably getting 0 rows... 
    v_SystemResourceList.ServerName contains the netbios+domain name, while v_Gs_Logical_Disk.Netbios_Name0 only contains the netbios name (no domain), therefore the join doesn't find any matching rows...
    You need to trim the domain name from the field {LEFT(SRL.ServerName,CHARINDEX('.', SRL.ServerName)-1)}
    try this query instead:
    SELECT DISTINCT
    SYS.Name0 As 'Device'
    ,SRL.RoleName As 'Role'
    ,LD.DeviceID0 As 'Disk',LD.FreeSpace0,LD.Size0
    ,LD.FreeSpace0 * 100 / LD.Size0 As 'Free Disk Space'
    FROM
    v_R_System As SYS
    Join v_Gs_Logical_Disk As LD on SYS.ResourceId = LD.ResourceId
    Join v_SystemResourceList As SRL on SYS.Netbios_Name0 = LEFT(SRL.ServerName,CHARINDEX('.', SRL.ServerName)-1)
    WHERE
    LD.DriveType0 = 3
    And SRL.RoleName = 'SMS Distribution Point'
    Additionally, if you notice that the LD.FreeSpace0 field returns NULL, you need to enable the hardware Inventory collection of this information [ client settings > hardware inventory > Logical Disk (SMS_LogicalDisk) > Free Space (MB) ]... Then initiate
    the hardware Inventory cycle action and it should show results...
    I don't have this field inventoried, so I cannot confirm the accuracy of the query...

  • Trying to create a Histogram type/object for aggregate functions

    Hi,
    I am trying to create an aggregate function that will return a histogram
    type.
    It doesn't have to be an object that is returned, I don't mind returning
    a string but I would like to keep the associative array (or something
    else indexed by varchar2) as a static variable between iterations.
    I started out with the SecondMax example in
    http://www.csis.gvsu.edu/GeneralInfo/Oracle/appdev.920/a96595/dci11agg.htm#1004821
    But even seems that even a simpler aggregate function like one strCat
    below (which works) has problems because I get multiple permutations for
    every combination. The natural way to solve this would be to create an
    associative array as a static variable as part of the Histogram (see
    code below). However, apparently Oracle refuses to accept associate
    arrays in this context (PLS-00355 use of pl/sql table not allowed in
    this context).
    If there is no easy way to do the histogram quickly can we at least get
    something like strCat to work in a specific order with a "partition by
    ... order by clause"? It seems that even with "PARALLEL_ENABLE"
    commented out strCat still calls merge for function calls like:
    select hr,qtr, count(tzrwy) rwys,
    noam.strCat(cnt) rwycnt,
    noam.strCat(tzrwy) config,
    sum(cnt) cnt, min(minscore) minscore, max(maxscore) maxscore from
    ordrwys group by hr,qtr
    Not only does this create duplicate entries in the query result like
    "A,B,C" and "A,C,B" it seems that the order in rwycnt and config are not
    always the same so a user can not match the results based on their
    order.
    The difference between my functions and functions like sum and the
    secondMax demonstrated in the documentation is that secondMax does not
    care about the order in which it gets its arguments and does not need to
    maintain an ordered set in order to return the correct results. A good
    example of a built in oracle function that does care about all its
    arguments and probably has to maintain a similar data structure to the
    one I want is the PERCTILE_DISC function. If you can find the code for
    that function (or something like it) and forward a reference to me that
    in itself would be very helpful.
    Thanks,
    K.Dingle
    CREATE OR REPLACE type Histogram as object
    -- TYPE Hist10 IS TABLE OF pls_integer INDEX BY varchar2(10),
    -- retval hist10;
    -- retval number,
    retval noam.const.hist10,
    static function ODCIAggregateInitialize (sctx IN OUT Histogram)
    return number,
    member function ODCIAggregateIterate (self IN OUT Histogram,
    value IN varchar2) return number,
    member function ODCIAggregateTerminate (self IN Histogram,
    returnValue OUT varchar2,
    flags IN number) return number,
    member function ODCIAggregateMerge (self IN OUT Histogram,
    ctx2 IN Histogram) return number
    CREATE OR REPLACE type body Histogram is
    static function ODCIAggregateInitialize(sctx IN OUT Histogram) return
    number is
    begin
    sctx := const.Hist10();
    return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(self IN OUT Histogram, value IN
    varchar2)
    return number is
    begin
    if self.retval.exist(value)
    then self.retval(value):=self.retval(value)+1;
    else self.retval(value):=1;
    end if;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateTerminate(self IN Histogram,
    returnValue OUT varchar2,
    flags IN number)
    return number is
    begin
    returnValue := self.retval;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateMerge(self IN OUT Histogram,
    ctx2 IN Histogram) return number is
    begin
    i := ctx2.FIRST; -- get subscript of first element
    WHILE i IS NOT NULL LOOP
    if self.retval.exist(ctx2(i))
    then self.retval(i):=self.retval(i)+ctx2.retval(i);
    else self.retval(value):=ctx2.retval(i);
    end if;
    i := ctx2.NEXT(i); -- get subscript of next element
    END LOOP;
    return ODCIConst.Success;
    end;
    end;
    CREATE OR REPLACE type stringCat as object
    retval varchar2(16383), -- concat of all value to now varchar2, --
    highest value seen so far
    static function ODCIAggregateInitialize (sctx IN OUT stringCat)
    return number,
    member function ODCIAggregateIterate (self IN OUT stringCat,
    value IN varchar2) return number,
    member function ODCIAggregateTerminate (self IN stringCat,
    returnValue OUT varchar2,
    flags IN number) return number,
    member function ODCIAggregateMerge (self IN OUT stringCat,
    ctx2 IN stringCat) return number
    CREATE OR REPLACE type body stringCat is
    static function ODCIAggregateInitialize(sctx IN OUT stringCat) return
    number is
    begin
    sctx := stringCat('');
    return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(self IN OUT stringCat, value IN
    varchar2)
    return number is
    begin
    if self.retval is null
    then self.retval:=value;
    else self.retval:=self.retval || ',' || value;
    end if;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateTerminate(self IN stringCat,
    returnValue OUT varchar2,
    flags IN number)
    return number is
    begin
    returnValue := self.retval;
    return ODCIConst.Success;
    end;
    member function ODCIAggregateMerge(self IN OUT stringCat,
    ctx2 IN stringCat) return number is
    begin
    self.retval := self.retval || ctx2.retval;
    return ODCIConst.Success;
    end;
    end;
    CREATE OR REPLACE FUNCTION StrCat (input varchar2) RETURN varchar2
    -- PARALLEL_ENABLE
    AGGREGATE USING StringCat;

    GraphicsConfiguration is an abstract class. You would need to subclass it. From the line of code you posted, it seems like you are going about things the wrong way. What are you trying to accomplish? Shouldn't this question be posted in the Swing or AWT forum?

  • Replacement  for a function module in  6.0

    Hi
       I  am in the process of upgrading from 4.7 to 6.0 . The function module SAPWL_STATREC_READ_FILE is flagged as obsolete . Am unable to find a documentation for this function module . So which is the replacement for this function module . ?
    Please help . .

    hi,
    the replacement is SAPWL_STATREC_DIRECT_READ
    next time check the source code of the FM, probably you'll find the answer...
    hope this helps
    ec

  • Query to find out controls displayed as in UI for an applet,along with view

    Hi,
    I am looking for a query to find out list of all the controls as displayed in UI applet along with applet's view.
    Please note that in the query only mapped controls (those displayed in UI ) should come up.
    Regards,
    Kunal

    Hi,
    If the EUL is an apps mode (EBS) EUL then the eu_username column is the apps user id or apps resp id. If you want to show only the responsibilities and convert those ids to names then you need to use the EUL5_GET_APPS_USERRESP function like this:
    select ba_name, ba_developer_key, EUL5_GET_APPS_USERRESP(eu.eu_username, 'R') responsibility_name
    from eul5_bas ba
       , eul5_access_privs ap
       , eul5_eul_users eu
    where ba.ba_id = ap.gba_ba_id
    and ap.ap_type = 'GBA'
    and ap.ap_eu_id = eu.eu_id
    and eu.eu_role_flag=1
    order by 1,2,3Rod West

  • Sql query to find dependencies for a table

    Hi All,
    I am having a table (REPT_ALL) with dependent objects on it ( child tables, indexes, constraints, views, synonyms, sequences , packages,procedures,functions,triggers).
    I want the query to find out all the above dependencies for the above table(REP_ALL).
    I m looking for the query to find dependencies inorder to find out the risks before dropping the above table(drop table REP_ALL cascade constraints)?
    Thnx

    To find foreign key constraints for a table you cannot use DBA_DEPENDENCIES but you have to use DBA_CONSTRAINTS.
    Example Re: Find out foreign key column

Maybe you are looking for

  • How to print 3 rows in same line in to smartforms

    Hi all experts and seniors..... I want to print three records in a same row of layout e.x No.  Date     Qty         No.  Date    Qty                  No.  Date     Qty 1      2007    10            2    2007   20                   3      2007      15

  • Dynamically change the value in standard text

    Hi all,   I have created standard text using SO10  transaction. I have included the text id in SAP FORM. My requirement is some text need to change dynamically in the text  when printing the form.Is there any way to do it. Thanks Suadrsana

  • Why make process size so huge on WindowsXP?

    It seems like no matter how much memory my application uses. For example I can make a very simple app that just shows a JFrame. Runtime.getRuntime.totalMemory() claims that I am using 4MB, which seems like a lot for a simple frame window. TaskManager

  • Using laptop on separate home and office wireless networks

    I have a laptop the connects (wireless) to my home router and my other home computers. At work we have a wireless router (both home and office are linksys wrt54g's). I can connect to the router at work, get to the internet, but can't "see" the other

  • Upload binary files with Developer Forms

    Hi all, I'm newbie with Forms and I don't know if this question is already answered. I'm deploying an application involved with blob columns (binary files: pdf, doc, gif, etc) I want to let users to choose files from his PCs (typical "Browse files" b