ORACLE 数据库存储过程创建:
一、利用存储过程进行表格创建:
报异常,ero:没有权限
解决办法:在存储过程名称后加Authid Current_User
eg:
CREATE OR REPLACE PROCEDURE CREATETABLE Authid Current_User
AS
v_sql varchar2(4000);
BEGIN
v_sql:=‘CREATE TABLE TEST3 AS SELECT TEST_NO,MONTH2,MONTH3,MONTH4,MONTH5,MONTH6 FROM TEST2‘;
execute immediate v_sql;
END;
二、修改表名:
CREATE OR REPLACE PROCEDURE UP_YB_NAME
AS
v_sql varchar2(4000);
BEGIN
v_sql:=‘ALTER TABLE TEST2 RENAME TO TEST2_BACK‘;
execute immediate v_sql;
END;
三、修改表字段名称:
CREATE
OR REPLACE PROCEDURE CHANGECOLUMN2 AS
v_sql VARCHAR2 ( 4000 );
BEGIN
v_sql := ‘ALTER TABLE TEST2 RENAME COLUMN MONTH3 TO MONTH2‘;
execute IMMEDIATE v_sql;
END;