UrbanPro
true

Learn Oracle PL/SQL from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How to read and understand the Compilation errors?

Gavi Y.
26/12/2016 0 0

Today, we will understand how to interpret the compile time erros and fix them. Don't confuse with runtime errors which is altogether a different subject called Exception Handling.

Compilation erros are normally typing errors or lexical error/syntax errors. 

For Ex: 1. Misspelling a keyword/reserved word or forgetting a keyword itself

           2. Forgetting to close a brace or a delimiter etc.

           3. Forgetting a semicolon.

Compiler would throw an error in such cases and this lesson is to teach you to understand those patterns of errors. Basically, there are 3 patterns as

1. Prior line

2. Current line

3. Declaration Error.

Let us start with examples.
Example 1:


SQL> BEGIN
2 dbms_output.put_line('Hello World!')
3 END;
4 /

Error report -
ORA-06550: line 3, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:

:= . ( % ;
The symbol ";" was substituted for "END" to continue.

Explanation: Prior line error points to an error in the prior statement line, which is mostly a missing semicolon error as in above example. observe the column no. which always says 1 for prior line error, which means beginning of the line or end of the prveious line.

Example 2:

   SQL> DECLARE
       2     a Number :=7;
       3     b Number :=5;
       4     c Number;
       5   BEGIN
       6     c := a b;
       7     dbms_output.put_line('The value of c : '||c);
       8   END;
       9      /

Error report -
ORA-06550: line 6, column 11:
PLS-00103: Encountered the symbol "B" when expecting one of the following:

. ( * @ % & = - + ; < / > at in is mod remainder not rem
<> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
The symbol "." was substituted for "B" to continue.

Explanation: Current line error points to the column of the error or one column after the error. This occurs normally because of missing lexical unit as in above example. Error is at line no. 6 and column 10.

If you are using SQL* Plus, you would also get an asterisk placed right below the column or below the one column right after the error. In case of prior line error, asterisk would be placed immediately below where the error occurs in a statement line.

Example 3:

 SQL> DECLARE
      2    a CHAR := 'AB';
      3  BEGIN
      4    dbms_output.put_line('a contains : '||a);
      5  END;
      6     /

DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 2

Explanation: When an error occurs in Declaration section, the above discussed logic doesn't apply. We get some less obvious error message as in the above example. Error line no. is 1, but that doesn't mean that error occurred before the declaration block.It tells you that error occurs in the declaration section and the last line in the error message points to the specific error line no. This output is from SQL* Plus, unlike other two examples and hence asterisk is placed.

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Interesting thing about Sequences in Oracle
Let's not get into the very basic things like what is sequence?, What is Cache/Nocache, Cycle/NoCycle etc. My topic is something very interesting which many of the beginners might not have noticed. My...

Must know fact about DDL
Hello everyone, This is again for beginners, as a Trainer, it's my duty to educate the beginners/learners. Let's take an example below, --Assume we already have 'EMP' table with the columns- id,name,Sal Insert...

Some Interesting and important built in packages in Oracle
DBMS_JOB : To schedule jobs. DBMS_SCHEDULER: Extended the functionalities of DBMS_JOB. UTL_SMTP: To send mails. UTL_HTTP: To open Web APIs (URLs). DBMS_LOB: Very interesting and useful. Programmatic...

Oracle Architecture - Introduction
As a Oracle developer or a DBA, you should know the in & out of it’s Architecture. Let’s keep it simple first and explore later. Oracle is a software or a program, so like any other program,...

Interview questions on Packages in Oracle
Let me list few standard questions asked in the interviews on plsql package. 1. Why packages are used? What are it's advantages? 2. Name few bulin-in Oracle packages. 3. Can we have a function or procedure...
X

Looking for Oracle PL/SQL Classes?

The best tutors for Oracle PL/SQL Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Oracle PL/SQL with the Best Tutors

The best Tutors for Oracle PL/SQL Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more