Programming Languages on Power

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power

 View Only
  • 1.  Update data from result set

    Posted Tue February 27, 2024 02:41 AM

    Hi, I have to update some fields of a result set, like this example:

    Updating data as it is retrieved from a table

    Ibm remove preview
    Updating data as it is retrieved from a table
    You can update rows of data as you retrieve them by using a cursor.
    View this on Ibm >

    but I need to join two tables, I need to update only some fields from the first table, so I create a view to join the two tables, but making a join the view become read only. 

    Is there any tricks to select from a join and update  only some fields from first table?



    ------------------------------
    Paolo Salvatore
    ------------------------------

    #RPG


  • 2.  RE: Update data from result set

    Posted Tue February 27, 2024 03:40 AM
    1. Why not just executing 2 independent Update Statements?
    2. If you really want to update a JOINED View, you could create an INSTEAD OF TRIGGER which then performs the update into the first and another update into the second table.


    ------------------------------
    Birgitta Hauser
    Database and Software Engineer
    Selfemployed - Modernization-Education-Consulting on IBM i
    Kaufering
    +49 170 5269964
    ------------------------------



  • 3.  RE: Update data from result set

    Posted Tue February 27, 2024 04:47 AM

    Hi Birgitta,

    thanks for your answer, I didn't explain my problem well.

    until now I have a programs than read a logical file (with some select and omit). Prepare the information to be returned to the caller and update the record.

    Now in add to this file I have to read an extension of this file (for 98% there will be nothing), so doing it with traditional rpg after read I make a chain to the second table.

    My wish is to read the first and the second table together (with a join) and than prepare the information to be returned to the caller and update only the first table, the second table is only in input.

    If you want I can write a sample.


    Thank you



    ------------------------------
    Paolo Salvatore
    ------------------------------



  • 4.  RE: Update data from result set

    Posted Wed February 28, 2024 12:59 PM

    Hi Paolo, 

    An example would be wonderful. To understand your question correctly.



    ------------------------------
    Albert Zinn
    ------------------------------