This question already has an answer here:
I have an SQL script in which I want to automate the creation of a table. However, when I exec it, it seems as though it's trying to create the table 3 times. The first time, it creates the table. The next 2 times, it complains it already exists by throwing an
"ORA-00955: name is already used by an existing object"
Here my sql script(@/vagrant/scripts/db_tables_stubs.sql):
CREATE TABLE IDA_RADIUS_USER(
CHECK_STRING VARCHAR2(30),
REPLY_STRING VARCHAR2(300),
RADIUS_USERNAME VARCHAR2(30),
ACCOUNT_STATUS VARCHAR2(30)
);
/
show errors;
And this is what I get:
SQL> select * from IDA_RADIUS_USER;
no rows selected
SQL> drop table IDA_RADIUS_USER;
Table dropped.
SQL> @/vagrant/scripts/db_tables_stubs.sql
Table created.
CREATE TABLE IDA_RADIUS_USER(
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
No errors.
CREATE TABLE IDA_RADIUS_USER(
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
No errors.
Commit complete.
All I want is to automate the process of creating that table.
Please help me. I can't figure out why that's happening. It's annoying!
You've said you have commented out code. It is those comments that are causing the problem.
The slash (
/
) at the start of the comments is resubmitting the command in the buffer.The SQL*Plus documentation also says:
So if you change your comments to have a space between the
/*
and the commented-out code that won't happen, and those will be ignored: