This is probably an elementary question, but I'm new to Oracle SQL. I'm trying to get the SQL below to execute in Oracle SQL Developer. The error information is below the code. I've modified the code since I pasted the error message. Line 28 is the last line in the code, "END;" Line 14 column 1 refers to the word "Select".
DECLARE
v_StartDate Date := &StartDate;
v_EndDate Date := &EndDate;
SET v_StartDate := CASE &StartDate
WHEN TO_DATE('01/01/1900','MM/DD/YYYY')
THEN LAST_DAY(ADD_MONTHS(trunc(current_date),-2))
ELSE TO_DATE(&StartDate - 1) END;
SET v_EndDate := CASE &StartDate
WHEN TO_DATE('01/01/1900','MM/DD/YYYY')
THEN LAST_DAY(ADD_MONTHS(&EndDate,-1))
ELSE TO_DATE(&EndDate + 1) END;
BEGIN
Select *
From
Table
Where date_value > v_StartDate
and date_value < v_EndDate
END;
Error report - ORA-06550: line 28, column 24: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 14, column 1: PL/SQL: SQL Statement ignored ORA-06550: line 28, column 27: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge json_exists json_value json_query json_object json_array 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action: