Reputation: 353
create or replace procedure p_inout
(v_emp_lname in varchar2(25))
as
v_first_name varchar2(20);
begin
select first_name into v_first_name
from employees
where last_name=v_emp_lname;
dbms_output.put_line(v_first_name);
end;
I am getting Error(2,25): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
Upvotes: 0
Views: 84
Reputation: 230
To fetch more than more record you have to use cursor. The code above needs some modification to fetch more than one record.
create or replace procedure p_inout
(v_emp_lname in varchar2)
as
v_first_name varchar2(20);
begin
for rec in (select first_name
from employees
where last_name=v_emp_lname)
loop
dbms_output.put_line('First name/s'||' '||rec.first_name);
end loop;
end;
Upvotes: 1
Reputation: 12169
Parameter arguments' types such as varchar2 do not have size attributes, so replace "varchar2(25)" with just "varchar2".
See the Oracle docs on parameter usage. Specifically:
**Parameter Datatypes**
The datatype of a formal parameter consists of one of the following:
An unconstrained type name, such as NUMBER or VARCHAR2.
A type that is constrained using the %TYPE or %ROWTYPE attributes
Upvotes: 1