Toad World® Forums

Update...set...format


#1

I am executing an UPDATE table_name SET field_name = value

where field_name is a substring of a larger field: SET SUBSTR(RECORD_DATA,51,8) =

SQL does not like this. Must the field_name be an actual named (defined) field in the table?


#2

RECORD_DATA must be column of table_name.

If this is from another table then this table must be joined in query so Oracle knows where this comes from.


#3

Thank you. One more question— does the SUBSTR function work with SET ?


#4

yes.

Example
update customers set name = substr(surname,1,10) where …
and this
update customers set name = substr(name,1,10) where …

But not:
update customers set substr(name,1,10) = substr(surname,1,10) where …

Cheers.