ORACLE 表名为变量
问题描述:
ORACLE 表名为变量
create PROCEDURE up_CreateTable
(
tableName_in IN VARCHAR2
)
AS
Declare SQL_in VARCHAR2(5000);
BEGIN
SQL_in := 'CREATE TABLE '||tableName_in||'
(
DM VARCHAR2(20) NOT NULL,
MC VARCHAR2(60) NOT NULL,
BZSM VARCHAR2(100)
)tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 1M
minextents 1
maxextents unlimited
)';
EXECUTE IMMEDIATE SQL_in ;
SQL_in :='alter table '||tableName_in||' add constraint PK_'||tableName_in||' Primary key(DM)';
EXECUTE IMMEDIATE SQL_in ;
end up_CreateTable;
哪里不对啊
答
基本没错,你把Declare去掉就OK了