How to create a dyanamic query in PL/SQL from XML

Hi Forum,
I am having an XML file with tags. I am controlling my JSP page layout with these tags and it is working fine. But I need to send the Orange colour nodes to a pl/sql in the JSP page to construct the query as per the XML
<?xml version="1.0"?>
<Jobmanage>
<Customer name="StGeorge">
<Column>
<Name>QM_NUMBER</Name>
<Title>Job Number</Title>
<Width>10</Width>
<Font>Arial</Font>
<Size>10</Size>
<Align>center</Align>
<Display>Yes</Display>
<cloumn1> QM_NUMBER <column1>
</Column>
<Column>
<Name>QM_JOB_STATUS</Name>
<Title>Job Status</Title>
<Width>10</Width>
<Font>Arial</Font>
<Size>105</Size>
<Align>center</Align>
<Display>Yes</Display>
<column2>QM_JOB_STATUS</column2>
</Column>
<Column>
<Name>QM_USER_STATUS</Name>
<Title>User Status</Title>
<Width>10</Width>
<Font>Arial</Font>
<Size>10</Size>
<Align>center</Align>
<Display>Yes</Display>
<column3>QM_USER_STATUS</column3>
</Column>
</Customer>
</Jobmanage>
The select statement I am using n the JSP page is
SELECT Q.QM_NUMBER, Q.QM_JOB_STATUS, Q.QM_USER_STATUS FROM QMI Q WHERE ((Q.QM_JOB_STATUS IN (5, 6, 7, 8, 9, 10)) OR (Q.QM_JOB_STATUS IN (12) AND Q.QM_CLOSE_DATE >= SYSDATE - INTERVAL '6' MONTH))
Can you give me instructions how to create the above SQL statement dynamically as per the XML file. I want the select statement in a pl/sql
BEGIN
SELECT Q.QM_NUMBER, Q.QM_JOB_STATUS, Q.QM_USER_STATUS FROM QMI Q WHERE ((Q.QM_JOB_STATUS IN (5, 6, 7, 8, 9, 10)) OR (Q.QM_JOB_STATUS IN (12) AND Q.QM_CLOSE_DATE >= SYSDATE - INTERVAL '6' MONTH))
END
So, when ever the columns hirerachy changed in the XML file it should show theat effect in the PL/SQl. Thats hoe I am aiming to develop.
Thankx for you time.
Cheers,
Krishna

I want the select statement in a pl/sql BEGIN
SELECT Q.QM_NUMBER, Q.QM_JOB_STATUS, Q.QM_USER_STATUS FROM QMI Q WHERE ((Q.QM_JOB_STATUS
IN (5, 6, 7, 8, 9, 10)) OR (Q.QM_JOB_STATUS IN (12) AND Q.QM_CLOSE_DATE >=
SYSDATE - INTERVAL '6' MONTH)) ENDThat doesn't make sense. Such a plsql block would not compile. What is your final goal you want to achieve with this?

