Roto
Roto

Reputation: 587

What is wrong with my syntax in this simple procedure?

Im an SQL Server guy and struggling with PLSQL. I think it is the way I am using the p_rc cursor

CREATE OR REPLACE PROCEDURE "SP_EMAILLINKSCRUD" (
    pAction IN nvarchar2,
    pStormId IN number,
    p_rc OUT Pkg_Types.grc
)
AS
BEGIN
    if pAction = 'getManagerEmails' then
        OPEN p_rc FOR
        select * from table1;

    else if pAction = 'getSentEmailLinks' then
        OPEN p_rc FOR
        select * 
        from table2 
        where stormId = pStormId; 
    end if;

END SP_EMAILLINKSCRUD;

Upvotes: 1

Views: 53

Answers (1)

William Robertson
William Robertson

Reputation: 16001

You started a new nested if here but didn't close it:

else if pAction = 'getSentEmailLinks' then

That should probably be:

elsif pAction = 'getSentEmailLinks' then

Upvotes: 4

Related Questions