SRIDHAR KODURU
asked on
Dropping table using stored procedure
I had this question after viewing Passing table name as parameter to a PL/SQL Stored procedure?.
How can we drop a table if table name start with UD_% but not any table passed as a parameter
How can we drop a table if table name start with UD_% but not any table passed as a parameter
It looks to me like slightwv gave you a suggestion for this part of your question: "How can we drop a table if table name start with UD_%?".
But, how do you want this second part of your question: "but not any table passed as a parameter" to be included? Do you want to be able to pass in a single table_name that starts with 'UD_' that should be excluded? Or do you want to be able to pass in a comma-separated list of tables that start with 'UD_' that should be excluded?
Then, even though this action (dropping multiple tables with a PL\SQL procedure) is possible in Oracle, are you sure that is a good idea, or the best and safest way to solve a particular business problem? I don't usually recommend doing DDL commands (create, drop alter, etc.) in PL\SQL procedures. Can you tell us a bit more about the business problem that this may help with?
But, how do you want this second part of your question: "but not any table passed as a parameter" to be included? Do you want to be able to pass in a single table_name that starts with 'UD_' that should be excluded? Or do you want to be able to pass in a comma-separated list of tables that start with 'UD_' that should be excluded?
Then, even though this action (dropping multiple tables with a PL\SQL procedure) is possible in Oracle, are you sure that is a good idea, or the best and safest way to solve a particular business problem? I don't usually recommend doing DDL commands (create, drop alter, etc.) in PL\SQL procedures. Can you tell us a bit more about the business problem that this may help with?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Something like this:
Open in new window