joiner
joiner

Reputation: 47

Create table sql in Oracle which prompts for table name

I want to create table so that when the query runs, it asks for the table name. I am sure this is a duplicate post but would like to know if this is possible with Oracle?

Upvotes: 0

Views: 992

Answers (1)

Justin Cave
Justin Cave

Reputation: 231661

If you are using SQL*Plus, you can use substitution variables (&variable_name)

SQL> create table &name (
  2    col1 number,
  3    col2 date
  4  );
Enter value for name: fuzzy_bunny
old   1: create table &name (
new   1: create table fuzzy_bunny (

Table created.

SQL> select * from fuzzy_bunny;

no rows selected

Upvotes: 6

Related Questions