本教程操作环境:Windows10系统、Oracle 11g版、Dell G3电脑。
怎样执行oracle存储过程
示例:有如下创建索引的存储过程
--procedure create_index create or replace procedure create_indexindexName in varchar2, tableName in varchar2, columnName in varchar2) i tmp_name VARCHAR250); TMP_SQL VARCHAR21024); cnt NUMBER; begin select table_name into tmp_name from user_tables where uppertable_name)=uppertableName); if lengthtmp_name)>0 then SELECT COUNT*) INTO cnt FROM USER_INDEXES T WHERE T.TABLE_NAME=''|| tableName ||'' AND T.INDEX_NAME=''|| indexName; IF cnt = 0 THEN execute immediate 'create index ' || indexName ||' on ' || tableName ||''|| columnName ||') TABLESPACE TBS_TXNIDX'; END IF; end if; EXCEPTION WHEN NO_DATA_FOUND THEN BEGIN NULL; END; end;
1)在命令窗口下: exec 存储过程参数…);
exec create_index'IDX_ORG_SET_PROCESS_1','CPS_ORG_SETTLEMENT_PROCESS','ORG_IDENTITY_ID ASC');
2)在sql窗口下:
begin create_index'IDX_STATEMENT_DETAIL_LINK','CPS_BANK_STATEMENT_DETAIL','LINK_TXN_ID ASC'); end;
推荐教程:《Oracle视频教程》
以上就是怎样执行oracle存储过程的详细内容,更多请关注风君子博客其它相关文章!