我是SQL / PLSQL的新手,但我非常热衷于加快速度和学习(目前看似错误),所以请保持温和。
我已经交给另一位同事PLSQL代码进行测试。我将在以下几个方面解开。我正在运行以下代码段示例:
SELECT cust_code || '_' || substr(p_year_code, 1, 2), --using this brings an error
-- SELECT cust_code --using this works fine
cust_title,
cust_dept_code,
decode( cust_duration, ':', '0', '', '0',
extract(hour from (to_timestamp(cust_duration,'hh24:MI'))) * 60 +
extract(minute from (to_timestamp(cust_duration,'hh24:MI')))
) cust_duration,
cust_date,
(CASE
WHEN cust_date IS NOT NULL THEN
to_date(to_char(cust_date,'DD-MM-YYYY') || ' ' || cust_time, 'DD-MM-YYYY HH24:MI')
ELSE NULL
END) cust_time,
cust_exp_code time_period,
fw_person_get_desc('PERSON', cust_asmm_code ,null) cust_asmm_desc
FROM CUST,
DETAIL
WHERE cust_examiner_id = detail_id(+)
AND detail_change_ind IS NULL
-- AND cust_start_code <= p_year_code
-- AND cust_end_code >= p_year_code
AND cust_exp_code IN ('4', '5')
AND cust_asmm_code IN ('01', '02', '03', '06', '10')
AND EXISTS ( SELECT 1
FROM ACTIVITY
WHERE activity_asmt_code = cust_code
-- AND activity_code = p_year_code
);
然而,当我运行代码时,我收到错误ORA-00904:“p_year_code”无效标识符(如果有帮助则使用TOAD) 我可以访问引用p_year_code的表和包(据我所见) 我可以使用注释掉的详细行
来运行它更新了包裹详细信息:
PROCEDURE pw_process_activity_details (
p_year_code IN cust.cust_start_code%TYPE);
非常感谢有关测试SQL / PLSQL的任何进一步知识/建议。
干杯! 杰克