Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to call DDL statements from pl/sql?

Answer Posted / kavitha nedigunta

set serveroutput on;
DECLARE
CNT NUMBER;
table_name varchar2(300) := 'testnew';
BEGIN
--EXECUTE IMMEDIATE ('grant create table to user_name');
EXECUTE IMMEDIATE ('create table '||table_name||'(name
varchar2(10))');

SELECT COUNT(*) INTO CNT FROM USER_OBJECTS WHERE OBJECT_NAME = upper(''||table_name||'');

IF cnt > 0 THEN
dbms_output.put_line('Table Created');
END IF;

EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Name is already used by an existing object');
END;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of triggers exist in pl/sql?

1009


what are all the different normalizations? : Sql dba

960


What is a clob in sql?

967


Can we use views in stored procedure?

968


When sql appeared?

1023


How do I run pl sql in sql developer?

1059


Can a table have no primary key?

1009


How subquery works in sql?

994


how would you enter characters as hex numbers? : Sql dba

935


What is sql procedures and functions?

955


What is the default isolation level in sql server? : Transact sql

962


Which software is used for pl sql programming?

929


what happens if null values are involved in expressions? : Sql dba

1000


How do you update a value in sql?

985


Explain what is a column in a table?

1041