我正在尝试执行下面的块,但错误为“找不到数据”,即使表中有可用的数据要处理:
此块正在尝试调用另一个用户定义的过程并从变量中传递参数:
DECLARE
v_file_name regression_status.file_name%TYPE;
v_run_no regression_status.run_no%TYPE;
v_stream_id regression_status.stream_id%TYPE;
v_job_id regression_status.job_id%TYPE;
str VARCHAR2 (100) := 'A ,B ,C ,D';
v_count VARCHAR2 (100);
BEGIN
SELECT COUNT (status)
INTO v_count
FROM regression_status
WHERE status = 'R';
LOOP
BEGIN
FOR i IN ( SELECT TRIM (REGEXP_SUBSTR (str,
'[^,]+',
1,
LEVEL))
l
FROM DUAL
CONNECT BY LEVEL <= REGEXP_COUNT (str, ',') + 1)
LOOP
DBMS_OUTPUT.put_line (i.l);
SELECT tbl.run_no,
TBL.JOB_ID,
TBL.STREAM_ID,
TBL.FILE_NAME
INTO v_run_no,
v_job_id,
v_stream_id,
v_file_name
FROM REGRESSION_STATUS tbl
INNER JOIN ( SELECT job_id, MIN (run_no) min_run_no
FROM REGRESSION_STATUS
WHERE status = 'R'
GROUP BY job_id) tbl1
ON tbl1.job_id = tbl.job_id
WHERE tbl1.min_run_no = tbl.run_no
AND tbl.file_name LIKE '%' || i.l || '%';
DBMS_OUTPUT.put_line (
'script executing for file : '
|| v_file_name
|| ' '
|| v_stream_id
|| ' '
|| v_run_no
|| ' '
|| v_job_id
|| ' ');
MAIN_PKG.PROC (v_run_no,
'v_job_id',
SUBSTR (v_stream_id, 0, 2),
'v_file_name');
UPDATE regression_status
SET status = 'S', end_time = SYSDATE
WHERE file_name = v_file_name;
COMMIT;
END LOOP;
END;
EXIT WHEN v_count <= 0;
END LOOP;
END;
答案 0 :(得分:0)
唯一可以返回SELECT
的{{1}}就是:
NO-DATA-FOUND
当您运行时(即复制/粘贴上面的代码),可能通过更改最后一行(A,B,C,D)会发生什么?你能否验证它确实会返回某些东西(是的,我知道 - 你说它确实如此,但Oracle不同意)。