i have written below line of code , executing same pl/sql developer tool.
i have created hr schema in oracle 11g database.
code
create table employees2 select last_name employees; <<main>> declare last_name varchar2(10) := 'king'; my_last_name varchar2(10) := 'king'; begin -- deletes everyone, because both last_names refer column delete employees2 last_name = last_name; dbms_output.put_line('deleted ' || sql%rowcount || ' rows.'); rollback; -- ok, column , variable have different names delete employees2 last_name = my_last_name; dbms_output.put_line('deleted ' || sql%rowcount || ' rows.'); rollback; -- ok, block name specifies 2nd last_name variable delete employees2 last_name = main.last_name; dbms_output.put_line('deleted ' || sql%rowcount || ' rows.'); rollback; end; / drop table employees2;
but while executing first declare statement throws error below
ora-06550: line 4, column 0: pls-00103: encountered symbol "end-of-file" when expecting 1 of following: * & = - + ; < / > @ in mod remainder not rem <an exponent (**)> <> or != or ~= >= <= <> , or like2 like4 likec between || multiset member submultiset
please guide me new pl/sql , self learning it.
your code fine, guess it's client problem.
pl/sql developer has different kinds of windows - kind of query, should use "command window" (which sql/plus prompt).
if running whole script doesn't work, try running each statement separately (in "sql window", can select code block , run selection).
Comments
Post a Comment