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

HTML (Hypertext Markup Language)
HTML (Hypertext Markup Language) is the set of markup symbols or codes inserted in a file intended for display on a World Wide Web browser page. The markup tells the Web browser how to display a Web page's...

What is a VBA Module?
VBA code is stored and typed in the VBA Editor in what are called modules As stated on the VBA Editor page, a collection of modules is what is called a VBA project Every major Microsoft Office product...

Database Origins
The need for a database originates from the fact that computers are dumb devices having batman like abilities which can be smartly be utilised by feeding it the right content. That is, for example, consider...
M

Overview Of Database
A Database is a collection of related data organised in a way that data can be easily accessed, managed andupdated. Any piece of information can be a data, for example name of your school. Database is...
S

Sandeep Tiwari

1 0
0

Microsoft Power BI
Microsoft Power BI is a free, self-service business intelligence cloud service that provides non-technical business users with tools for aggregating, analyzing, visualizing and sharing data. Power BI's...
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