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
What is a primary key sql?
How do you know if a relationship is 2nf?
What is the usage of sql functions?
How do I count rows in sql?
Can I learn sql in a week?
Name some usages of database trigger?
What is the difference between union and union all command?
How can I see all tables in sql?
What is the difference between sql and t sql?
what is a record in a database ? : Sql dba
Does sql support programming?
What is an index? What are the types of indexes? How many clustered indexes can be created on a table?
what is data integrity? : Sql dba
Can there be 2 primary keys in a table?
what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql