Reputation: 1576
I have the following,
create table ssrr_emp(
Emp_name varchar2(25),
Emp_city varchar2(10),
Emp_id number(2)
);
/
create table ssrr_empsal(
sal_grade char(1),
salary number(7,2),
Commission number(5)
);
/
In the above code,the table names are prefixed with ssrr i.e ssrr_emp and ssrr_empsal,
Here my question is when I am executing the above code
I need to prefix the table name with er i.e er_emp and er_empsal.
I mean during the runtime it should ask the name to enter only for ssrr, and if i enter er then the tables should be created in the name er_emp and er_empsal.
Upvotes: 0
Views: 174
Reputation: 60312
If you're using SQL*Plus, you can use substitution variables with &
, e.g.:
create table &&PREFIX._emp(
Emp_name varchar2(25),
Emp_city varchar2(10),
Emp_id number(2)
);
/
create table &&PREFIX._empsal(
sal_grade char(1),
salary number(7,2),
Commission number(5)
);
/
When you run the script, it will prompt you for the value:
Enter value for prefix:
Upvotes: 1