create or replace procedure list_job_applications(v_job_id NUMBER)
IS
cursor c1 is select v_job_id
from accounts a, job_app ja, job_seekser js, skill s, job_seeker_skills jss
where a.accid = js.accid and a.accid = ja.accid and ja.accid = jss.accid and jss.sid = s.sid;
v_count int;
begin
select count(*) into v_count from job_posts where job_id =v_job_id;
if v_count = 0 then
dbms_output.put_line('Invalid job post ID');
else
for item in c1 loop
dbms.out.put_line('Account ID: ' || a.accid);
dbms.out.put_line('Name: ' || a.acc_holder_name);
dbms.out.put_line('Application Date: ' || TO_CHAR(a.application_date, 'DD-MON-YYYY'));
dbms.out.put_line('Highest Degree: ' || js.highest_degree);
dbms.out.put_line('Work Experience (Years): ' || js.years_exp);
dbms.out.put_line('Skill: ' || sskill_name || ', Level: ' || jss.skill_level);
end loop;
end if;
end;
/
我目前正在解决一个问题,列出特定职位的所有申请,其中输入是职位 ID。目的是检查输入是否有效,如果有效,则会列出职位、帐户 ID、姓名、申请日期、最高学位、工作经验年数、技能名称和每个人的技能水平等项目。申请人。
目前我遇到错误,例如:
3/14 PL/SQL: SQL Statement ignored
4/46 PL/SQL: ORA-00942: table or view does not exist
13/13 PL/SQL: Statement ignored
13/49 PLS-00201: identifier 'ACCID' must be declared
14/13 PL/SQL: Statement ignored
14/43 PLS-00201: identifier 'A.ACC_HOLDER_NAME' must be declared
15/13 PL/SQL: Statement ignored
15/63 PLS-00201: identifier 'A.APPLICATION_DATE' must be declared
16/13 PL/SQL: Statement ignored
16/53 PLS-00201: identifier 'JS.HIGHEST_DEGREE' must be declared
17/13 PL/SQL: Statement ignored
17/62 PLS-00201: identifier 'JS.YEARS_EXP' must be declared
18/13 PL/SQL: Statement ignored
18/44 PLS-00201: identifier 'SSKILL_NAME' must be declared
抱歉,我不知道我是否正确理解了前提,但我认为您可能想要执行以下操作,请记住我不知道每个表中的字段。
主要是我在游标的WHERE中添加了v_job_id输入参数,虽然我不知道它属于哪个表来比较它,并且我修改了字段和访问游标的方式来显示信息(你遇到的问题!)。
create or replace procedure list_job_applications(v_job_id in NUMBER)
IS
cursor c1 is select a.accid, a.acc_holder_name, a.application_date, js.highest_degree, js.years_exp, s.skill_name, jss.skill_level -- v_job_id
from accounts a, job_app ja, job_seekser js, skill s, job_seeker_skills jss
where a.accid = js.accid and a.accid = ja.accid and ja.accid = jss.accid and jss.sid = s.sid and job_id = v_job_id;
v_count int;
begin
select count(1) into v_count from job_posts where job_id = v_job_id;
if v_count = 0 then
dbms_output.put_line('Invalid job post ID');
else
for item in c1 loop
dbms.out.put_line('Account ID: ' || item.accid);
dbms.out.put_line('Name: ' || item.acc_holder_name);
dbms.out.put_line('Application Date: ' || TO_CHAR(item.application_date, 'DD-MON-YYYY'));
dbms.out.put_line('Highest Degree: ' || item.highest_degree);
dbms.out.put_line('Work Experience (Years): ' || item.years_exp);
dbms.out.put_line('Skill: ' || item.skill_name || ', Level: ' || item.skill_level);
end loop;
end if;
end;
希望这可以帮助到你