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

DBMS - SQL - Any/All
All - Operator SELECT empno, sal FROM emp WHERE sal > ALL (1999, 2999, 3999); Output of Above query is same as below query SELECT empno, sal FROM emp WHERE sal > 1999 AND sal > 2999...

Radhe Shyam

0 0
0

New features of Oracle 23ai
2 of the new features of Oracle 23ai (previously Oracle 23c) with respect to SQL are discussed. 1. Boolean datatype included in SQL. Previously, boolean was not part of SQL, but belonged to Oracle...

How To Return a Result Set from a Stored Procedure
One of the easiest ways to tackle such Real Time scenarios is through use of Oracle Defined "SYS_REFCURSOR" or "REF CURSOR". We can create a Procedure with an out parameter of Type SYS_REFCURSOR and in...
S

What is a SQL join?
A SQL join is a Structured Query Language (SQL) instruction to combine data from two sets of data (e.g. two tables). Before we dive into the details of a SQL join, let’s briefly discuss what SQL...

What is a Dashboard?
Introduction There are many different ideas of what a dashboard is. This article will clearly define it along with other presentation tools. In article, What is BI? - A Business Intelligence Primer, it...
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