question

stevensonbd2006 avatar image
stevensonbd2006 asked

Can anyone explain this PL/SQL block Error

DECLARE vSalary Number(8,2); BEGIN SELECT e.Last_Name,e.Salary INTO vSalary FROM Employees e WHERE e.Salary IN (SELECT MAX(e.Salary) FROM Employees e); DBMS_OUTPUT.PUT_LINE('The highest paid employee is:' e.Last_Name,TO_CHAR(vSalary)); END; / Error Report: ORA-06550: line 8, column 54: PLS-00103: Encountered the symbol "E" when expecting one of the following: ) , * & = - + < / > at in is mod remainder not rem => <> or != or ~= >= <= <> and or like like2 like4 likec as between from using || multiset member submultiset The symbol "," was substituted for "E" to continue. 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
sqloracleplsqloracle-sql-developer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
I'm guessing that your "PUT_LINE" command isn't right. It seems from a quick perusal of [DBMS_OUTPUT][1] documentation that PUT_LINE expects just a single string parameter. I think you therefore need to concatenate the fixed string, the e.Last_Name and the TO_CHAR(vSalary) bits appropriately. [1]: https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_output.htm#i1000105
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

stevensonbd2006 avatar image stevensonbd2006 commented ·
Thank you. I made the changes you suggested and it worked perfectly.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.