Reputation: 143
I have a problem running my PL/SQL script in SQL*Plus. I can run SQL commands normally but when I want to a run any PL/SQL code it gives nothing. See code and output below.
DECLARE
x_salary employee.salary%TYPE;
BEGIN
select salary
into x_salary
from employee
where ssn=&enter_ssn;
--Output the result
DBMS_OUTPUT.PUT_LINE('Salary is ' || x_salary);
EXCEPTION
--Output when no records are returned
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE ('No employee found');
WHEN others THEN
DBMS_OUTPUT.PUT_LINE ('Error encountered, but cause unknown');
END;
Upvotes: 0
Views: 3574
Reputation: 49112
Put a slash /
in a new line after END;
in your script.
From the documentation:
You must include a semicolon at the end of each SQL command and a slash (/) on a line by itself after each PL/SQL block in the file.
Then execute the SQL file in SQL*Plus command line as:
@C:\your_script.sql;
Upvotes: 2
Reputation: 30663
PL/SQL procedures needs /
after procedure definition under sqlplus
DECLARE
...
BEGIN
...
END;
/
Upvotes: 5