Oracle创建存储过程在实际中的应用比例还是占为多数的,如果你对Oracle创建存储过程的简单方法的技术,心存好奇的话,以下的文章将会揭开它的神秘面纱。希望会给你带来一些帮助在此方面。
连接到:
Oracle9iEnterpriseEditionRelease9.2.0.1.0-Production WiththePartitioning,OLAPandOracleDataMiningoptions JServerRelease9.2.0.1.0-Production SQL>createorreplaceprocedureget_news( 2 aidinvarchar2,atitleinvarchar2) 3 as 4 begin 5 select*fromcf_news 6 end; 7 /
警告: 创建的过程带有编译错误。
SQL>createorreplaceprocedureget_news( 2 aidinvarchar2,atitleinvarchar2) 3 as 4 beging 5 /
警告: 创建的过程带有编译错误。
SQL>createorreplaceprocedureget_news( 2 aidinvarchar2) 3 as 4 begin 5 select*fromcf_news; 6 end; 7 /
警告: 创建的过程带有编译错误。
SQL>createorreplaceprocedureget_news 2 as 3 begin 4 select*fromcf_news; 5 end; 6 /
警告:Oracle创建存储过程会带有编译错误。
PROCEDURE GET_NEWS 出现错误:
LINE/COLERROR
4/1 PLS-00428: 在此 SELECT 语句中缺少 INTO 子句
SQL>createorreplaceprocedureget_news 2 as 3 aanumber; 4 begin 5 selectcount(*)intoaafromcf_news; 6 end; 7 /
过程已创建。
SQL>createorreplaceprocedureget_news 2 as 3 aanumber; 4 begin 5 selectcount(*)intoaafromcf_news; 6 dbms_outpub.put_line('aa='||aa); 7 end; 8 /
警告: 创建的过程带有编译错误。
SQL>showerrors;
PROCEDURE GET_NEWS 出现错误:
LINE/COLERROR
6/1 PLS-00201: 必须说明标识符 ‘DBMS_OUTPUB.PUT_LINE’
6/1 PL/SQL:Statementignored SQL>createorreplaceprocedureget_news 2 as 3 aanumber; 4 begin 5 selectcount(*)intoaafromcf_news; 6 dbms_output.put_line('aa='||aa); 7 end; 8 /
过程已创建
SQL>setserverouton; SQL>executeget_news; aa=3
PL/SQL 过程已成功完成。
相关文章
标签:Oracle