Apart from the typo (DECLEAR instead of DECLARE), your script looks fine. To get output from SQL/Plus, I'd also add a DBMS_OUTPUT
statement:
DECLARE
name varchar2(50);
BEGIN
SELECT fname into name
FROM customer
WHERE fname= 'Ann';
-- print it
dbms_output.put_line(name);
END;
However, to execute a file from SQL/Plus, don't use the EXECUTE
command - rather use @
:
SQL> set serveroutput on
SQL> @doselect
10 /
Ann
SQL/Plus is not very friendly to new users - you might want to use another client to get started (e.g. Oracle SQL/Developer - it's free and comes with a nice GUI).