Sql

Discussion in 'The Bucket' started by blackraven1425, May 13, 2010.

to remove this notice and enjoy 3reef content with less ads. 3reef membership is free.

  1. blackraven1425

    blackraven1425 Giant Squid

    Joined:
    Mar 1, 2010
    Messages:
    4,780
    I'm having an issue with SQL; I know this isn't the right place for commputer/project issues, but the responses here tend to be a bit faster, and it's kinda due by midnight lol

    I have this procedure for a database course, using Oracle DB, and the procedure won't "finish"; it gives a line number after the "SQL>" prompt that I run the script w/ this procedure at. The line number is line 8; the procedure is 7 lines long.

    CREATE OR REPLACE PROCEDURE addNewSkill(
    desc IN VARCHAR(50)
    )
    AS
    BEGIN
    INSERT INTO SKILL VALUES(skill_num_sequence.NEXTVAL, desc);
    END addNewSkill;
     
  2. Click Here!

  3. blackraven1425

    blackraven1425 Giant Squid

    Joined:
    Mar 1, 2010
    Messages:
    4,780
    bump; hopefully someone good with SQL is around lol. my professor still hasn't answered my question.
     
  4. Peredhil

    Peredhil Giant Squid

    Joined:
    Aug 20, 2008
    Messages:
    5,176
    Location:
    Texas
    you using SQL or Oracle :confused:
     
  5. Peredhil

    Peredhil Giant Squid

    Joined:
    Aug 20, 2008
    Messages:
    5,176
    Location:
    Texas
    it's been a while for me... try it again but remove that first ;

    I see two of them but *thinking* that first one isn't needed... I haven't done this in a while though... give it a shot.
     
  6. RHorton

    RHorton Pajama Cardinal

    Joined:
    May 11, 2007
    Messages:
    1,407
    Location:
    upstate NY
    I agree there should be only one semi colon at the end of the statement. By putting the first one in you are essentially telling it that it ends there.
     
  7. blackraven1425

    blackraven1425 Giant Squid

    Joined:
    Mar 1, 2010
    Messages:
    4,780
    I'm using Oracle DB 11g, writing in SQL since they use it for the language.

    You're talking about the one at the insert statement? <Gives the same line #

    Or the one at the END? <still gives the line #....
     
  8. Click Here!

  9. RHorton

    RHorton Pajama Cardinal

    Joined:
    May 11, 2007
    Messages:
    1,407
    Location:
    upstate NY
    yes try taking that one out. In most sql statements there is only one semicolon and it is ussally at the end of the procedure.
     
  10. blackraven1425

    blackraven1425 Giant Squid

    Joined:
    Mar 1, 2010
    Messages:
    4,780
  11. blackraven1425

    blackraven1425 Giant Squid

    Joined:
    Mar 1, 2010
    Messages:
    4,780
    Ah, the steps farther down the page lead to the error that shows up during compilation:

    "PLS-00103: encountered the symbol "desc" when expecting one of the following:
    <an identifier> <a double quoted delimited-identifier>
    current delete exists prior


    ...I still don't know exactly what that means lol
     
  12. blackraven1425

    blackraven1425 Giant Squid

    Joined:
    Mar 1, 2010
    Messages:
    4,780
    Bleh, stupid f'in oracle.....it was the lack of "p_" in front of desc.

    CREATE OR REPLACE PROCEDURE addNewSkill(
    p_desc IN VARCHAR
    )
    AS
    BEGIN
    INSERT INTO SKILL VALUES(skill_num_sequence.NEXTVAL, p_desc);
    END addNewSkill;
    /