In Oracle
I need to use ID in several tables to update the value, I am trying to get value like below, and then assigning to a variable and then trying to use, but I am getting an error
declare myVal varchar2;
BEGIN
begin
myVal := select ID from USER where USER_NUMBER = 53;
end;
Update myOtherTable1 SET VAL = myVal;
Update myOtherTable2 SET VAL = myVal
Update myOtherTable3 SET VAL = myVal
Update myOtherTable4 SET VAL = myVal
Update myOtherTable5 SET VAL = myVal
...........
END
Error
ORA-06550: line 4, column 14: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe