Sign Up

Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Sorry, you do not have permission to add post.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Oraask Logo Oraask Logo
Sign InSign Up

Oraask

  • Write
    • Add A New Post
    • Ask A Question

Oraask Navigation

Search
Ask A Question

Mobile menu

Close
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Dev Tools
    • Online Compiler
    • Base64 Converter
  • Wiki
    • SQL Tutorials
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
Home/ Questions/Q 4971
Next

Oraask Latest Questions

Question
matheo
  • 0
  • 0
matheoExplorer
Asked: April 11, 20172017-04-11T21:27:17+03:00 2017-04-11T21:27:17+03:00In: PL/SQL

How to drop all partitions from all tables belonging to this schema based on date

  • 0
  • 0

How to drop all partitions from all tables belonging to this schema based on date

Hi,

I have a script to delete the partition from a table which meet certain criteria and this the block of code to do this :
DECLARE
v_sql varchar2(500);
v_date DATE;
v_partition_name user_tab_partitions.partition_name%TYPE;
v_high_value user_tab_partitions.high_value%TYPE;
CURSOR c1 IS SELECT PARTITION_NAME, HIGH_VALUE
FROM user_tab_partitions WHERE TABLE_NAME=’TEST_YFS_BAT_LOC_H’ AND PARTITION_NAME!=’P0′;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO v_partition_name, v_high_value;
EXIT WHEN c1%NOTFOUND;
v_date := to_date(SUBSTR(v_high_value,11,19),’YYYY-MM-DD HH24:MI:SS’);
IF v_date < (sysdate – 30) THEN
v_sql := ‘alter table TEST_YFS_BAT_LOC_H drop partition ‘ || v_partition_name;
EXECUTE immediate v_sql;
END IF;
END LOOP;
CLOSE c1;
END;
/

Now I want to drop all partitions from all tables belonging to this schema. So how can I do something similar action but for all ?

Thanks in advance.

droppartitionspl/sqlschematable
0
  • 0 0 Answers
  • 581 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    Related Questions

    • Export query result to Oracle Server
    • What is the difference between Implicit and Explicit Cursor in Oracle
    • How many triggers can I create on a single table in Oracle Database
    • How many types of collections are there in Oracle
    • Can we extend Varray in Oracle PL/SQL

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Adv 250x250

    Explore

    • Categories
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Dev Tools
      • Online Compiler
      • Base64 Converter
    • Wiki
      • SQL Tutorials
      • Java Tutorials
      • Python Tutorials
      • JavaScript Tutorials

    Footer

    Oraask

    About

    Oraask is a website for developers and software engineers who want to learn new skills, share their knowledge, and solve their coding problems. Oraask provides free content on various programming languages and topics, such as Oracle, Python, Java, etc. Oraask also allows users to ask questions and get answers from other members of the community.

    About Us

    • About Us
    • Contact Us

    Legal Stuff

    • Privacy Policy
    • Terms & Conditions

    Follow

    Oraask is licensed under CC BY-NC-SA 4.0Oraask CopyrightOraask CopyrightOraask CopyrightOraask Copyright

    © 2019 Oraask. All Rights Reserved
    With Love by Oraask.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.