You can't return a result using a SELECT from within a PL/SQL block. Remove the begin
before the select and the end
after it.
You also can't include a column name (not "field") in the table for the UPDATE
statement. The columns are referenced in the SET
clause. The same is true for the table reference in the FROM
clause.
You also need a different character to end a PL/SQL block. In the Oracle world (sqlplus
, SQL Developer) that is usually the /
character.
declare
switcher VARCHAR(20);
--step one - update
begin
switcher := &faid;
update table_one -- only the table name here
set str_value = switcher -- a column can be referenced here
where name = 'NAME_1'; -- and a column can be referenced here
commit;
end;
/
select *
from table_one t1 -- no "field" after the table name here either
where t1.name = 'NAME_1';
But you don't really need PL/SQL for the whole thing. Assuming SQL*Plus (or SQL Developer) the following would work just as well:
update table_one
set str_value = &faid
where name = 'NAME_1';
commit;
select *
from table_one t1
where t1.name = 'NAME_1';