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

WebSphere
WebSphere is a set of Java-based tools from IBM that allows customers to create and manage sophisticated business Web sites. The central WebSphere tool is theWebSphere Application Server (WAS), an application...

What is Big Data and Why Do Organizations Need It?
Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. But it’s not the amount of data that’s...

SQL is not a Rocket Science
I am a Professional and at the inital days I completely hate Databases but I forgot to know that "Everything starts and ends with us".It means the INTEREST starts with us. Everybody knows this but none...

Defect Management
Defect Management Terms: Application Life Cycle (ALM) Development Phase Testing Phase Production Phase ------------------------------------------------------------------ Error ...

Pl SQL Cursors
To process an SQL statement, ORACLE needs to create an area of memory known as the context area; this will have the information needed to process the statement. This information includes the number...
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