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: Dynamic SQL to disable constraints.

Re: Dynamic SQL to disable constraints.

From: Louis Frolio <froliol_at_yahoo.com>
Date: 17 Sep 2004 14:22:48 -0700
Message-ID: <94c28610.0409171322.64addbd5@posting.google.com>


"Ana C. Dent" <anacedent_at_hotmail.com> wrote in message news:<Xns95674767C7751SunnySD_at_68.6.19.6>...
> froliol_at_yahoo.com (Louis Frolio) wrote in
> news:94c28610.0409170451.5bdec168_at_posting.google.com:
>
> > All, am trying to write dynamic sql to disable constraints on a table.
> > However, it seems that the method I employed is not doing the job:
> >
> >
> > set serveroutput on
> >
> > declare
> > vConName dba_constraints.table_name%TYPE;
> > vString varchar2(1000);
> >
> > cursor cConName is
> > select constraint_name
> > from dba_constraints
> > where table_name = 'JOB_HISTORY' and
> > constraint_type in ('C','PK','R');
> > begin
> > open cConName;
> > loop
> > fetch cConName into vConName;
> > exit when cConName%NOTFOUND;
> > vString := 'alter table ' || 'JOB_HISTORY' || ' disable
> > constraint ' || vConName || ';';
> > --dbms_output.put_line(vString);
> > execute immediate vString using vConName;
> > end loop;
> > close cConName;
> > end;
> >
> > /
> >
> >
> > it is failing on the execute piece. The output properly displays the
> > "alter datbase ..." command though? I think that I may need to employ
> > dbms_sql but I am not sure. Any help would be greatly appreciated.
> >
> > Louis
> >
>
> >"it is failing"
> Too bad you chose not to share with us the actual error message.
>
> >The output properly displays the "alter datbase ..." command though?
>
> What "alter DATABASE" command?

Whoops. That is a type, I meant to type "alter table .."

L Received on Fri Sep 17 2004 - 16:22:48 CDT

Original text of this message

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