oracle – Using substring in SQL update statement

oracle – Using substring in SQL update statement

Here is one way:

UPDATE CUST_INFO cust
    SET CUST_NAME = SUBSTR(CUST_NAME, 1, 92) || _CHECKED
    WHERE process_timestamp is null;

Also, if you want to update any records, then use is null rather than = null (the latter never evaluates to true).

Note: Not all databases have the left() function, you can use substr() or the equivalent instead.

oracle – Using substring in SQL update statement

Leave a Reply

Your email address will not be published. Required fields are marked *