views:

149

answers:

1

I ran a data copy function in Toad that disabled all constraints and then failed.

That left me with a bunch of disabled constraints. Most of them I've been able to enable successfully, but the flashback ones are giving my stored proc fits.

Questions:

1) Is it necessary to reenable the constraints on the flashback tables? My assumption is that if they're not enabled and flashback is used, they'd be disabled when the table is restored, so yes, they should be re-enabled.

2) The error I get is ORA-01735: Invalid alter table option.

EXECUTE IMMEDIATE
'ALTER TABLE'||' '||l_table_name||' '||'ENABLE CONSTRAINT'||'
'||l_Constraint_name;

My assumption is that the ==$0 in the table name is causing problems, and I need to enclose it in double quotes. However, my attempts at doing so:

EXECUTE IMMEDIATE
'ALTER TABLE'||' ""'||l_table_name||'"" '||'ENABLE CONSTRAINT'||'
'||l_Constraint_name;

also failed. What's the proper syntax? Or am I barking up the wrong tree on what the error actually is?

+2  A: 

How about:

EXECUTE IMMEDIATE 
'ALTER TABLE'||' ""'||l_table_name||'"" '||'ENABLE CONSTRAINT'||' 
"'||l_Constraint_name||'"';
Jeffrey Kemp
+1, exactly my first thought too.
ammoQ
Correct answer turned out to be:EXECUTE IMMEDIATE 'ALTER TABLE'||' "'||l_table_name||'" '||'ENABLE CONSTRAINT'||' "'||l_Constraint_name||'"';
Wade Williams
Ha - I didn't notice you had the double-double-quotes around the table name... sorry :)
Jeffrey Kemp