ReportStartDate 및 ReportEndDate에 대해 쿼리를 수행하므로 PLSQL에서 변수를 사용할 것으로 생각됩니다. 확실하지 내가 여기 실종,하지만 난 오류가 무엇을 얻을 :PLSQL SELECT 문에서 변수 사용
CLEAR;
DECLARE
varReportStartDate Date := to_date('05/01/2010', 'mm/dd/yyyy');
varReportEndDate Date := to_date('05/31/2010', 'mm/dd/yyyy');
BEGIN
SELECT
'Value TYPE',
1 AS CountType1,
2 AS CountType2,
3 AS CountType3
FROM DUAL;
SELECT COUNT (*)
FROM CDR.MSRS_E_INADVCH
WHERE 1=1
AND ReportStartDate = varReportStartDate
AND ReportEndDate = varReportEndDate
;
END;
/
오류 :이 두꺼비뿐만 아니라 SQL Developer에서 발생
Error starting at line 2 in command:
Error report:
ORA-06550: line 6, column 5:
PLS-00428: an INTO clause is expected in this SELECT statement
ORA-06550: line 8, column 5:
PLS-00428: an INTO clause is expected in this SELECT statement
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
합니다.
WHERE 절에 변수를 사용하는 올바른 방법은 무엇입니까?