Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: procedure and ddl commands?
"dead" <OVOIZBACI-vlasic_at_vodatel.net> wrote in message news:<ce2fsg$f77$1_at_sunce.iskon.hr>...
> Can someone help me.
> I wolud like to make procedure on server with creating tables, sequences and
> indexes.
> 1. can I put ddl commands in oracle procedures?
> 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?
1 you'll need to use the execute immediate command
IMO, creating tables and indexes in a procedure is a BAD idea. You'll
loosing control, doing so
2 Issue an ordinary select into to determine your value.
Then create the sequence using execute immediate
execute immediate 'create sequence foo start with :1' using <the
variable you got the result in>
Sybrand Bakker
Senior Oracle DBA
Received on Mon Jul 26 2004 - 09:25:56 CDT