Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Stored Procedure Error PLS-00103

613320Dec 11 2008 — edited Dec 11 2008
Hello everyone,

I am working on some school work and I am get a few errors in my code. I am trying to create a stored procedure the retrieves all rows from the employee table and then concatenates the colums.

I am get 2 errors one on line2 col1 and line16 col4

PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor external language
The symbol "begin" was substituted for "DECLARE" to continue.

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe

Here is my code:

create or replace procedure getemployees
declare
cursor c1 is
select *
from employees
order by employee_id;
begin
for r_c1 in c1 loop
dbms_output.put_line(r_c1.employee_id||','||r_c1.first_name||','
||r_c1.last_name||','||r_c1.email||','||r_c1.phone_number||','
||r_c1.hire_date||','||r_c1.job_id||','||r_c1.salary||','
||r_c1.commission_pct||','||r_c1.manager_id||','||r_c1.department_id);
end loop;
exception when others then
raise;
end;
/

Thanks in advance

Edited by: user610317 on Dec 11, 2008 7:10 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2009
Added on Dec 11 2008
19 comments
2,919 views