Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: If EXISTS before insert clause
On 7 Feb 2005 07:07:57 -0800, "JPike" <jpike_at_welcom.com> wrote:
>Thanks :) The first one works in a simple test but now I am trying it
>on the whole thing. Here is the first part of my file.
>
>declare
> risk number;
> portfolio number;
>begin
> select count(*) into risk from wst_prd where prd_uid = 502;
> select count(*) into portfolio from wst_prd where prd_uid = 501;
>
> ALTER TABLE WPS_TABL ADD BASE_TABTYP VARCHAR2 (4) NULL;
>.
>.
>.
>
>It errors when it hits the ALTER. Is that an illegal thing to use? The
>error it gives me is that ORA-06550: line 19, column 2:
>PLS-00103: Encountered the symbol "ALTER" when expecting one of the
>following:
>
>and then lists a bunch of other keywords.
>
>I am just trying to understand what is wrong with ALTER?
Alter table is DDL. DDL is only supported in Pl/sql by Execute
immediate
Execute immediate 'Alter table ....'
Not sure why you want to perform an alter table in an anonymous PL/SQL
block.
-- Sybrand Bakker, Senior Oracle DBAReceived on Mon Feb 07 2005 - 09:17:28 CST