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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Why I got PLS-00103 error for this procedure?

lxiscasJan 21 2013 — edited Jan 21 2013
hi, guys:

I have a question about exception syntax, I want to record the number of rows of multiple tables, but if a table does not exist, my program should be able to continue loop.
create or replace procedure check_rows as


   cursor t1 is select table_name from all_csv
             where table_built='Y'
             and table_name is not null;

  match_count1 INTEGER;
  
begin

   for n in t1 loop
   
      dbms_output.put_line(n.table_name);
      EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || n.table_name INTO match_count1 ;

      
      update all_csv
      set total_rows=match_count1
      where table_name=n.table_name;
      
      exception when table_does_not_exist then null end;  

   end loop;
   
   commit;

end;
I go ta syntax error as :


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> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe

Anyone could give me a hint?

Thanks a lot!

Sam
This post has been answered by Solomon Yakobson on Jan 21 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2013
Added on Jan 21 2013
2 comments
460 views