Similar Messages

  • How to Create a Functiona Query

    Dear all,
    Could any body detail me how to create a functional query. Please give me step by step procedure to create a query.
    I would appreciate if you can give me a material with screen shots. Your help will be highly appreciated.
    Thank you
    Raghu Ram

    Hi Raghu,
               Go through this document it may help you,
    SAP Query
    Step 1: Create User Group – SQ03
    Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > User Groups
    a) In the User Group: Initial Screen -
    Enter User Group Code (self named)
    Click on “Create”
    b) In the User Group (Code): Create or Change pop-up window -
    Enter the User Group Description
    Click on “Save”
    c) In the Create Object Directory Entry pop-up window -
    Ö Click on “Local Object” button
    Ö The User Group Created is saved
    Step 2: Create User Group – SQ02
    Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Infosets
    a) In the Infoset: Initial screen -
    Ö Enter Infoset Code (self named)
    Ö Click on “Create” button
    b) In the Infoset: Title & Database Screen -
    Ö Enter Description of Infoset in the “Name” field
    Ö In the Data Source selection: Select appropriate Data Source by clicking
    the radio button
    · Source the data can either be multiple tables OR single table. There are 4
    options for the user to select from
    Ö Click on “Continue” (Enter)
    Ö Selected Table gets displayed in the Infoset : Initial Screen
    c) In the Infoset: Initial Screen -
    Ö Click on “Insert Table” button
    d) In the Add Table Screen -
    Ö Enter the Table Name that is to be inserted
    Ö Click “Continue” (Enter)
    e) In the Infoset: Initial Screen -
    Ö Click on “Back” button
    f) In the Field Group Defaults pop-up Screen -
    Ö Select Appropriate Field Group Option by clicking on the radio button
    · there are 3 options to select from. User can select Empty Field Group
    option and then select the data fields in the steps explained further.
    Alternatively, User can select an option which clubs all the data fields
    From all the tables selected
    Ö Click “Continue” (Enter)
    g) In the Change Infoset Screen -
    · the left side lists the Tables that the user has selected in step b, c & d
    · In the right side, system creates field groups, one for each table listed in the
    left part. Initially, the Field Groups are empty
    Ö In the Left Side, Click on the arror next to the table name and expand and
    display all the data fields in the table
    Ö Select a Data Field from the expanded Table view, which is to be added to
    the Field Group on the right.
    Ö Select a Field Group on the right side, in which Data Field selected above
    has to be added
    Ö Right click on the Data Field selected and click on “Add Field to Field Group”
    Ö The selected Data Field gets added to the selected Field Group, which is
    indicated by an arrow next to the Field Group.
    Ö Carry out the steps above to add the required Data Fields to the respective
    Field Groups
    Ö After transferring Data Fields to Field Groups click on “Generate” button
    h) In the Create Object Directory Entry Screen -
    Ö Click on “Logical Object” button to generate the infoset
    i) In the Change Infoset Screen -
    Ö Click on the “Back” button
    j) User is taken back to the “Infoset: Initial Screen” which displays the
    created Infoset record.
    Step 3: Assigning User Group to Infoset – SQ03
    Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > User Groups
    a) In the User Groups: Initial screen -
    Ö Enter the User Group for which Infoset is to be assigned
    Ö Click on “Assign Users & Infosets” button
    b) In the User Group: Assign Users Screen -
    Ö Click on “Assign Infosets” button
    c) In the next screen, select the Infoset, which needs to be attached to the
    User Group selected
    d) Click on the “Back” button
    Step 4: Creating Query – SQ00 & SQ01
    Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Queries
    a) In the “Query from User Group: Initial Screen -
    Ö Click on “Other User Groups” button
    Ö In the pop-up screen, User Groups, select the User Group for which the
    Query has to created. The pop-up screen closes.
    Ö Enter the Query Code in the “Query” field
    Ö Click on “Create” button
    b) A pop-up screen “Restrict Value Range” shows the list of Infosets assigned to
    the User Group
    Ö Select the Infoset for which Query has to be created
    c) In the new screen Create Query: Title, Format -
    Ö Enter the Description of the Query in the “Title” field
    Ö Click on the “Next Screen” button
    d) In the Select Field Group” screen
    Ö Select the Field Groups from which Data Fields have to be selected for the
    Output
    Ö Click on the “Next Screen” button
    e) In the “Select Field” screen -
    Ö Select the Data Fields, which should appear in the output
    Ö Click on the “Next Screen” button
    f) In the Screen “Selection” -
    Ö Select the Data Fields for the selection criteria
    Ö Enter the sequence in which the selected fields would appear in the input
    screen of the query.
    Ö Define if the selection criteria should be Single Value or Multiple Value Range
    by clicking in the appropriate check boxes
    Ö Click on the “Basic List’ button
    g) In the screen “Query Layout Design” -
    Ö Select the Output Fields from the Data Fields section by clicking the
    appropriate check box
    Ö Change the sequence of Data Field columns if required
    Ö Click on the “Test” button to test the query created
    h) On the “Test Query” screen click “Continue”
    i) In the “Query” screen -
    Ö Enter the selection criteria
    Ö Click on “Execute” button
    j) Save the Query created
    Step 5: Running the Query – SQ00
    a) In the Query From User Group: Initial screen –
    b) Click on “Other User Groups” button to select the User Group
    c) In the pop-up screen “User Groups” select the User Group
    d) System lists all the queries created for the User Group
    e) Select the appropriate Query
    f) Click on “Execute” button
    g) User is taken to the Selection screen
    h) Enter the selection criteria and click on “Execute” button
    i) System runs the query and gives the output
    Regards,
    Murali.

  • HOW TO CREAT VARIANT IN QUERY

    Hi,
    its very simple question but i want the procdure for it.
    how to creat variant in query &maintain?don't give URL's i try it already plzzz.any body have the steps regarding this topic..
    plzzzzzzzz urgent ...
    thanks,
    goodyear..

    Hi,
    If you're using the BEx Analyzer, you can create a variant at the variable selection screen. There is a button "save as variant" and you can also maintain existing variants.
    Best regards.
    LauQ

  • How to Create Specific SAP Query for Sales BOM

    Dear All Salute !!
    How I can create a SAP Query which provide information from the Sales Order-Line Item, this specific material is having any BOM or not?
    Suppose, user want Input,
    Sales Order No., Product Category, Duration of Sales Order Release.
    want Output,
    Sales Order No., Customer No., Customer Description, Sales Order Line Item, Material No., Material Description, Delivery Date, Quantity, Sales Order release Date
    Users requirement is, List of All Line Items for which BOM is yet to be Uploaded in the System.
    Please provide complete detail with Table & field by using SAP Query.
    Rgds
    Srivastav
    +91-9973504950

    If I am correct, in table KDST, you can see the details of Sales BOM with sale order.  Since right now, I dont have access to SAP, I am unable to confirm this.  You have to consider this table and develop on your own logic with the help of ABAPer.
    thanks
    G. Lakshmipathi

  • How to create an rule with action to subtract from the event log of Ips manager express console?

    how to create an rule with action to subtract from the event log of Ips manager express console?, some knows of has an guide?.
    Thank you.
    Sent from Cisco Technical Support iPad App

    Hi,
    http://www.cisco.com/en/US/products/sw/secursw/ps2113/products_tech_note09186a0080bc7910.shtml
    HTH
    Luis Silva
    "If you need PDI (Planning, Design, Implement) assistance feel free to reach us"
    http://www.cisco.com/web/partners/tools/pdihd.html

  • How to create a file under web application root from java program

    how to create a file under web application root from java program like an action class?

    like an action class?Huh? What exactly is your requirement?
    Creating a file is usually done with java.io API. Read the java.io tutorials how to play with files.

  • How to create nested CASE statements in PL/SQL

    Can anyone please tell how to create Nested CASE statements in PL/SQL with proper syntax?
    It would be better if you can help with an example.
    Thank you!

    Something like this:
    SQL> set serveroutput on
    SQL> declare
      2    v1 number := 2;
      3    v2 varchar2(1) := 'C';
      4  begin
      5    case v1
      6      when 1 then dbms_output.put_line('First');
      7      when 2 then begin
      8                    case v2
      9                      when 'A' then dbms_output.put_line('Found A');
    10                      when 'B' then dbms_output.put_line('Found B');
    11                      when 'C' then dbms_output.put_line('Found C');
    12                      else dbms_output.put_line('NONE');
    13                    end case;
    14                  end;
    15      else dbms_output.put_line('Else');
    16    end case;
    17  end;
    18  /
    Found C
    PL/SQL procedure successfully completed
    SQL> If you have further doubts regarding syntax you can read the docs on the Case statement here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/case_statement.htm

  • How to create a program that accepts 5 digits from the user between 0 and 9

    how to create a program that accepts 5 digits from the user between 0 and 9 then put them in ascending order using link-list method..

    You can use a scanner to get user input from the command line.
    import java.util.*;
    public class Test {
        private List<Integer> list;
        private Scanner in;
        public static void main (String... args) {
            new Test ();
        public Test () {
            list = new LinkedList<Integer> ();
            in = new Scanner (System.in);
            for (int i = 0; i < 5; i ++) {
                System.out.format ("Please enter a number (%d more): ", (5 - i));
                list.add (in.nextInt ());
            Collections.sort(list, new Comparator<Integer> () {
                public int compare (Integer i1, Integer i2) {
                    return i2 - i1;
            System.out.println (list);
    }

  • How to create an ABAP Query with OR logical expression in the select-where

    Hi,
    In trying to create an ABAP query with parameters. So it will select data where fields are equal to the parameters entered. The default logical expression is SELECT.. WHERE... AND.. However I want to have an OR logical expression instead of AND.. how can I attain this??
    Please help me on this.. Points will be rewarded.
    Thanks a lot.
    Regards,
    Question Man

    Hi Bhupal, Shanthi, and Saipriya,
    Thanks for your replies. But that didn't answer my question.
    Bhupal,
    You cannot just replace AND with OR in an ABAP QUERY. ABAP QUERY is a self generated SAP code. You'll just declare the tables, input parameters and output fields to be displayed and it will create a SAP standard code. If you'll try to change the code and replace the AND with OR in the SAP standard code, the system will require you to enter access key/object key for that particular query.
    Shanthi,
    Yes, that is exactly what need to have. I need to retireve DATA whenever one of the conditions was satisfied.
    Saipriya,
    Like what I have said, this is a standard SAP code so we can't do your suggestion.
    I have already tried to insert a code in the ABAP query (there's a part there wherein you can have extra code) but that didn't work. Can anybody help me on this.
    Thanks a lot.
    Points will be rewarded.
    Regards,
    Question Man

  • How to create a select query to compare a collection via jpa?

    I'm new to jpa (java persistence) and its query language.
    If I've an entity named "Person" with a collection of Addresses (a one-to-manay relationahip), how do I create a Select query to get a person by using a collection of Addresses as its input parameter?
    Would "SELECT p FROM Person p JOIN p.addresses = :addresses" work?

    Hi,
    You can try the below logic:
    STATISTICS.date_reg} >= '27-may-2011' and { STATISTICS.date_reg} < ' 27-June-2011'
    I guess you are trying to apply this condition.
    Here in selection formula you need not to give select and from.
    Cheers,
    Kiran

  • How to create an External Content Type with SQL Stored Procedures Parameters and query it in a SharePoint App

    Hi,
    I'm new to SharePoint 2013 I want to be able to query a MSSQL database from a SharePoint App I have tried to create an External Content Type (ECT) which is produced from a MSSQL stored Procedure, this procedure has several parameters which are needed to
    filter the data correctly.  From here I want to produce an external list which I can then query from a c# SharePoint app.  If I leave the filters in the ECT null then the list is of course empty or if enter a default values the results are limited
    for the app to query so are no good.
    I want to dynamically pass values to the ECT when querying from the app, is this not possible.  Should I just be returning everything in an external list and then letting the query in the app filter the data, this seems inefficient?
    Is this the best way to do this or should I be doing this differently?
    Please can someone point me in the right direction.
    Thanks

    Hi Pandra801,
    When you create a the external content type, please try to add a filter based on your select statement.
    http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/
    Or, try to create a stored procedure based on your select statement, then create ECT using the SQL stored procedure.
    A step by step guide in designing BCS entities by using a SQL stored procedure
    http://blogs.msdn.com/b/sharepointdev/archive/2011/02/10/173-a-step-by-step-guide-in-designing-bcs-entities-by-using-a-sql-stored-procedure.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How to create Ad Hoc Query

    Hi Experts,
    Can anyone explain me the configuration steps required to create Ad hoc Query. Please give me the step by step procedure to create Ad hoc Query, since i am new to this assignment.
    Regards,
    Shadeesh.G
    Please type Adhoc Query in search forum you will find lot of threads related to this issue
    Edited by: Sikindar on Oct 27, 2010 4:22 PM

    Shadeesh,
    We were all new at some time or the other.
    Please try some well established sources of help such as help.sap.com
    A quick hint is to use the transactions SQ03, SQ02 and SQ01. A better way would be to progress a certain distance yourself and then ask for help here when you get stuck.

  • A How To: Create a Widescreen High Definition Slide Show from the Organizer

    [EDIT] I just tried another one and, weirdly, that produced an output with black bars around all four sides! So maybe this 'how to' is not 100%.  I have considered deleting the post altogether but, as it does still produce a superior slideshow quality file than the standard ones provided with Elements,  I've decided to leave it with this edit added at the top for additional info.[END_EDIT]
    In answering a question in another forum I found a nice quick way to create proper widescreen high definition slide shows from just the Elements Organizer. Apologies if this is 'old news' to readers, but I've not seen this described elsewhere so I thought I'd share it.
    The Organizer Slide Show creator, if not wanting to edit in PRE, provides a small set of Windows Media Player profiles to create .wmv files. But the best of these goes only to 1024x768 (a 4:3 monitor resolution setting). I've noticed, but never paid much attention to, that at the bottom of the Slide Size box there is a 'Browse for more' option that lets you search for additional Windows Media Encoder profiles. Investigation showed me that I can download the Windows Media Encoder software from Microsoft and create my own profiles. But even further investigation showed  me that someone had already done this! I've tested their full HD profile and it works just fine (1920x1080).
    So if you are just after a straightforward slide show (i.e. not needing PRE features) but want it displayed on your Full HD TV set here is what you do:
    Download the HD Profiles from http://forums.nexusmods.com/index.php?/topic/236895-hd-profiles-for-windows-movie-maker/. There's also a couple of useful SD sizes there as well. Save them somewhere you can easily find them.
    Create your slide show in the Organizer. Obviously use appropriately sized images for HD. There's little point outputting an HD wmv file using low resolution and/or 4:3 aspect ratio images.
    Save and Output your slide show.
    In the output dialog ('Save As a File') scroll down to the bottom of Slide Size and select 'Browse for more ...'.
    Browse to the file you downloaded in step 1 and click Open.
    Click OK and your Widescreen HD .wmv file is prepared.
    Here's a Gspot analysis of my test output file. As you can see it is an HD file with a 16:9, square pixel, aspect ratio.
    Ta Da!
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

    nealeh
    You did not mention a specific Premiere Elements Elements Organizer combo for this, so for now I will address this from the version 11, not Windows Movie Maker, perspective if I need to get version specific.
    .prx
    The Browse for More is a well known route and does offer at least one Adobe profile for 1280 x 720 16:9. I am not sure where you came up with the lesser resolution,1024 x 768 that you mentioned. The Windows Media profiles have existed for several versions of Elements Organizer. Those Adobe ones that you do not see under Output Save As A File Movie (.wmv), can be found in the Windows 7 or 8 64 bit path
    Local Disc C
    Profile Files (x86)
    Adobe
    Elements 11 Organizer
    Assets
    Locale
    en_US
    tv_profiles
    in the tv_profiles Folder are included the .prx files
    .....10. 640 x 480 Enhanced Definitions
    .....12. 852 x 480 Widescreen Enhanced Definition
    .....14 1280 x 720 Widescreen High Definition
    A homemade 1920 x 1080 16:9 30 frames per second .prx has long been sought but not that easily produced by many using with the Windows Media Encoder Editor. Apparently you have found one online, and it does get accepted into the Premiere Elements 11 Browse for More choices. And, if you do a gspot readout for the wmv output from Elements Organizer 11, it will display all the "right" properties that you hoped for and that are shown in your screenshot.
    The bottom line, why bother with the wmv slideshow? If you take your original photos and size them for 1920 x 1080 16:9, use them in the Elements Organizer 11 Slideshow Editor (Crops used in preferences), use the Edit with Premiere Elements Editor command, what you get in Premiere Elements 11 is full and good in all regard. Have you tried it?
    I can see your interest if this is HD going to HD (AVCHD on DVD or Blu-ray disc format on Blu-ray disc, but I do not see this for an Elements Organizer Slideshow that is going to DVD-VIDEO widescreen.
    More later.
    ATR

  • How to create a report  based on selected item from Select list?

    Hi,
    I have created a tables_LOV based on:
    select table_name d, table_name r from user_tab_cols
    where column_name like '%_type%'
    Then I created a page item ListOfTables,  Display as select list and pointing to tables_LOV.
    I run the page, and i can select the table i want from the drop down list.
    How to create a report  based on the selected item? (ex: select * from selected_table)
    many thanks in advance
    Salah

    Hi Salah,
    Allright, have a look at this page: http://apex.oracle.com/pls/apex/f?p=vincentdeelen:collection_report
    I think that simulates what you're trying to accomplish. I've set up the simplest method I could think of.
    The report is based on an apex collection. If you are not familiar with that, you should study the documentation: APEX_COLLECTION
    To recreate my example you should:
    1) create an (interactive) report on your collection
    SELECT *
       FROM APEX_collections
    WHERE collection_name = 'MY_COLLECTION'
    2) create a page_item select list for the tables you want to display (in my case this is called "P38_TABLES" )
    3) create a dynamic action that triggers on change of your select list page_item. The dynamic action must be a PL/SQL procedure perfoming the following code:
    declare
      l_query varchar2(4000);
    begin
      l_query := 'select * from '||:P38_TABLES;
      if apex_collection.collection_exists
            ( p_collection_name => 'MY_COLLECTION' )
      then
        apex_collection.delete_collection
          ( p_collection_name => 'MY_COLLECTION' );
      end if;
      apex_collection.create_collection_from_query
        ( p_collection_name => 'MY_COLLECTION'
        , p_query           => l_query
    end;
    Make sure you add your page_item to the "Page Items to Submit" section.
    4) Add an extra true action that does a refresh of the report region.
    Here are two pictures describing the da:
    http://www.vincentdeelen.com/images/otn/OTN_COLLECTION_REPORT_DA1.png
    http://www.vincentdeelen.com/images/otn/OTN_COLLECTION_REPORT_DA2.png
    Good luck and regards,
    Vincent
    http://vincentdeelen.blogspot.com

  • How to create and maintain a backup catalog, separate from default  location,  on and external HD

    How to create and maintain a backup catalog on a separate hd - separate from default location of the catalog?

    Simply copy the LR catalog backup file to another location. It’s quite small and only contains metadata e.g. your edit develop settings, keywords, captions, titles and camera exif data etc.
    The LR backup does not physically copy your image files. So make sure you have a separate system backup for your photo files and folders.

Maybe you are looking for