Multiple record sets???

I am having a tough time with setting up a list that is set
up as shown at the bottom of the page. So I thought maybe I could
create multiple record sets... one for each category. The problem
is that there are 30+ categories. I really could use some help.
Is multiple record sets the proper way to do this or am I
missing the big picture?
The other direction that was in my mind was if there was a
way to change the "WHERE category = ?" statement as I get to each
category.... is that possible?
Category 1
field 1 field 2 field 3
field 1 field 2 field 3
field 1 field 2 field 3
Category 2
field 1 field 2 field 3
field 1 field 2 field 3
Thanks in advance
Dave

Sounds like you need a join statement in your SQL, is the
category and field info in different tables, then a join would be
perfect, also what language are you using. I know another way in
php you could use a while loop with another RS inside that gets the
proper field info for each category.
check out this:
http://www.w3schools.com/sql/sql_join.asp

Similar Messages

  • Returning Multiple Record sets to VB.

    Is it possible using an Oracle 7 Driver connecting to a Oracle 9i database to return multiple record sets to screens written in VB? this is all a new area for me and the people I've spoken to so far seem to think it isn't possible - I refuse to believe this - someone must have done this before?!?!? Can someone confirm either way before I go down this path!!!!
    Cheers

    Sounds like you need a join statement in your SQL, is the
    category and field info in different tables, then a join would be
    perfect, also what language are you using. I know another way in
    php you could use a while loop with another RS inside that gets the
    proper field info for each category.
    check out this:
    http://www.w3schools.com/sql/sql_join.asp

  • Using XSU to process multiple record sets

    Have a design question about XML, Java and Oracle's XSU. This is a common task when importing external data that should be of general interest.
    I have an incoming XML document with multiple records with a known DTD. Before the records can be inserted into the database, part of
    the record must be used to do a lookup for a foreign key. The resulting foreign key is then combined with the other part of the
    record to create a valid input record for the database.
    My question is what's the most efficient way to do this? I assume the general approach must go something like:
    begin
    while (records in xml doc)
    1. parse the incoming XML to extract the next record
    2. if the lookup data change, do a lookup for this record using XSL
    3. combine the resulting foreign key with the data to create
    an insert query
    4. add the insert query as a document fragment to a second XML document.
    use XSU to insert the second XML doc with multiple records.
    end
    I've figured out how to do most of this, except for step 1 above: is there an easy way to extract the next record from an XML doc if I know the row nodes and the DTD? Or do I just have to traverse all the XML nodes until I hit my next row tag?
    Appreciate any suggestions; this is a handy discussion list!
    --Rick Casey
    Rick Casey, Graduate research assistant CADSWES, http://cadswes.colorado.edu
    University of Colorado at Boulder [email protected] 303.492.0892
    null

    Yes, typical behavior is that when you have multiple outputs it will create a one row IllumDoc to wrap them all together with OuputParameter=* (and the xml will be ignored unless it is the only output property or you've requested it by name).
    How about just using "/Lighthammer/Illuminator?QueryTemplate=xxxx/yyyy&Content-Type=text/xml" or "/Lighthammer/Runner?Transaction=xxxx/yyyy&OutputParameter=OutputXML" which will both return your multi-rowset output?
    I may be mistaken, but I believe the XacuteResponse was simplified to not include the Rowsets outer node because certain systems had problems digesting the layers, in fact you don't get the <Columns/> section either in the single Rowset.
    Rick - any feedback to this SOAP simplification from Xacute?

  • Inserting multiple records in JSP and setting date format

    Hi,
    I'm looking at the possibilities for using JSP's as a web application.
    I've got a few questions about it:
    1) Is it possible to insert multiple records in the detail block of my JSP. Normally when I click the 'insert button', an insert JSP comes up, which is a html form with the possiblity of inserting only one record.
    2) Is it possible to change the format of a date field. Now a date field is displayed as 'YYYY-MM-DD'. My nls_date_format is something else.
    3) I can't get the static combo box working for the class EditCurrentRecord. The normal use combo box is no problem. Probably, I don't have the syntax correct. Could anyone provide an example for this.

    2) Just use the Calendar object. You can format the date any way you want. I am assuming that you are talking about how the date appears after a .toString() call.
    Here is how I do it (this code will probably look very bad I am trying to type into a very small space so bear with me):
    public static String traceDate(java.sql.Timestamp dt)
    try
    if (dt == null)
    return " ";
    else
    Calendar clFmt = Calendar.getInstance();
    clFmt.setTime(dt);
    return
    String.valueOf(clFmt.get(Calendar.MONTH) + 1) + "/" +
    String.valueOf(clFmt.get(Calendar.DAY_OF_MONTH)) + "/" +
    String.valueOf(clFmt.get(Calendar.YEAR)) + " " +
    String.valueOf( (clFmt.get(Calendar.HOUR) == 0) ? 12 : clFmt.get(Calendar.HOUR) ) + ":" +
    padLt(String.valueOf(clFmt.get(Calendar.MINUTE)),2) + ":" +
    padLt(String.valueOf(clFmt.get(Calendar.SECOND)),2) + " " +
    (clFmt.get(Calendar.AM_PM) == Calendar.AM ? "AM" : "PM");
    catch (Exception e)
    throw new RuntimeException(e.getMessage());
    (padLt is a custom function that just pads 0s to the left of the number)

  • Combining multiple records into a single record (View)

    Okay so here is my scenerio:
    There is a table I have made that details SQL jobs and the various details about them. What i wan't to do is make a view with specific logic implemented. Fields that will be taken across to this view will be: LastRunDate, LastRunTime and Step_Status.
    JobName will also be used to define the logic but will not be a column in itself.
    What i wan't is an additional column using this logic, called 'DataSet'. For each Dataset there are multiple jobs that are unique to it, so there are multiple records being brought over from the table to view for one particular dataset. For example,
    for 'ExampleDataSet' there are three jobs, i wan't it so these jobs are combined and named as 'ExampleDataSet' under a calculated column called 'Dataset'. For the following fields i would like it so that LastRunDate and LastRunTime are the time in whichever
    job was last to be intitiated is the date and time set. For Step_Status, there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running'. If neither are running yet one has failed then 'Failed'.
    Only when all three have succeeded should it then be set to 'Succeeded'.
    I hope i have made that clear enough, please feel free to ask any questions if not. I am relatively new to SQL but i thought to at least try least try (I knew it wouldn't work) and it didn't work. But it may give you a better idea of
    what i wan't:
    CREATE VIEW [dbo].[vw_DataAvailabilityAnalysts] AS
    SELECT CASE
    WHEN JobName in ('Job1','Job2','Job3') and step_status='Running' THEN 'Running'
    WHEN JobName in ('Job1','Job2','Job3') and step_status='Failed' THEN 'Failed'
    WHEN JobName in ('Job1','Job2','Job3) and step_status='Succeeded' THEN 'Succeeded'
    END as StatusCheck,
    CASE WHEN JobName in ('Job1','Job2','Job3') THEN 'ExampleDataSet'
    END as DATASET,
    LastRunDate,
    lastruntime,
    step_status,
    FROM [CDS_Common].[dbo].[DataAvailability]
    Many Thanks,
    Plain_Clueless
    Plain_Clueless

    Okay so here is what my table looks like (Simplified). There are four columns and the data within is extracted via a Stored Procedure.
    JobName
    LastRunDate
    LastRunTime
    Step_Status
    Job1
    11/06/2014
    09:30:00
    Succeeded
    Job1
    10/06/2014
    09:37:20
    Succeeded
    Job2
    11/06/2014
    04:05:00
    Succeeded
    Job1
    09/06/2014
    02:17:41
    Succeeded
    As you can see there are 3 jobs which are all 'Job1'. This jobs are obviously different within the table however this represents that they are jobs which all update the same DataSet within our local warehouse. Whereas Job2 updates a different dataset alltogether.
    I wan't to create a view which will alagmate the jobs that are of the same DataSet, which will disclude the column JobName but would create a whole new column that looks like this:
    DataSet
    LastRunDate
    LastRunTime
    Step_Status
    DataSet2
    11/06/2014
    04:05:00
    Succeeded
    DataSet1
    11/06/2014
    09:30:00
    Succeeded
    Bascically what this shows you is all the Job 1's combined so they are one record, Amaglamated. The last time any of these jobs were run is the LastRunDate & LastRunTime, which was the first record in the first table provided. Again for Step_Status,
    there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running' (Absolute). If none of the three jobs are running yet one has failed then 'Failed'. If one has failed yet another is also running then
    'Running'.Only when all three have succeeded should it then be set to 'Succeeded'. (This last bit isn't as important).
    Hope this clears it up a bit,
    Plain_Clueless
    Plain_Clueless

  • How to concatenate multiple records into one

    Hi everybody:
    I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
    Lan|Author
    English|Ernest Hemingway
    Spanish|Octavio Paz
    Spanish|Mario Vargas Llosa
    English|Sinclair Lewis
    Spanish|Gabriel García Márquez
    And I want to get this:
    Author
    Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
    I have worked with SQL Server and I can do something like this:
    CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
    RETURNS varchar(5000) AS
    BEGIN
    declare @retvalue varchar(5000)
    set @retvalue=''
    select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
    return substring(@retvalue,1,len(@retvalue)-1)
    END
    ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
    FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
    v_ret VARCHAR2(4000);
    v_element VARCHAR2(4000);
    v_cursor sys_refcursor;
    BEGIN
    OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
    LOOP
    FETCH v_cursor INTO v_elemento;
    EXIT WHEN v_cursor%NOTFOUND;
    IF v_ret IS NULL THEN
    v_ret := v_element;
    ELSE
    v_ret := v_ret || ', ' || v_element;
    END IF;
    END LOOP;
    RETURN v_ret;
    END;
    Exist some other way to do this?
    Best Regards
    Jack

    Tks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
    I wil read about the other techniques than Hoek mention
    Best Regards.
    Jack

  • How to handle multiple records in BPMN process

    Hi All,
    We are using Oracle BPM 11g.In my requirement,I am using the database adapter to get the data from table and I need to validate the each record and update the status of that record from the BPM Process.But I dont know how to handle if multiple records come at a time.Can anybody please helpout from this problem.
    Thanks in advanced.
    Narasimha Rao.

    Can you have a look at this post: http://redstack.wordpress.com/2010/09/30/iteratingtraversing-arrays-in-bpm/
    It's solving a different problem, but the key is that it's using a multi-instance subprocess to iterate over an array of "things" that need to be acted in. In your case it's the set of results from the db query rather than the set of tests in the example. But the principle is the same. You'd take collection of rows from the DB and process them in a multi-instance subprocess. The text that begins with the following would be good place to start:
    "Now let’s implement the body of our process. We will use the Subprocess object to handle the traversal of the array of tests. Drag a Subprocess from the component palette on the right into the process and drop it on the line between the Start and End nodes."
    In the loop characteristics you'd define whether you want to execute serially or in parallel.

  • How to select multiple records in the ALV POP UP by using oops

    Hi All,
    We have a requirement of ALV POP UP by using the OOPS. How to select the multiple records in the POP UP and After selecting that i want do Inteactive ALV means again one more POP UP in ALV.
    Thanks for help....
    Regards,
    Bharani

    Hello Bharani
    Displaying an ALV list in a popup is by no means different from a list displayed on a main screen. The only thing you need to consider is that you set the right screen level when creating the parent container for the ALV.
    For more details refer to thread in CL_GUI_SPLITTER_CONTAINER  ALV list  is not show in called screen
    " step 1:
      CREATE OBJECT gr_spliter
        EXPORTING
          parent = cl_gui_container=>screen0 " For first popup use: =>screen1
          rows = 1
          columns = 2.
    Regards
      Uwe

  • Retrive Multiple Records Into A database Block

    hi, all
    i would like to know if there is any document or references wich illustrait the way of retriving Multi records from a procedure built on database side into a database block using form 6i ??
    My Problem is : i create a procedure in the database which retrive a multiple records and the variable from procedure (out) are the same value from Form side (in). but it always fetch the whole records at the same record position in the block as the cursor raised on . i found a way explian how to mintain a set or record using a record type and create a table of that record type , but still don't' know how deal calling the procedure from the form side .
    Any advice of this issue will be greatfull and if sample of code provided will be better
    Thanks in Advance
    Regards
    Omar

    You can try something like this:
    PROCEDURE POPULATE_BLOCK IS
    cursor c1 is
    SELECT <your column names>
    FROM <your table name>
    where <your where condition>
    BEGIN
    open c1;
    go_block('<your block name');
    first_record;
    loop
    fetch c1 into
    :<your block name>.<your column name 1>,
    :<your block name>.<your column name 2>,
    etc,etc
    exit when c1%NOTFOUND;
    next_record;
    end loop;
    close c1;
    first_record;
    END;
    so your code might actually look something like this:
    PROCEDURE POPULATE_BLOCK IS
    cursor c1 is
    SELECT distinct
         a.pog_dept
         ,a.pog_number
         ,a.pog_level
         ,a.pog_id
    ,a.start_date
         ,a.transmit_date
    ,a.deactivate_date
         ,b.pog_description
    FROM pog_stores_msi a, pog_master_msi b
    where a.pog_dept = :b_main.bi_dept
    and a.pog_number = :b_main.bi_pog_number
    and a.pog_level = :b_main.bi_pog_level
    AND A.POG_ID = :B_MAIN.I_POG_ID
    and a.pog_dept = b.pog_dept
    and a.pog_number = b.pog_number
    and a.pog_id = b.pog_id;
    BEGIN
    open c1;
    go_block('b_main');
    first_record;
    loop
    fetch c1 into
    :b_main.bi_dept
    ,:b_main.bi_pog_number
    ,:b_main.bi_pog_level
    ,:b_main.i_pog_id
    ,:b_main.i_start_date
    ,:b_main.i_transmit_date
    ,:b_main.i_deactivate_date
    ,:b_main.i_pog_desc;
    exit when c1%NOTFOUND;
    next_record;
    end loop;
    close c1;
    END;
    Hope this helps,
    NumbNutz

  • SQL Command returns multiple records, but I see only one record in report

    I work with Crystal Reports XI R2 SP3 and Oracle 10g R2 database.
    I have an SQL Command that returns multiple records. Command name is "CommDivisionNames" and it returns column "CommDivisionNames.DIVISION_NAME". When I place this field into report details section of the report, I can see all 10 records returned and this is how it should be. I actually need this field to be placed in the report header section, and when I place the field there, then I see only the first record. I set that field as "can grow = true". When I do "browse field data" for this field, I see that all 10 records are there, but only the first one is displayed in report header section.
    I thought that I can place SQL Command field anywhere on the report (page header, footer, details) and that it will always show all records that it returns from the database. Can that be done?
    My "main part" of the report returns different set of records, and that's what I have in "report details" section. I need this list of divisions to be in the report header section, so user can see that the report was executed for DivA, DivC, DivE.
    Thank you,
    Milan

    sharonamt:
    Users select divisions from parameter, but the parameter multi values are division_numbers (1,5,10), not division_names. Division_names are visible in parameter_prompt_window as description, but parameter remembers only numbers and I don't know how I can reuse division_names later in formula.
    I do join for division_numbers and make them into one string variable and pass to sub-report, but I think that I can only get these division_names by calling an SQL command or calling stored procedure.
    If I try to do join({MySQLcommand.DIVISION_NAME}) I get error message "A string array is required here".
    Carl:
    I'm playing with cross-tab and I can use it to see all division_names in the report-header section. Since I need them in only one column or only one row, I have to edit cross-tab object and turn all unneeded border lines to white to make them look invisible. So, cross-tab could be a solution for my problem here.
    Another option could be to re-write my SQL command. Since I've read here that SQL command could be written in the same way as I would write a stored procedure, then I could use a bit more complex code to get all multiple division names from the database table into a local cursor, and then use do-while loop to concatenate them into one string, and then to return that string as one record (like 'DivA, DivB, DivC'), and then it should not be a problem to display only that one record/string in report header. It is my understanding that Crystal Reports can call stored procedure that works with many cursors/recordsets and CR will use only the last recordset from the stored procedure. Do you think it could be done this way?
    Thank you,
    Milan

  • Multiple record created in Cube

    Hi BI Expert,
    I have got a DSO and it's passing data to infocube. When it passes data, the cube generates multiple records. I am using the following code and this was originally written by BI consultant.
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: /bic/azo_sop_100,
            /bic/aZO_POP_100,
            /bic/azo_pop0600,
            /BIC/AZO_PRE_100,
            /BIC/AZO_SBP_100,
            /BIC/AZO_SDP_100.
    DATA: in    TYPE f,
          out   TYPE f,
          denom TYPE f,
          numer TYPE f,
          vc_df_preq    type /BI0/OIDF_PREQ.
    Def. of 'credit-documents': following doc.categ. are 'credit docs'
      return order (H)
      credit memo  (K)
    Credit-documents are delivered with negative sign. Sign is switched
    to positive to provide positive key-figures in the cube.
    The combination of characteristics DE_CRED and DOC-CLASS provides
    a comfortable way to distinguisch e.g. positive incoming orders or
    order returns.
    Def. der 'Soll-Dokumente': folgende Belegtypen sind 'Soll-Belege'
      Retoure (H)
      Gutschriftsanforderung (K)
    Soll-Dokumente werden mit negativem Vorzeichen geliefert. Um die Kenn-
    zahlen positiv in den Cube zu schreiben, wird das Vorzeich. gedreht
    Die Kombination der Merkmale DEB_CRED und DOC-CLASS gibt Ihnen die
    Möglichkeit schnell z.B. zwischen Auftrags-Eingang oder Retouren zu
    unterscheiden.
    DATA: deb_cred(2) TYPE c VALUE 'HK'.
    DATA: quot(1) TYPE c VALUE 'B'.
    CONSTANTS: c_msgty_e VALUE 'E'.
    Variable declarations for
    derivation of Fiscal week {by SB:18.10.2007}
    DATA: lv_createdon TYPE /bi0/oicreatedon,
          lv_period    LIKE t009b-poper,
          lv_year      LIKE t009b-bdatj,
          lv_fiscweek  TYPE /bi0/oicalweek,
          w_vendor     like /BIC/AZO_POP_100-VENDOR.
    Deriving Master Data Attribute (0MRP_CONTRL)
    from 0MAT_PLANT {by SB:18.10.2007}
    Hashed table declaration for 0MAT_PLANT master data
    *DATA: it_mat_plant
         TYPE HASHED TABLE OF /bi0/pmat_plant
         WITH UNIQUE KEY plant mat_plant
         INITIAL SIZE 0.
    $$ end of global - insert your declaration only before this line   -
    FORM compute_data_field
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
      USING    COMM_STRUCTURE LIKE /BIC/CS8ZO_SOP_5
               RECORD_NO LIKE SY-TABIX
               RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING RESULT LIKE /BIC/VZIB_SOP_1T-SUBTOT_1S
               RETURNCODE LIKE SY-SUBRC
               ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
      DATA: VALUE LIKE COMM_STRUCTURE-NET_VALUE.
      DATA: US_RATE_TYPE LIKE COMM_STRUCTURE-RATE_TYPE.
      CLEAR RESULT.
      IF NOT COMM_STRUCTURE-SUBTOTAL_1 IS INITIAL AND
         COMM_STRUCTURE-DOC_CURRCY NE COMM_STRUCTURE-STAT_CURR.
        US_RATE_TYPE = COMM_STRUCTURE-RATE_TYPE.
        IF US_RATE_TYPE EQ SPACE.
          US_RATE_TYPE = 'M'.
        ENDIF.
      ENDIF.
      IF COMM_STRUCTURE-DOC_CURRCY NE COMM_STRUCTURE-STAT_CURR.
        CALL FUNCTION 'CONVERT_TO_STAT_CURRENCY'
             EXPORTING
                  DATE                 = COMM_STRUCTURE-ST_UP_DTE
                  DOCUMENT_AMOUNT      = COMM_STRUCTURE-SUBTOTAL_1
                  DOCUMENT_CURRENCY    = COMM_STRUCTURE-DOC_CURRCY
                  LOCAL_CURRENCY       = COMM_STRUCTURE-LOC_CURRCY
                  STAT_CURRENCY        = COMM_STRUCTURE-STAT_CURR
                  LOCAL_RATE           = COMM_STRUCTURE-EXCHG_RATE
                  STAT_RATE            = COMM_STRUCTURE-EXCHG_STAT
                  LOCAL_TYPE_OF_RATE   = US_RATE_TYPE
                  STAT_TYPE_OF_RATE    = US_RATE_TYPE
             IMPORTING
                  STATISTICAL_AMOUNT   = VALUE
             EXCEPTIONS
                  LOCAL_RATE_NOT_FOUND = 1
                  STAT_RATE_NOT_FOUND  = 2.
        CASE SY-SUBRC.
          WHEN 0.
            RESULT = VALUE.
            RETURNCODE = 0.
          WHEN 1.
            CLEAR MONITOR.
            MONITOR-msgno = '005'.
            MONITOR-msgid = 'SDBW'.
            MONITOR-msgty = c_msgty_e.
            MONITOR-msgv1 = COMM_STRUCTURE-DOC_NUMBER.
            MONITOR-msgv2 = COMM_STRUCTURE-ST_UP_DTE.
            MONITOR-msgv3 = COMM_STRUCTURE-DOC_CURRCY.
            MONITOR-msgv4 = COMM_STRUCTURE-LOC_CURRCY.
            append MONITOR.
            RETURNCODE = 4.
          WHEN 2.
            CLEAR MONITOR.
            MONITOR-msgno = '006'.
            MONITOR-msgid = 'SDBW'.
            MONITOR-msgty = c_msgty_e.
            MONITOR-msgv1 = COMM_STRUCTURE-DOC_NUMBER.
            MONITOR-msgv2 = COMM_STRUCTURE-ST_UP_DTE.
            MONITOR-msgv3 = COMM_STRUCTURE-DOC_CURRCY.
            MONITOR-msgv4 = COMM_STRUCTURE-STAT_CURR.
            append MONITOR.
            RETURNCODE = 4.
        ENDCASE.
      ELSE.
        RESULT = COMM_STRUCTURE-SUBTOTAL_1.
      ENDIF.
      IF COMM_STRUCTURE-DOC_CATEG CA DEB_CRED.
        RESULT = RESULT * ( -1 ).
      ENDIF.
    If the order type is 'Returns' or 'Credit Memo' then the figure will be changed to positive value. But the cube has got both negative and positive value for the order line.
    Order   line      PO no.  0COST     0CML_OR_QTY 
    89576  10       925401  130.60      1
    89576  10       925401  -130.60     1-
    Could you please help me as to how I can resolve this issue?
    Thanks.
    Edited by: Bhai Basnet on Mar 7, 2008 11:58 AM

    Hi,
    the code you provided does not duplicate records.
    Most probably the records are duplicated in the start routine, or the key figure is copied in the update rule (so you get 0AMOUNT en 0AMOUNT_01).
    So I'd check your start routine and take a look if the key figures are copied.

  • Help needed in PL/SQL for updating the column for multiple records

    Hi,
    I am new to PL/SQL and need some help. What is the most effiecient way to update some field in a table as I may need to update thousands of records. I have a coulmn groupid can have multiple records tied to it. All the records attached to some groupid have a priority field also.
    How can I update the prorityfield value for all the groupids in a profiecient way. Here is a sample data
    GroupId     Priority
    1            1
    1            2
    1            3
    1            4
    1            5
    2            1
    2            2
    2            3
    3            1Here I have three groups 1, 2, 3. Now if any group contains only one record the priority remains same e.g. groupid=3 on top. If any group contains more than one record e.g. groupid=1 & 2 I want to re-arrange the priority fields e.g. If I want to update groupid=1 now if I change the priority of 2 to 5 (make it the last) I want to rearrange the remaing records priority i.e. if 2 becomes 5 as I have 5 rows for groupid=1 then 5 becomes 4, 4 becomes 3, 3 becomes 2 and 1 remains the same.
    Same wya if I want to make the priority 1 to 3 for groupid=2 then need 2 to become 1 and 3 to become 2 etc....
    Any help is appreciated.
    Thanks

    Hi,
    You don't need PL/SQL to do this (though you can put the following in PL/SQL if you want to):
    UPDATE     table_x
    SET     priority = CASE
                   WHEN  groupid     = 1
                   AND   priority = 2
                        THEN  5
                   WHEN  groupod     = 1
                   AND   priority     BETWEEN 3 AND 5
                        THEN  priority - 1
                   WHEN  groupid = 2
                   THEN
                        CASE
                             WHEN  prioity = 1
                             THEN  3
                             ELSE  priority - 1
                        END
                 END
    WHERE     groupId          IN (1, 2)
    AND     (     priority     BETWEEN 2 AND 5
         OR     groupid          = 2
         );There are lots of different techniques that can reduce your coidng: for example, the nested CASE statement used for groupid=2 above.
    You could do several smaller UPDATEs (for example, one just for groupid=1). Execution will be slower, but coding and testing will be faster.
    You could make the "magic numbers" 2 (for groupid=1) and 1 (for groupid=2) variables, even outside of PL/SQL.
    If you need more help, post the information that Satyaki requested.

  • Problem in UPDATE statement In Multiple Record Block

    Hi Friends,
    I have problem in update Statement for updating the record in multiple record data Block.
    I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
    I am inserting the fields like category,and post_no for partiular job in single data block
    Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
    There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
    then its updating all the record.
    my code is Bellow,
    IF v_count 0 THEN
    LOOP
    IF :SYSTEM.last_record 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
    :POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    next_record;
    ELSIF :SYSTEM.last_record = 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
    :POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    EXIT;
    END IF;
    END LOOP;
    SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
    v_button_no := SHOW_ALERT('user_alert');
    FORMS_DDL('COMMIT');
    CLEAR_FORM(no_validate);
    Please Guide me
    Thanks in advence

    As you do a loop over all the records in the block, of course every record is updated.
    Also, what you do is not the way is intended to be used. In general, you base a block on a table,then there is no need at all for writing INSERT's or UPDATE's. Forms also know's then, which records to be updated and which not.

  • Problem In Update Statement In Multiple Record Data Block

    Hi Friends,
    I have problem in update Statement for updating the record in multiple record data Block.
    I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
    I am inserting the fields like category,and post_no for partiular job in single data block
    Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
    There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
    then its updating all the record.
    my code is Bellow,
    IF v_count <> 0 THEN
    LOOP
    IF :SYSTEM.last_record <> 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
    :POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    next_record;
    ELSIF :SYSTEM.last_record = 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
         VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
              :POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    EXIT;
    END IF;
    END LOOP;
    SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
    v_button_no := SHOW_ALERT('user_alert');
    FORMS_DDL('COMMIT');
    CLEAR_FORM(no_validate);
    Please Guide me
    Thanks in advence

    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;These update statements are without where clause, so it will update all records.
    If it is specific to oracle forms then u may get better help at Forms section.

  • To load multiple records in multiple target tables

    I have to read multiple records as a set from a single source flat file and load into different target tables.
    I have to read 3 records as a set and load into 3 different target tables and read another 3 records as a set and load into previous 3 target tables and it goes on
    till all the records from the flat file are loaded.
    The structure of the file is as follows:
    Header Record
    Line Record
    Distribution Record
    Header Record
    Line Record
    Distribution Record
    Read Header Record and load into target table A
    Read Line Record and load into target table B
    Read Distribution Record and load into target table C
    --- repeat the same steps till all records are read and loaded into target tables.
    I would appreciate if anyone can suggest the best approach of designing interface/package and error conditions to handle ?
    Thanks,
    Ram

    Hi,
    in this case you must create datastore under a 'Flat file' model
    Create for example 3 datastore with the same ressource (file) but change defintion of column
    Generaly on the first column, define the 'pattern' for each specific format 'variable code'
    You must create 3 interfaces and load your target (databse table for example)
    Regards
    Stephane

Maybe you are looking for