Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following: and Encoun

3126882Jul 15 2016 — edited Jul 15 2016

I tried to write a procedure like following :

create or replace procedure xx_test_item

( p_item IN varchar2)

as

l_attribute_1 varchar2(30);

l_count varchar2(30);

begin

select attribute_1 

into l_attribute_1

from xxcz_config_attributes

where user_config_id = p_item

and attribute_category = 'ITEM_RELATIONSHIPS';

select count(1)

into l_count

from mtl_system_items_b msib, xxcz_config_attributes xca

where msib.segment1 = xca.attribute_1;

if (l_attribute_1 = p_item)

then

dbms_output.put_line('Main Item and Related item is same :'||l_attribute_1);

else if

(l_attribute_1 IS NULL)

then

dbms_output.put_line('Not a valid item!!!');

else if

(l_count > 0)

then

dbms_output.put_line('Items matched!!!');

else

dbms_output.put_line('Items not matching :'||l_attribute_1);

end if;

exception

WHEN no_data_found THEN

      dbms_output.put_line('No such item');

   WHEN others THEN

      dbms_output.put_line('Error!');

end;

*********************************while compiling , it gives the following errors ***********************************

Compilation errors for PROCEDURE APPS.XX_TEST_ITEM

Error: PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:

      

          ( begin case declare end exit for goto if loop mod null

          pragma raise return select update while with <an identifier>

          <a double-quoted delimited-identifier> <a bind variable> <<

          continue close current delete fetch lock insert open rollback

          savepoint set sql execute commit forall merge pipe purge

Line: 32

Error: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

      

          end not pragma final instantiable order overriding static

          member constructor map

Line: 38

Text: end;

Please help me in solving this!!!

This post has been answered by Frank Kulash on Jul 15 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2016
Added on Jul 15 2016
6 comments
12,142 views