Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax 1

Status
Not open for further replies.

CTO1

Technical User
Jun 17, 2003
14
0
0
GB
Trying to get to grips with user-defined exceptions by working through this example. It looks fine to me yet I keep getting
Error at Line 7:
ORA-06550: Encountered the symbol "INTO" when expecting one of the following: .,@;for<an identifier>

DECLARE
my_empid employee.empid%TYPE := 39334;
my_emp_record employee%ROWTYPE;
my_salary_null EXCEPTION;
BEGIN
SELECT * FROM employee
INTO my_emp_record
WHERE empid = my_empid;
IF my_emp_record.salary IS NULL THEN
RAISE my_salary_null;
END IF;
EXCEPTION
WHEN my_salary_null THEN
DBMS_OUTPUT.PUT_LINE ('Salary column was null for employee');
END;

Scratching my head --All help gratefully received
 
CTO,

You are VERY close...your INTO statement needs to immediately follow the expressions you SELECT, so it should read:
Code:
...BEGIN
    SELECT * INTO my_emp_record
    FROM employee
    WHERE empid = my_empid;...
Try that and let us know if you have success.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 20:19 (06May04) UTC (aka "GMT" and "Zulu"), 13:19 (06May04) Mountain Time)
 
Thanks Santa
...you've given me the boost I need.

CTO1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top