plsql - PL/SQL Error With Nested IF statements -
apex 4.2
i have following pl/sql code block below whenever run in apex, keep getting error:
ora-06550: line 35, column 4: pls-00103: encountered symbol ";" when expecting 1 of following: if
declare show_changes boolean; l_exists integer; begin select count(*) l_exists dba_role_privs grantee = upper(:app_user) , (granted_role = 'survey_job_suid' or granted_role = 'survey_suid'); if l_exists = 0 /* unauthorized */ if :p32_survey_job_request_id not null , (:p32_submission_date null , :p32_lock_date null) show_changes := true; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date null) show_changes := true; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date not null) show_changes := false; end if; else /* authorized */ if :p32_survey_job_request_id not null , (:p32_submission_date null , :p32_lock_date null) show_changes := true; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date null) show_changes := true; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date not null) show_changes := true; end if; return show_changes; end;
i'm not sure problem is. appreciated. in advance.
an if
has paired end if
, else
comes before end if
. if want have 3 separate if
statements in each of 2 branches in outer if
, you'd want like
if l_exists = 0 if :p32_survey_job_request_id not null , (:p32_submission_date null , :p32_lock_date null) show_changes := true; end if; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date null) show_changes := true; end if; if :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date not null) show_changes := false; end if; else <<repeat pattern>> end if;
my guess, however, don't want have 3 separate if
statements in each branch. guess want single if
statement elsif
if l_exists = 0 if :p32_survey_job_request_id not null , (:p32_submission_date null , :p32_lock_date null) show_changes := true; elsif :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date null) show_changes := true; elsif :p32_survey_job_request_id not null , (:p32_submission_date not null , :p32_lock_date not null) show_changes := false; end if; else <<repeat pattern>> end if;
Comments
Post a Comment