ora-00955

How to rename a primary key in Oracle such that it can be reused

僤鯓⒐⒋嵵緔 提交于 2019-12-18 05:42:10
问题 On Oracle, I create a table like this: CREATE TABLE "Mig1"( "Id" INTEGER NOT NULL , CONSTRAINT "PK_Mig1" PRIMARY KEY ( "Id" ) ) Then, I rename the PK: ALTER TABLE "Mig1" RENAME CONSTRAINT "PK_Mig1" TO "PK_XXX" Then, I rename the table: ALTER TABLE "Mig1" RENAME TO "XXX" Then, I try to create another table that uses the name of the previously renamed table: CREATE TABLE "Mig1"( "Id" INTEGER NOT NULL , CONSTRAINT "PK_Mig1" PRIMARY KEY ( "Id" ) ) At this point I get: An error occurred: ORA-00955

why is 'create table' in sql script executing 3 times when only using 1 create statement? [duplicate]

本小妞迷上赌 提交于 2019-12-14 04:13:12
问题 This question already has answers here : When do I need to use a semicolon vs a slash in Oracle SQL? (6 answers) Closed 2 years ago . 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

ORACLE: can we create global temp tables or any tables in stored proc?

匆匆过客 提交于 2019-12-11 21:16:46
问题 below is the stored proc I wrote: create or replace procedure test005 as begin CREATE GLOBAL TEMPORARY TABLE TEMP_TRAN ( COL1 NUMBER(9), COL2 VARCHAR2(30), COL3 DATE ) ON COMMIT PRESERVE ROWS / INSERT INTO TEMP_TRAN VALUES(1,'D',sysdate); INSERT INTO TEMP_TRAN VALUES(2,'I',sysdate); INSERT INTO TEMP_TRAN VALUES(3,'s',sysdate); COMMIT; end; when i executed it , i get an error message mentioning: create or replace procedure test005 as begin CREATE GLOBAL TEMPORARY TABLE TEMP_TRAN ( COL1 NUMBER

BEGIN/END and CREATE Table in single .sql file

感情迁移 提交于 2019-12-11 10:59:29
问题 I have a small SQL script that I'm executing with Oracle's SQL*Plus to emulate create or replace on tables: BEGIN EXECUTE IMMEDIATE 'DROP TABLE symbols'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN END IF; END; / CREATE TABLE symbols ( blah blah, blah blah, ); EXIT; SQL*Plus commandline is: sqlplus aegsys15_owner/pass#234@MARVINUAT03 @createSymbolsTable.sql << EOF > EOF If I omit the forward slash (/) after END, it seems to only process the first BEGIN/END block, and ignores the CREATE

How to rename a primary key in Oracle such that it can be reused

自闭症网瘾萝莉.ら 提交于 2019-11-29 09:21:57
On Oracle, I create a table like this: CREATE TABLE "Mig1"( "Id" INTEGER NOT NULL , CONSTRAINT "PK_Mig1" PRIMARY KEY ( "Id" ) ) Then, I rename the PK: ALTER TABLE "Mig1" RENAME CONSTRAINT "PK_Mig1" TO "PK_XXX" Then, I rename the table: ALTER TABLE "Mig1" RENAME TO "XXX" Then, I try to create another table that uses the name of the previously renamed table: CREATE TABLE "Mig1"( "Id" INTEGER NOT NULL , CONSTRAINT "PK_Mig1" PRIMARY KEY ( "Id" ) ) At this point I get: An error occurred: ORA-00955: name is already used by an existing object . And this is because somehow the primary key of the first