Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: whenever sqlerror is an unknown statement?

Re: whenever sqlerror is an unknown statement?

From: Andy Hassall <andy_at_andyh.co.uk>
Date: Fri, 20 Jan 2006 20:27:47 +0000
Message-ID: <6gh2t1pmodeto9494ipvkpm2ldtnci8k7u@4ax.com>


On 20 Jan 2006 11:28:38 -0800, jjsavage_at_gmail.com wrote:

>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';

 You need an INTO clause, even if you don't actually care about the result.

> exception
> when no_data_found then
> begin
> create table foo(bar char(5));

 You can't write DDL directly in PL/SQL, you have to wrap it in EXECUTE IMMEDIATE.
> end;
>end;
>
>Bah! Why can't I have a create, but I can have a select or update or
>anything else?

http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/dynamic.htm#CACDDACH

-- 
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Received on Fri Jan 20 2006 - 14:27:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US