Ask a Question related to Oracle Server, Design and Development.
-
Albert Zweistein #1
Wanted:PL/SQL to Disable & Enable Constraints
I need one or two PL/SQL's that will let me
- Disable ALL Constraints for one or more tables
and at a later time
- Enable ALL Constraints for one or more tables
Please post any answers to the Newstgroup.
Thanks - Albert !
Albert Zweistein Guest
-
Enable Disable fields onclick
I have a cfinput field that is disabled when the form first loads (disabled="true") I want to click a button to enable the field. ... -
disable/enable
I have a form to included these file 1. Radio buttons. button1, button2 2. Some text boxes: fname, lname, address, phone, etc. 3. Some submit... -
Validators Enable & Disable Issue
Hi Guys , I have used few validators on few fields in my form, i have a reset button which reset the current contents of those fields. When i do... -
enable/disable
How can do disable and enable for radio box? it worked for all my text box but not for radio box ======= <script language="JavaScript"> function... -
NEED HELP W/ ENABLE/DISABLE CHECKBOXES AND TEXTBOXES
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another... -
Karsten Farrell #2
Re: Wanted:PL/SQL to Disable & Enable Constraints
Hi Albert Zweistein, thanks for writing this:
I use the following when bulk loading data. Of course, I have to be> I need one or two PL/SQL's that will let me
>
> - Disable ALL Constraints for one or more tables
>
> and at a later time
>
> - Enable ALL Constraints for one or more tables
>
>
> Please post any answers to the Newstgroup.
>
>
> Thanks - Albert !
>
ready to fix any constraint violations when constraints are re-enabled.
-- ================================================== ==================
-- Abstract of: prep_bulk_load.sql
-- When bulk loading tables, we don't want to worry about being
-- blocked from loading tables in any order we choose by referential
-- integrity rules. This script is handy in this and other similar
-- situations.
--
-- Generate a script (disable.sql) that will disable all enabled
-- constraints and triggers for the current schema owner. At the
-- same time, generate a script (enable.sql) that will enable all
-- constraints and triggers disabled by disable.sql.
--
-- In summary, your steps should be as follows:
--
-- 1. Connect to sqlplus as the desired schema owner
-- 2. Run this script to generate disable.sql and enable.sql
-- 3. Run disable.sql to disable constraints and triggers
-- 4. Do whatever tasks are required
-- 5. run enable.sql to enable constraints and triggers
-- ================================================== ==================
set pagesize 0 echo off feedback off trimspool on
spool disable.sql
select 'ALTER TABLE ' || lower(table_name) || chr(10) ||
'DISABLE CONSTRAINT ' || lower(constraint_name) || ';'
from user_constraints
where constraint_type = 'R'
and status = 'ENABLED'
/
select 'ALTER TRIGGER ' || lower(trigger_name) || ' DISABLE;'
from user_triggers
where status = 'ENABLED'
/
spool off
spool enable.sql
select 'SPOOL enable.log' from dual;
select 'ALTER TABLE ' || lower(table_name) || chr(10) ||
'ENABLE CONSTRAINT ' || lower(constraint_name) || ';'
from user_constraints
where constraint_type = 'R'
and status = 'ENABLED'
/
select 'ALTER TRIGGER ' || lower(trigger_name) || ' ENABLE;'
from user_triggers
where status = 'ENABLED'
/
select 'SPOOL off' from dual;
spool off
set pagesize 24 echo on feedback on
--
[:%s/Karsten Farrell/Oracle DBA/g]
Karsten Farrell Guest
-
Burton Peltier #3
Re: Wanted:PL/SQL to Disable & Enable Constraints
Set up the contraint(s) as "deferrable" and with a simple "alter session"
command you can defer constraint checking until commit time for all tables .
--
"Albert Zweistein" <azwei@web.de> wrote in message
news:Xns93C0B854DF3A1azweiwebde@62.243.74.162...> I need one or two PL/SQL's that will let me
>
> - Disable ALL Constraints for one or more tables
>
> and at a later time
>
> - Enable ALL Constraints for one or more tables
>
>
> Please post any answers to the Newstgroup.
>
>
> Thanks - Albert !
Burton Peltier Guest
-
grjohnson #4
Re: Wanted:PL/SQL to Disable & Enable Constraints
BEGIN
DECLARE
FROM r_disable IN
(SELECT table_name, constaint_name
FROM user_constraints
WHERE constraint_type = 'R'
AND status = 'ENABLED') LOOP
execute immediate 'ALTER TABLE ' || r_disable.table_name 'DISABLE
CONSTRAINT ' || r_disable.constraint_name;
END LOOP;
END;
Cheers
Greg Johnson
> --
> "Albert Zweistein" <azwei@web.de> wrote in message
> news:Xns93C0B854DF3A1azweiwebde@62.243.74.162...> > I need one or two PL/SQL's that will let me
> >
> > - Disable ALL Constraints for one or more tables
> >
> > and at a later time
> >
> > - Enable ALL Constraints for one or more tables
> >
> >
> > Please post any answers to the Newstgroup.
> >
> >
> > Thanks - Albert !grjohnson Guest



Reply With Quote

