ORACLE 表名为变量create PROCEDURE up_CreateTable(tableName_in IN VARCHAR2)ASDeclare SQL_in VARCHAR2(5000);BEGINSQL_in := 'CREATE TABLE '||tableName_in||' (DM VARCHAR2(20) NOT NULL,MC VARCHAR2(60) NOT NULL,BZSM VARCHAR2(100))tablespace USERS pctf
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 07:39:53
ORACLE 表名为变量create PROCEDURE up_CreateTable(tableName_in IN VARCHAR2)ASDeclare SQL_in VARCHAR2(5000);BEGINSQL_in := 'CREATE TABLE '||tableName_in||' (DM VARCHAR2(20) NOT NULL,MC VARCHAR2(60) NOT NULL,BZSM VARCHAR2(100))tablespace USERS pctf
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;
哪里不对啊
ORACLE 表名为变量create PROCEDURE up_CreateTable(tableName_in IN VARCHAR2)ASDeclare SQL_in VARCHAR2(5000);BEGINSQL_in := 'CREATE TABLE '||tableName_in||' (DM VARCHAR2(20) NOT NULL,MC VARCHAR2(60) NOT NULL,BZSM VARCHAR2(100))tablespace USERS pctf
基本没错,你把Declare去掉就OK了