oracle如何創建存儲過程呢?
首先需要授權
sqlplus / as sysdba
grant create view to your_user;
然后創建表和存儲過程
drop table table1;create table TABLE1( user_id VARCHAR2(10), user_name VARCHAR2(10), user_mail VARCHAR2(10), user_mobile VARCHAR2(10), user_telephone VARCHAR2(10));CREATE OR REPLACE PROCEDURE CREATEVIEWS IS V_SQL VARCHAR2(10240);BEGIN V_SQL := 'CREATE OR REPLACE VIEW V_TEST AS SELECT T1.USER_ID, T1.USER_NAME, --用戶姓名 T1.USER_MAIL, --用戶MAIL T1.USER_MOBILE, --用戶手機 T1.USER_TELEPHONE --用戶電話 FROM TABLE1 T1'; EXECUTE IMMEDIATE V_SQL;END CREATEVIEWS;/
執行,OK
SQL> exec createviews;PL/SQL procedure successfully completed