Search
 
SCRIPT & CODE EXAMPLE
 

SQL

delete rows table oracle

DELETE FROM my_table;		-- all rows, commit needed
TRUNCATE TABLE my_table;	-- all rows, no possible rollback
DELETE FROM my_table WHERE my_id = 12345;
DELETE FROM my_table WHERE my_id IN (SELECT id2 FROM my_table2);
COMMIT;		-- don't forget it...
Comment

delete all table oracle

BEGIN
   FOR cur_rec IN (SELECT object_name, object_type
                   FROM user_objects
                   WHERE object_type IN
                             ('TABLE',
                              'VIEW',
                              'MATERIALIZED VIEW',
                              'PACKAGE',
                              'PROCEDURE',
                              'FUNCTION',
                              'SEQUENCE',
                              'SYNONYM',
                              'PACKAGE BODY'
                             ))
   LOOP
      BEGIN
         IF cur_rec.object_type = 'TABLE'
         THEN
            EXECUTE IMMEDIATE 'DROP '
                              || cur_rec.object_type
                              || ' "'
                              || cur_rec.object_name
                              || '" CASCADE CONSTRAINTS';
         ELSE
            EXECUTE IMMEDIATE 'DROP '
                              || cur_rec.object_type
                              || ' "'
                              || cur_rec.object_name
                              || '"';
         END IF;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line ('FAILED: DROP '
                                  || cur_rec.object_type
                                  || ' "'
                                  || cur_rec.object_name
                                  || '"'
                                 );
      END;
   END LOOP;
   FOR cur_rec IN (SELECT * 
                   FROM all_synonyms 
                   WHERE table_owner IN (SELECT USER FROM dual))
   LOOP
      BEGIN
         EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM ' || cur_rec.synonym_name;
      END;
   END LOOP;
END;
/
Comment

oracle sql drop table purge

DROP TABLE customers PURGE;
Comment

PREVIOUS NEXT
Code Example
Sql :: postgres make sql dump 
Sql :: table drop if exist sql server 
Sql :: column names in oracle sql 
Sql :: sqlite version check 
Sql :: view linked servers 
Sql :: import .sql into postgres db command 
Sql :: mysql login console 
Sql :: varchar plsql 
Sql :: postgres date difference seconds 
Sql :: oracle new column 
Sql :: mysql all columns 
Sql :: sql alchemy with azuresql server 
Sql :: mysql connection string 
Sql :: postgresql restore from dump 
Sql :: alter table auto_increment 
Sql :: postgres list all roles 
Sql :: get date from timestamp in mysql 
Sql :: mysql last year 
Sql :: MySQL insert into examble 
Sql :: mysql config user password 
Sql :: where not in array sql 
Sql :: change old domain to new domain name wordpress 
Sql :: how to check xampp mysql password 
Sql :: oracle auto_increment 
Sql :: oracle pl sql source 
Sql :: flask sqlalchemy default value 
Sql :: wherein mysql 
Sql :: date diff sql 
Sql :: mysql docker image for macbook m1 
Sql :: mysql limit rows 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =