plsql error invalid number
I'm getting an invalid number error when
procedure Afficher(opt int,id int) is
type emp is record(fn employees.first_name%type,
lname employees.last_name%type,
job jobs.job_title%type,
dep departments.department_id%type);
emp1 emp;
begin
select e1.first_name,e1.last_name,j.开发者_StackOverflowjob_title,d.department_name into emp1
from employees e1 ,jobs j,departments d where e1.employee_id= 'id' and
e1.job_id=j.job_id and e1.department_id =d.department_id ;
dbms_output.put_line('Name Job Department');
dbms_output.put_line(emp1.fn||''|| emp1.lname||' '
||emp1.job||' '||emp1.dep);
end Afficher;
You're looking for e1.employee_id='id'
; is it actually a string, or a number?
You probably want:
procedure Afficher(opt int,id int) is
type emp is record(fn employees.first_name%type,
lname employees.last_name%type,
job jobs.job_title%type,
dep departments.department_id%type);
emp1 emp;
begin
select e1.first_name,e1.last_name,j.job_title,d.department_name into emp1
from employees e1 ,jobs j,departments d where e1.employee_id= id and
e1.job_id=j.job_id and e1.department_id =d.department_id ;
dbms_output.put_line('Name Job Department');
dbms_output.put_line(emp1.fn||''|| emp1.lname||' '
||emp1.job||' '||emp1.dep);
end Afficher;
I.e. no quotes around the id variable.
It's probably better to rename the variable to *emp_id* or something similar.
精彩评论