# Update...set...format

**URL:** <https://forums.toadworld.com/t/update-set-format/31052>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [September 29, 2014, 10:51am UTC](https://forums.toadworld.com/t/update-set-format/31052 "2014-09-29T10:51:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnold](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arnold](https://forums.toadworld.com/u/arnold)\
**Post date:** [September 29, 2014, 10:51am UTC](https://forums.toadworld.com/t/update-set-format/31052/1 "2014-09-29T10:51:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![damir.vadas\_250](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/damir.vadas_250/32/37_2.png) [@damir.vadas\_250](https://forums.toadworld.com/u/damir.vadas_250)\
**Post date:** [September 30, 2014, 7:59am UTC](https://forums.toadworld.com/t/update-set-format/31052/2 "2014-09-30T07:59:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arnold](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arnold](https://forums.toadworld.com/u/arnold)\
**Post date:** [September 30, 2014, 9:44am UTC](https://forums.toadworld.com/t/update-set-format/31052/3 "2014-09-30T09:44:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![damir.vadas\_250](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/damir.vadas_250/32/37_2.png) [@damir.vadas\_250](https://forums.toadworld.com/u/damir.vadas_250)\
**Post date:** [September 30, 2014, 11:49pm UTC](https://forums.toadworld.com/t/update-set-format/31052/4 "2014-09-30T23:49:20Z")

</div>

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.
