How to handle Group by clause Dynamically in Oracle Form

Hi Expert,
Here i have problem :
i want display record with passing group by clause Parameter
Example :
Select zone,district,postal,count(Do_no) ,sum(Sales_Amt)
from DLV_ORD_mast
group by :zone,:district,:Postal
1-o/p like :
if user pass the :zone parameter in group by clause then record display like below o/p
zone count sls_amt
South 2 1000
central 3 5000
East 4 600
2-o/p
if use pass the :District parameter in group by clause then record display like below O/P
zone count sls_amt
South/Dist1 2 1000
central /Dist2 3 5000
central /Dist3 1 500
East /Dist4 4 600
2-o/p
if use pass the :postal parameter in group by clause then record display like below O/P
zone count sls_amt
South/Dist1/postal1 2 1000
central /Dist2/Postal2 3 5000
central /Dist3/postal3 1 500
East /Dist4/postal4 4 600
so if anybody come across same senario then Please give me the solution for this problem .
pleassssssssssssssssssssssssss
Thanks
Abhishek

Build a block one a Query FROM clause, like
SELECT GROUPCOL,
       CNT,
       SUMM
  FROM (Select zone GROUPCOL,
               count(Do_no) CNT,
               sum(Sales_Amt) SUMM
          from DLV_ORD_mast
         group by zone
)Then at runtime, change the the block QUERY_DATASOURCE_NAME by SET_BLOCK_PROPERTY depending on the parameter, e.g. to
SELECT GROUPCOL,
       CNT,
       SUMM
  FROM (Select zone ||', '|| DISTRICT GROUPCOL,
               count(Do_no) CNT,
               sum(Sales_Amt) SUMM
          from DLV_ORD_mast
         group by zone ||', '|| DISTRICT
)

