Skip to content

massUpdate ​

Command: massUpdate
Category: Mass Operations
Status: Production Ready

Description ​

Perform bulk SQL UPDATE operations on multiple tables with conditional WHERE clauses. This command allows efficient mass updates across database objects with filtering, limiting, and dry-run capabilities for safe data modifications.

Use Cases ​

  • Status Updates: Bulk change status fields (e.g., mark inactive records)
  • Field Initialization: Set default values for new or migrated data
  • Data Corrections: Fix incorrect values across multiple rows
  • Archival Operations: Mark historical data as archived or inactive
  • Bulk Maintenance: Apply version updates, timestamps, or reference changes

Safety Features ​

  • WHERE Clause Filtering: Apply conditions to limit affected rows
  • Dry Run Mode: Preview changes before applying (--dryRun)
  • Limit Protection: Default 1000 object limit prevents accidental mass modifications
  • Logging: Optional operation logging for audit trails

Common Update Patterns ​

PatternExamplePurpose
Status ChangeSTATUS = 'INACTIVE'Deactivate or archive records
TimestampMODIFIED_AT = CURRENT_TIMESTAMPTrack update times
CounterRETRY_COUNT = RETRY_COUNT + 1Increment failure counters
ConditionalSTATUS = 'COMPLETED' WHERE END_DATE IS NOT NULLConditional status updates

Syntax ​

bash
hana-cli massUpdate [schema] [object] [options]

Aliases ​

  • mu
  • massupdate
  • massUpd
  • massupd

Command Diagram ​

Parameters ​

ParameterAliasTypeDefaultRequiredDescription
schemasstring-YesDatabase schema containing tables
objectostring-YesTable name or pattern (use % for all)
setClausec, setstring-YesSQL SET clause with field assignments
whereClausew, wherestring-NoSQL WHERE clause to filter rows
limitlnumber1000NoMaximum number of objects to update
dryRundr, previewbooleanfalseNoPreview changes without applying
log-booleanfalseNoLog all update operations

For a complete list of parameters and options, use:

bash
hana-cli massUpdate --help

Examples ​

Mark Inactive Records ​

bash
hana-cli massUpdate --schema MYSCHEMA --object % --set "STATUS = 'INACTIVE'" --where "CREATED_AT < CURRENT_DATE"

Update Timestamp on All Records ​

bash
hana-cli massUpdate --schema MYSCHEMA --object ORDERS --set "MODIFIED_AT = CURRENT_TIMESTAMP"

Preview Changes Before Applying ​

bash
hana-cli massUpdate --schema MYSCHEMA --object CUSTOMERS --set "STATUS = 'VERIFIED'" --where "VERIFIED_DATE IS NOT NULL" --dryRun

Increment Retry Counter on Failed Records ​

bash
hana-cli massUpdate -s MYSCHEMA -o "ERROR_%" -c "RETRY_COUNT = RETRY_COUNT + 1" -w "STATUS = 'FAILED'" --log

See Also ​