What is wrong with this -
set serveroutput on
Declare
app number;
BEGIN
If EXISTS(SELECT * employee_id from employees where manager_id=100) THEN
Select max(salary)into app from employees;
dbms_output.put_line(app);
End IF;
end;
Error Output -
Declare
app number;
BEGIN
If EXISTS(SELECT * employee_id from employees where manager_id=100) THEN
Select max(salary)into app from employees;
dbms_output.put_line(app);
End IF;
end;
Error report -
ORA-06550: line 4, column 21:
PLS-00103: Encountered the symbol "EMPLOYEE_ID" when expecting one of the following:
from
ORA-06550: line 4, column 68:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
* & - + ; / at for mod remainder rem <an exponent (**)> and
or group having intersect minus order start union where
connect || multiset
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Please advise - How to check if the record exists or not whose manager id = 100 , if yes then it should select the max salary from the records whose manager id = 100 and store it into a variable?