Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8778073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:26:14+00:00 2026-06-13T19:26:14+00:00

I get the following error, even though I have checked the code carefully. I

  • 0

I get the following error, even though I have checked the code carefully. I don’t know what I’m missing.

LINE/COL ERROR


31/1 PLS-00103: Encountered the symbol “END” when expecting one of the
following:

CODE:

CREATE OR REPLACE PROCEDURE sp_ssjm_newworkorder
(   workorderno IN NUMBER,
company     IN CHAR,
attention   IN CHAR,
datedue     IN DATE,
loggedby    IN CHAR
)

AS  id     NUMBER;
today         DATE:=SYSDATE;
BEGIN
SELECT  client_id   --grab client_id
INTO id 
FROM    ssjm_client
WHERE ssjm_client.name=company;

IF id IS NULL THEN  --check if client exists by checking if client_id is there
    dbms_output.put_line('Please create client first');
    GOTO the_end;
ELSE
    INSERT INTO ssjm_workorder      VALUES(workorderno,workorderno,company,loggedby,attention,'Received',today,datedue,id);
END IF;

EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20999,'An error occured in' ||
        SQLCODE || '-ERROR-' || SQLERRM);

<<the_end>>

END sp_ssjm_newworkorder;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:26:15+00:00Added an answer on June 13, 2026 at 7:26 pm

    There are several spots in your code needed attention:

    1. The reason you’ve got that error is because label <<the_end>> should be placed before the EXCEPTION section.
    2. Operator is required after a label. So if you want to jump to the end of a stored procedure and no other actions required NULL operator should be used.

    To that end your code should look like this:

    IF id IS NULL THEN  --check if client exists by checking if client_id is there
        dbms_output.put_line('Please create client first');
        GOTO the_end;
    ELSE
        INSERT INTO ssjm_workorder
     VALUES(workorderno,workorderno,company,loggedby
           ,attention,'Received',today,datedue,id);
    END IF;
    
    <<the_end>>
    NULL;
    
    EXCEPTION
        WHEN OTHERS THEN
        raise_application_error(-20999,'An error occured in' ||
            SQLCODE || '-ERROR-' || SQLERRM);
    END sp_ssjm_newworkorder;
    

    By all means try to avoid unconditional branching. Using GOTO operator is very, very not good practice. It kills readability, code like that hard to debug. It will cause you and everybody who will look at that code after you a headache. Moreover if the query

    SELECT  client_id   --grab client_id
    INTO id 
    FROM    ssjm_client
    WHERE ssjm_client.name=company;
    

    returns no rows the exception NO_DATA_FOUND will be immediately raised and execution of the code halts. So IF id IS NULL THEN condition will never be evaluated. You may rewrite your code by removing that condition and adding NO_DATA_FOUND exception handler in the EXCEPTION section of your code. And of course as @Rob van Wijk correctly pointed out in the comment

    but code can be cleaned up further. today variable can be removed and
    the WHEN OTHERS should definitely be removed. As it is now, it just
    transforms an error to a longer error message without more detail and
    most importantly: it disguises the line number where the real error
    took place.

    there is no need of today variable, SYSDATE can be used directly in the values clause of the insert statement, and WHEN OTHERS can be removed as well.

    CREATE OR REPLACE PROCEDURE sp_ssjm_newworkorder
    (
    workorderno IN NUMBER,
    company     IN CHAR,
    attention   IN CHAR,
    datedue     IN DATE,
    loggedby    IN CHAR
    )
    AS  
      id     NUMBER;
    BEGIN
      SELECT client_id   --grab client_id
        INTO id
        FROM ssjm_client
       WHERE ssjm_client.name=company;
    
        INSERT INTO ssjm_workorder      
          VALUES(workorderno,workorderno,company,loggedby
                ,attention,'Received',SYSDATE,datedue,id);
    
    EXCEPTION
        when NO_DATA_FOUND
        then dbms_output.put_line('Please create client first');
    END sp_ssjm_newworkorder;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error while: mConsumerTokenManager = (IConsumerTokenManager)container.Resolve(typeof(IConsumerTokenManager), null); even though I have
I get the following error even when my JAVA_HOME is set correctly. C:\workspace-sts-2.8.0.RELEASE\JBClient\target>echo %JAVA_HOME%
I get the following error for the second argument even when I set the
I get following error (SyntaxError): missing ] after element list when using eval function.
I am using the code as described in this question. However get following error
Working through Michael Hartl's RailsTutorial and came across the following error - even though
I get following error message, when I try to run git rebase -i for
I get following error when deploying on test server with II6 and Framework 3.5
I get following error when trying to access Xampp from a network I've tried
I get following error: 2012-04-04 23:46:18.374 istiqlaltv[17121:e903] -[istiqlaltvViewController moviePlayBackDidFinish]: unrecognized selector sent to instance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.