You can assign variables directly in an update statement. You do not need to use a select statement to assign a value to a variable. When you declare a variable, it has the value NULL. Here is the syntax:
update [[database.]owner.] {table_name | view_name}
set [[[database.]owner.]{table_name. | view_name.}]
column_name1 =
{expression1 | null | (select_statement)} |
variable_name1 = {expression1 | null}
[, column_name2 = {expression2 | null |
(select_statement)}]... |
[, variable_name2 = {expression2 | null}]...
[from [[database.]owner.]{table_name | view_name}
[, [[database.]owner.] {table_name |
view_name}]]...
[where search_conditions]