如果Oracle中存在表,如何使用dbLink删除表?我在这里试图连接到远程数据库使用DBLink在oracle.我使用oracle sql开发.DROP TABLE TableName@dbLinkName
.这给我错误未知的命令.
begin declare
v_mytableobject_id
NUMBER(10);
SELECT
object_id INTO v_mytableobject_id FROM user_objects@dblink
WHERE
object_name = 'MYTABLE';
IF v_mytableobject_id IS NOT NULL THEN
dbms_utility.exec_ddl_statement@dblink ( 'drop table MYTABLE' );
ELSE
dbms_utility.exec_ddl_statement@dblink ( 'CREATE TABLE MYTABLE
(ID NUMBER(5,0) GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE NOKEEP NOSCALE ,
CODE NVARCHAR2(15),
DESCRIPTION NVARCHAR2(125)
)'
);
dbms_utility.exec_ddl_statement@dblink ( 'CREATE UNIQUE INDEX MYTABLE_PK ON MYTABLE (ID)
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)'
);
END IF;
end;
1条答案
按热度按时间tzdcorbm1#
你不能就这样把table放下:
不过,有一个解决方案: