Domanda

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.

È stato utile?

Soluzione

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

Altri suggerimenti

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;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top