Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: procedure and ddl commands?
> I wolud like to make procedure on server with creating tables, sequences and
> indexes.
> 1. can I put ddl commands in oracle procedures?
Yes, using dynamic SQL. Be advised that this is generally considered
bad practice, as DDL should really only be executed once, and
therefore should not need to be "coded" as part of a procedure. It is
also for security purpose, since what's going to happen if someone (a
developer) inadvertently executes it?
> 2. how to put create sequnce command with 'start with' value as result of
> 'select command' (I need max value +1 from table for next value of
> sequence) in procedure?
Take a look at the SQL*Plus manual on tahiti.oracle.com, and see how
you can produce and run SQL*Plus scripts with variables in it. You
will need to dynamically generate the creation statement for the
sequence. This is not as complex as it sounds. I don't have handy an
example, but I'm sure you can manage with a bit of reading.
Daniel Received on Mon Jul 26 2004 - 09:15:00 CDT