| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.misc -> Re: whenever sqlerror is an unknown statement?
My overall goal is to create a table iff it doesn't exist.  After more
poking around the docs, I've got this:
begin
   select * from all_tables where table_name = 'foo';
   exception
   when no_data_found then
   begin
      create table foo(bar char(5));
   end;
end;
And SQL Workshop says:
 m
ORA-06550: line 6, column 4: PLS-00103: Encountered the symbol "CREATE"
when expecting one of the following: begin case declare 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
Bah! Why can't I have a create, but I can have a select or update or anything else?
|  |  |