Question

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?

Was it helpful?

Solution

How about:

EXECUTE IMMEDIATE 
'ALTER TABLE'||' ""'||l_table_name||'"" '||'ENABLE CONSTRAINT'||' 
"'||l_Constraint_name||'"';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top