Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  New field: Default value back-populates existing rows

    Posted Fri July 16, 2021 10:00 AM

    MAM 7.6.1.2; Oracle 19c:

    I've added a new ACTIVE field to CLASSSTRUCTURE (see: Hide Inactive Classifications From Users).
    When adding the field in Database Configuration, I specified a default value of 1.

    After applying the changes, I noticed that existing rows in CLASSSTRUCTURE were automatically populated with that default value. That's actually pretty handy. I thought I was going to need to get my DBA to run an UPDATE statement to back-populate existing rows. But it turns out that's not needed.

    Question:
    Did Maximo back-populate the existing rows with the default value, or is that OOB Oracle functionality?

    Thanks.


    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: New field: Default value back-populates existing rows

    Posted Fri July 16, 2021 10:02 AM
    Edited by System Admin Wed March 22, 2023 11:48 AM


  • 3.  RE: New field: Default value back-populates existing rows

    Posted Mon July 19, 2021 01:12 AM
    Standard SQL database functionality so provided by Oracle.





  • 4.  RE: New field: Default value back-populates existing rows

    Posted Mon July 19, 2021 10:35 AM
    On Oracle, Maximo defines it as initially not required, executes an update statement to provide the value where the value is null, and then sets the attribute to required (not null). On SQL Server, they'll define a default on the column if it's required and SQL Server itself will then go through and populate it and then Maximo removes the default. I don't know how it's done for DB2 but assume it'd be similar to Oracle. 

    Why each approach was decided I can't say. Oracle has a similar process for default values, but unlike SQL Server you can't fully drop the default (just set it to NULL after) from what I've read. My guess is this is why they didn't do this for the Oracle platform.

    ------------------------------
    Steven Shull
    ------------------------------



  • 5.  RE: New field: Default value back-populates existing rows

    Posted Mon July 19, 2021 10:41 AM
    Edited by System Admin Wed March 22, 2023 11:51 AM
    [EDIT] This was posted previously but since it was my first post (on the new IBM profile) wasn't made visible until it was approved and I had forgotten that I responded. [END EDIT]
    Yes. If a field is flagged as required and has a default value, Maximo will add the default value to all the existing records. It sounds like yours was a YORN which will always be required in the database.

    I can't remember if Maximo would do that on new attributes that are not flagged as required. I also would not expect it to do it on any of the dynamic variables (IE &SYSDATE&, &PERSONID&, etc.) because they wouldn't be able to accurately retrieve that for the records.

    ------------------------------
    Steven Shull
    ------------------------------