Similar Messages

  • Order by clause  Dynamic in Oracle function

    How can i get order by Clause Dynamic in Oracle function
    My function Returns sql query with SYS_REFCURSOR . and i will pass the order by column as input parameter
      create or replace
    FUNCTION TEST_SSK
            p_srot  number
    RETURN SYS_REFCURSOR
    AS
    C_testssk SYS_REFCURSOR;
    BEGIN
    OPEN C_TESTSSK FOR
    SELECT LOAN_CODE,LOAN_DATE,DUE_DATE,LOAN_AMT FROM LOAN_MASTER
    order by P_SROT;
    return C_testssk;
    end;Edited by: user10736825 on Dec 22, 2010 11:34 AM

    you can go for a dynamic query ;)
    create or replace
    FUNCTION TEST_SSK
            p_srot  number
    RETURN SYS_REFCURSOR
    AS
    C_testssk SYS_REFCURSOR;
    l_str VARCHAR2(4000);
    l_order VARCHAR2(100);
    BEGIN
    l_str := 'SELECT LOAN_CODE,LOAN_DATE,DUE_DATE,LOAN_AMT FROM LOAN_MASTER ';
    IF p_sort = 'LC'
    THEN
      l_order := ' ORDER BY LOAN_CODE ';
    ELSIF p_sort = 'LD'
    THEN
      l_order := ' ORDER BY LOAN_DATE ';
    END IF;
      l_str := l_str || l_order ;
    OPEN C_TESTSSK FOR l_str;
    return C_testssk;
    end;

  • How to handle national character set datatypes in oracle?

    Hi
    Can anyone tell me how to handle national character set datatypes in oracle?
    Thanks in advance

    And for data manipulation, append "N" the literal values being used in the command.
    The "N" indicates that the string is to be treated as Unicode Text.
    For Example: insert into TableName (ColumnName) values (N'ValueToBeInserted');

  • How to call a COM object from an Oracle Form?

    Hi All,
    Pls advice. How to call a COM object from an Oracle Form?
    Thanks.

    try asking the "Form" forum

  • How can i do the following in the oracle forms developer :

    How can i do the following in the oracle forms developer :
    1- delete or add new item to block and canvus at the RUNTIME ????
    2- change the following property at the RUNTIME :
    - item type
    - datatype
    - database item
    - column name

    How can i do the following in the oracle forms
    developer :
    1- delete or add new item to block and canvus at the
    RUNTIME ????It's not possible, you can do enabled/not enabled, or visible/not visible
    2- change the following property at the RUNTIME :
    - item typeno
    - datatypeno
    - database itemno
    - column nameno
    You are not lucky :-)

  • How to use Group by clause in Infoset

    Hi,
    I have a infoset where I  am using two DSO .Now want to use the group by clause on basis of day, month, quarter .And also I want to use the left outer join .SO how will I do that ?
              Can somebody help me to to get these solved ?
    Regards
    Sunit

    Hi,
    for me it seems like Multiprovider is the one which we use in case when we want to go for group by option. This infoset is more kind of intersection operation.
    go through this link for more detailed info on Infoset
    http://help.sap.com/saphelp_nw2004s/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm
    Regards,
    rik

  • HOW TO ADD GROUP BY CLAUSE WHEN USING Jbo:Datatable

    Would like to know if there are any provisions for adding a Group by clause so the data shown using DataTable Component cn be grouped.
    eg:
    Currently using DataTable component shows data as shown below.
    Dept Name
    10 ABC
    10 DEF
    10 PQR
    20 XYZ
    20 QQQ
    Can this be done as shown bewlow
    Dept Name
    10 ABC
    DEF
    PQR
    20 XYZ
    QQQ
    Thanks

    Hi Sashi,
    For a bc4j view object, the shape of the result set needs to be consistent. So, there can not be a groupby directly in the result set.
    However, that does not prevent you from inserting a calculated column that performs a similar calculation.
    Another mechanism might be to consider a master detail arrangement of the views where the master contains an aggregation of data from its children. You are then free to access and display this data as you choose.
    Hope this helps,
    Pete

  • How to handle EXTENDED Views  SQL 2000 to Oracle Migration

    Hi All,
    I am in the process of migrating SQL server 2000 database to Orcle databse. I would like to know how to handle the views created in SQL server with Extended clause.
    See below for example for SQL 2000 view.
    create view "Order Details Extended" AS
    SELECT "Order Details".OrderID, "Order Details".ProductID, Products.ProductName,
         "Order Details".UnitPrice, "Order Details".Quantity, "Order Details".Discount,
         (CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS ExtendedPrice
    FROM Products INNER JOIN "Order Details" ON Products.ProductID = "Order Details".ProductID
    Thanks in advance for your reply.
    Ramesh

    Ramesh
    The Workbench has a problem with spaces in identifiers which will be fixed in a later release.
    Apart from that large drawback the view should work ok. [The parser handles convert and aliases]
    Turloch

  • How to handle Drop Down Box on Interactive Adobe Form

    Hi,
    On my adobe form there are some drop down boxes like company code, cost centre etc, actually i need F4 help on those fields,  but what i found is it's not possible to have F4 help on adobe form so i have choosen alternative as webdynpro acitvex drop down box in library. I have written a web dynpro application to fetch the data and display it on adobe interactive form, i could able to display the data for all the fields on adobe form except these drop down boxes, can any body suggest me how to handle these drop down boxes in webdynpro application. Your help will be greatly appreciated.
    Thansk & Regards,
    Venkat

    Hi Venkat,
    As you are using the WDP ActiveX dropdown in your form, it is fine but to populate values in the DD, you need to bind the context attribute with a simpletype and then populate the values. Use the below code to obtain a ModifiableSimple Type:
    IWDAttributeInfo abcInfo = wdContext.nodeABC().getNodeInfo().getAttribute("AttributeName");
                        ISimpleTypeModifiable def = abcInfo.getModifiableSimpleType();
                        IModifiableSimpleValueSet abcValueSet = def.getSVServices().getModifiableSimpleValueSet();
    and after this put te values in the obtained modifieable simple type like below:
    abcValueSet.put(key,value);
    where key may be the ID and value may be the name to be displayed in DD.
    Reward points if found helpful.
    Regards,
    Arafat

  • How are listbox and radiobutton items working in oracle forms?!?

    Hi all.
    I need some help over may be a standard case in every real project.
    Imagine i have a db table PERSONS -> PERSONID, NAME, TOWNID, MATRIALSTATUSID
    and table TOWNS -> TOWNID, TOWNNAME
    and table MATRIALSTATUS -> MATRIALSTATUSID, NAME
    And i have a standard oracle form with text item person name, listbox item with many towns (from TOWNS table) and the town of the concrete person is selected when the form is inited, after that we can change it by selecting other town and saving it to db.
    The same is with matrial status but lets make it as radio group with 3 buttons married, not merried, divorced.
    So my questions is how to populate the listbox(radiogroup) for 1 person by selecting data from other preferenced tables. And most important how this data is populated in the list box for example i.e. every town name is indexed in some way or what. I am a java developer and for example in java the control listbox item has two attributes the name(string) that is displayed in the listbox and a index binded for that name, and i work with indexes and show strings. I read about LOV but couldn't understand how to "index" the populated values. Is it possible.
    And please can you give me some example of how to load (populate + set current town), change and (if it is possible) "index". The same case appears to be valid with radio buttons and check boxes.
    You could give me some tutorials too, i cant find simple and focused on the problem examples.
    Thank you.
    Best Regards.

    Hi,
    well here is what i done for now.
    First I created recordGroup with query SELECT GENDER, GENDERID FROM GENDERS (I want to select all genders and place them in listbox)
    After that i created Listbox and on triger when-new-form i placed this code:
    DECLARE
    it ITEM:=FIND_ITEM('PERSONS_DETAILS.GENDER');
    BEGIN
    CLEAR_LIST(it);
    POPULATE_LIST(it, 'RG_LIST');
    DEFAULT_VALUE(NULL, 'GLOBAL.PERSONID');
    IF :GLOBAL.PERSONID IS NOT NULL THEN
    SET_BLOCK_PROPERTY('PERSONS_DETAILS', ONETIME_WHERE, 'PERSONID=' || :GLOBAL.PERSONID);
    GO_BLOCK('PERSONS_DETAILS');
    EXECUTE_QUERY;
    :GLOBAL.PERSONID:=NULL;
    END IF;
    END;
    Imagine i have a main form PERSONS that displays general information about many persons (the data is retrieved from PERSONS db table). The form PERSONS displays PERSONID, PERSON FIRSTNAME and PERSON LASTNAME. When a user double click on some row from the PERSONS FORM( i have tabular datablock that displays the person data) other form 'PERSONS_DETAILS' must be displayed with detailed information about the selected person. The data about the selected person is loaded well but i want gender to be listbox and the user can change it if he wants. So i have TABLE GENDERS 1:N with PERSONS and the table has GENDERID AND GENDER. When the user double clicks on single person i must populate the list with all possible genders from the GENDERS table and set the gender of the selected person. How to do that?
    P.S.: The example with gender is not very good because it could be only male female, but don't worry about it. You may think about gender list as townlist :)
    It finds me the GENDER LIST and populates it. After that i take the personId (that is global variable and comes from previous form) and displays all the data for the person with id personid.
    When i compile the form it gives me :
    FRM-30351: No list elements defined for list item.
    List GENDER
    Edited by: user9536806 on Nov 19, 2008 3:01 AM

  • How to change the parameter's value of Oracle Forms Applet?

    Hello,
    I'm working with Oracle Forms 10.1.2.3.0 and JRE 1.6.0_14, we got some performance issues and we think are related with Java, so we enabled Java trace and we realized that every time user moves the cursor from one item to another, the applet sends a request to the server. This is the request.
    network: Connecting http://server/forms/lservlet;jsessionid=e53bb50b2f95ecb357451bf21a291367cc1747d2d9956b3ba1c4a05916d87d34.e34LaheTahaLai0LaxyLbN4ObxqTe6fznA5Pp7ftolbGmkTy with proxy=DIRECT
    I want to disable these connections as Sun states that sometimes they are not needed (not sure if this is the case but we want to test it).
    I got a possible answer from a Sun forum, the possible fix is to set the following property to false:
    <APPLET ...>
    <PARAM name="codebase_lookup" value="false">
    </APPLET>
    But I don't know how to pass that parameter to Oracle Forms applet.
    Does anybody know?
    Thanks.

    You can try passing the parameter in the HTML template file ... for example in the $ORACLE_HOME/forms/server/basejpi.htm
    i.e.
    <PARAM NAME="TYPE" VALUE="%jpi_mimetype%">
    <PARAM NAME="CODEBASE" VALUE="%codebase%">
    <PARAM NAME="CODE" VALUE="oracle.forms.engine.Main" >
    <PARAM NAME="ARCHIVE" VALUE="%archive%" >
    <PARAM name="codebase_lookup" value="false">
    I have never done it myself so I do not know if it would be recognized though.

  • How to get recently opened module name in oracle forms

    hello experts,               I am using oracle forms 11g with oracle weblogic server 10.3.5 at windows 7.How can i get the module name opened in a particular session by a user in oracle forms. regards aaditya

    Hi,
    You can do this by using GET_APPLICATION_PROPERTY built-in and using its property CURRENT_FORM_NAME.
    More of its usage in Forms Builder -> Help menu -> Online Help  and type "Current Form Name Property".
    Hope this helps
    Regards
    Carlos

  • How to Return a value to a 10g Oracle Form form a Web Service Call

    I've read the demo available from Oracle, 'Calling a Web service from Oracle Forms', that shows how to invoke a call to a Web Service from a Form. The demo only shows how to do a call and how to display messages. I've done some searching, but can't seem to find any examples of how to return a value from the call into a field on the form. If any one could provide an example of that, I would greatly appreciate it.
    We are in the process of modifing a form and we would like to use a webservice, which we have never done before. We have created a webservice which calculates a value based upon what is entered on the form and we want to pass that calculated value back to a field on the form.
    This is the code provided by the demo to do a call.
    DECLARE
    jo ora_java.jobject;
    xo ora_java.jobject;
    rv varchar2(100);
    ex ora_java.jobject;
    BEGIN
    JO := SendServiceSoapClient.new;
    RV := SendServiceSoapClient.sendMessage(JO,:BLOCK3.PHONE_NUMBER, :BLOCK3.MESSAGE_BODY, xo, xo);
    EXCEPTION
    WHEN ORA_JAVA.JAVA_ERROR then
    message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
    WHEN ORA_JAVA.EXCEPTION_THROWN then
    ex := ORA_JAVA.LAST_EXCEPTION;
    message(Exception_.toString(ex));
    END;

    In the future, please be sure to include the exact product versions you are using. In this case, also be sure to include the java versions you are using to build your java code.
    http://blogs.oracle.com/shay/entry/10_commandments_for_the_otn_fo
    Regarding your question, take a look at this older white paper which discusses integrating Forms with SOA.
    http://www.oracle.com/technetwork/developer-tools/forms/documentation/forms-soa-wp-1-129441.pdf

  • How to connect to SQL server 2000 with Oracle Form

    Hi,
    I'm looking for the document of how to connect "SQL Server 2000" with Oracle Form 6i. Anyone knows that?

    Shay or other knowledgeable folks,
    Is there a way to utilize the wizard for "Business Tier > ADF Business Components > Business Components from Tables" for SQL Server 2000, 2005 or 2008. I can successfully execute sql via java programmatically or import a table from SQL Server with "Business Tier > ADF Business Components > Entity Object" wizard, but the Business Components from Tables simply doesn't see any tables under any schema. Without the "Business Components from Tables", i don't get the referential constraints imported into the application and to code all those from scratch is just not as elegant. So far i have only utilized the sql server jdbc driver from Microsoft (versions, 1.1, 1.2 and 2.0). Is there an alternative client that i need to use to enable selecting tables from that "Business Components from Tables" wizard. Is this a limitation of SQL Server, the jdbc driver or the wizard itself? Did anybody else experience the same issues? I am using Jdeveloper 11.1.1.0.1 against SQL Server 2005 (currently)
    Thanks,
    Andy

  • How to use advanced PL/SQL concepts in oracle forms/reports

    Hi all,
    Can any one suggest me how to use the advanced PL/SQL Concepts(nested tables,PAA,Varrays,Objects...) in Oracle forms.
    Actually i Created a Table having column of Varray datatype. now i want to create a item in oracle forms on this field. can any one suggest me the way to do this.
    Thanks,
    Kumar

    Hello,
    Have a look at this one:
    http://sheikyerbouti.developpez.com/tutoforms10g/tutoforms10g.htm
    particularly the chapter about block that contain a collection (2.3.3). The sample is built around a nested table but you have the idea to adapt it to work with a varray.
    Kind regards,
    Alex
    If someone's answer is helpful or correct please mark it accordingly.

Maybe you are looking for