Ask the Expert

ORA-06550 error produced from function within package

I have this function within a package that keeps on producing the error:

ORA-06550: line 1, column 217:nPLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:nn begin case declare end exception exit for goto if loop modn null pragma raise"...

Here is the source code:

FUNCTION add_card_server_slots(cards_id NUMBER,
                                server_slot_id NUMBER,

                                server_slot_ver NUMBER,
                                server_page_ver NUMBER,
                                server_page_name VARCHAR2,
                                server_conds_id IN my_numeric_table) 

RETURN NUMBER IS csslots_id_assigned NUMBER; new_server_id NUMBER; len
NUMBER(8) := 0; s_conds_id VARCHAR2(100);
CURSOR csslots_assigned_cur IS
         SELECT id FROM card_server_slots WHERE card_id=cards_id AND slot_id=server_slot_id; BEGIN
         -- No need to throw exception if a record exist for this card, just update the current record.
         IF NOT csslots_assigned_cur%ISOPEN
         OPEN csslots_assigned_cur;
         END IF;
         FETCH csslots_assigned_cur INTO csslots_id_assigned;
         IF csslots_assigned_cur%NOTFOUND
                 -- Do the actual insertion in card_server_slots.
                 SELECT card_server_slots_id_SEQ.nextval INTO 
new_server_id FROM dual;
                 INSERT INTO card_server_slots

('Passed 1st statement');
                 FOR i IN 1..server_conds_id.last LOOP
                        INSERT INTO card_sslots_conds (card_sslots_id, conds_id)
                        VALUES (new_server_id,server_conds_id(i));
                 END LOOP;
                 -- Update card_server_slots table.
                 UPDATE card_server_slots SET 
 slot_version=server_slot_ver, page_version=server_page_ver,
                 page_name=server_page_name WHERE card_id=cards_id AND 
                 FOR i IN 1..server_conds_id.last LOOP
                    IF len=0
                         len := length(TO_CHAR(server_conds_id(i)));
                         s_conds_id :=
                         len :=
                         s_conds_id :=
                    END IF;
                    IF i!=server_conds_id.last
                         s_conds_id:= RPAD(s_conds_id,1,',');
                    END IF;
                 END LOOP;
         EXECUTE IMMEDIATE 'DELETE FROM card_sslots_conds WHERE
 card_sslots_id=:1 AND conds_id NOT IN (' || s_conds_id || ')' 
 USING new_server_id;
 ('Passed 2nd looping statement');
                 END LOOP;
         END IF;
         CLOSE csslots_assigned_cur;
         RETURN new_server_id;
    END add_card_server_slots;
 END update_card_pkg; -- end PACKAGE BODY update_card_pkg /

Any help would be appreciated. Thanks.

    Requires Free Membership to View

The code doesn't appear to be syntatically correct. In the code, you have two lines that appear as follows:

('Passed 1st statement');


('Passed 2nd looping statement');

These two statements will throw an error. They appear to be comments. If that is the case, then the line needs to start with '--' or the comment needs to be bracketed by '/*' and '*/' as follows:

-- ('Passed 2nd looping statement');


/* ('Passed 2nd looping statement');  */

Finally, at the end of the code are the following lines:

   END add_card_server_slots;

END update_card_pkg; -- end PACKAGE BODY update_card_pkg /

The first END corresponds to the CREATE FUNCTION and BEGIN statements. However, the second END has no corresponding BEGIN. It appears to be from a package body, yet you have included no package body.

This was first published in October 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: