1

I'm developing a trigger in PL/SQL.

It has this building structure:

if a = 1 then
    if b = 1 then
        (some code here);
    else if b=2 then
        (some code here);
    else if b=3 then
        (some code here);
    else b=4
        (some code here);
    end if;
else if a=2 then
    if b=1 then
        (some code here);
    else if b=2 then
        (some code here);
    else if b=3 then
        (some code here);
    else b=4
        (some code here);
    end if;
else
    if b=1 then
        (some code here);
    else if b=2 then
        (some code here);
    else if b=3 then
        (some code here);
    else b=4
        (some code here);
    end if;
end if;

However, it seems like the last else statement(a=3) is not well defined, cause the compiler says to me that expects a " ( "

Can i have a help in here? Thank you all

1
  • 1
    the issue stems from else if which should be elsif. Need to be fixed for every occurence within your code. Commented Sep 19, 2022 at 8:55

1 Answer 1

3

That's because you probably meant to say ELSIF, not ELSE IF (not only at the last place you mentioned, but everywhere).

Something like this:

if a = 1 then
    if b = 1 then
        (some code here);
    elsif b=2 then
        (some code here);
    elsif b=3 then
        (some code here);
    elsif b=4
        (some code here);
    end if;
elsif a=2 then
    if b=1 then ...
Sign up to request clarification or add additional context in comments.

4 Comments

Somehow solved that error, however gives me an error at the end trigger clause, expecting semicolon, parenthesis, full stop... If i add another end if at the end, the error...poof, gone, but i don't think that makes sense, what does that end if "closes"?
Can't tell, unless you post code you currently have.
solve me the error, so this question has to be marked as solved, thank you
I'm glad you made it work, you're welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.