Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0125· openaiHugging Face Suzhen/CodeChat

Error at line 41: PLS-00103: Encountered the symbol “COMPUTERS” when expecting one of…

  1. User

    Error at line 41: PLS-00103: Encountered the symbol “COMPUTERS” when expecting one of the following: := . ( @ % ; Error at line 47: PLS-00103: Encountered the symbol “end-of-file” when expecting one of the following: end not pragma final instantiable persistable order overriding static member constructor map Error at line 44: PLS-00103: Encountered the symbol “END” when expecting one of the following: begin function pragma procedure subtype type current cursor delete exists prior The symbol "begin was inserted before “END” to continue. CREATE OR REPLACE PACKAGE CreatingDataBase IS PROCEDURE Filling; PROCEDURE Deleting; END CreatingDataBase;

    /

    CREATE OR REPLACE PACKAGE BODY CreatingDataBase IS

    PROCEDURE Filling IS BEGIN INSERT INTO Firms (firm_id, firm_name) VALUES (1, ‘Apple’); INSERT INTO Firms (firm_id, firm_name) VALUES (2, ‘HP’); INSERT INTO Firms (firm_id, firm_name) VALUES (3, ‘Dell’); INSERT INTO Firms (firm_id, firm_name) VALUES (4, ‘Lenovo’);

    INSERT INTO ComputerTypes (type_id, type_name) VALUES (1, ‘Laptop’); INSERT INTO ComputerTypes (type_id, type_name) VALUES (2, ‘Desktop’); INSERT INTO ComputerTypes (type_id, type_name) VALUES (3, ‘Tablet’);

    – Apple Laptop INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES (1, 2100, 1, 1); – HP Desktop INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES (2, 2600, 2, 2); – Dell Laptop INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES (3, 2400, 1, 3); – Lenovo Tablet INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES (4, 1800, 3, 4); – HP Laptop INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES (5, 2000, 1, 2);

    END Filling;

    PROCEDURE Deleting IS BEGIN TRUNCATE computers; TRUNCATE computerTypes; TRUNCATE firms; END Deleting;

    END CreatingDataBase;

  2. Assistant

    The error in the code is due to the incorrect commenting syntax used in the SQL code.

    In SQL, comments should be indicated with '--' not '–'.

    Here is the corrected version of the code:

    CREATE OR REPLACE PACKAGE CreatingDataBase IS
    PROCEDURE Filling;
    PROCEDURE Deleting;
    END CreatingDataBase;
    
    /
    
    CREATE OR REPLACE PACKAGE BODY CreatingDataBase IS
    
    PROCEDURE Filling IS
    BEGIN
    INSERT INTO Firms (firm_id, firm_name) VALUES
    (1, 'Apple');
    INSERT INTO Firms (firm_id, firm_name) VALUES
    (2, 'HP');
    INSERT INTO Firms (firm_id, firm_name) VALUES
    (3, 'Dell');
    INSERT INTO Firms (firm_id, firm_name) VALUES
    (4, 'Lenovo');
    
    INSERT INTO ComputerTypes (type_id, type_name) VALUES
    (1, 'Laptop');
    INSERT INTO ComputerTypes (type_id, type_name) VALUES
    (2, 'Desktop');
    INSERT INTO ComputerTypes (type_id, type_name) VALUES
    (3, 'Tablet');
    
    -- Apple Laptop
    INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES
    (1, 2100, 1, 1);
    -- HP Desktop
    INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES
    (2, 2600, 2, 2);
    -- Dell Laptop
    INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES
    (3, 2400, 1, 3);
    -- Lenovo Tablet
    INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES
    (4, 1800, 3, 4);
    -- HP Laptop
    INSERT INTO Computers (computer_id, frequency, type_id, firm_id) VALUES
    (5, 2000, 1, 2);
    
    END Filling;
    
    PROCEDURE Deleting IS
    BEGIN
    TRUNCATE computers;
    TRUNCATE computerTypes;
    TRUNCATE firms;
    END Deleting;
    
    END CreatingDataBase;
    

    By using '--' for comments instead of '–', the code should execute without errors.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.