plsql错误无效号码

发布于 2024-10-20 13:33:15 字数 684 浏览 3 评论 0原文

当我遇到无效号码错误时

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'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.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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风透绣罗衣 2024-10-27 13:33:15

您正在寻找e1.employee_id='id';它实际上是一个字符串,还是一个数字?

You're looking for e1.employee_id='id'; is it actually a string, or a number?

凉薄对峙 2024-10-27 13:33:15

您可能想要:

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;

id 变量周围没有引号。

最好将变量重命名为 *emp_id* 或类似的名称。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文