电脑软硬件应用网
当前位置: 电脑软硬件应用网 > 设计学院 > 网络编程 > 数据库 > 正文
简单的Oracle存储过程的创建方法
简单的Oracle存储过程的创建方法
2007-9-15 10:10:08  文/网络   出处:电脑软硬件应用网   
  连接到:
  Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
  With the Partitioning, OLAP and Oracle Data Mining options
  JServer Release 9.2.0.1.0 - Production
  
  SQL> create or replace procedure get_news(
  2 aid in varchar2,atitle in varchar2)
  3 as
  4 begin
  5 select * from cf_news
  6 end;
  7 /
  
  警告: 创建的过程带有编译错误。
  
  SQL> create or replace procedure get_news(
  2 aid in varchar2 ,atitle in varchar2)
  3 as
  4 beging
  5 /
  
  警告: 创建的过程带有编译错误。
  
  SQL> create or replace procedure get_news(
  2 aid in varchar2)
  3 as
  4 begin
  5 select * from cf_news;
  6 end;
  7 /
  
  警告: 创建的过程带有编译错误。
  
  SQL> create or replace procedure get_news
feedom.net国内最早的网管网站

  2 as
  3 begin
  4 select * from cf_news;
  5 end;
  6 /
  
  警告: 创建的过程带有编译错误。
  
  SQL> show errors;
  PROCEDURE GET_NEWS 出现错误:
  
  LINE/COL ERROR
  -------- -------------------------------------
  4/1   PLS-00428: 在此 SELECT 语句中缺少 INTO 子句
  SQL> create or replace procedure get_news
  2 as
  3 aa number;
  4 begin
  5 select count(*) into aa from cf_news;
  6 end;
  7 /
  
  过程已创建。
  
  SQL> create or replace procedure get_news
  2 as
  3 aa number;
  4 begin
  5 select count(*) into aa from cf_news;
  6 dbms_outpub.put_line('aa='||aa);
  7 end;
  8 /
  
  警告: 创建的过程带有编译错误。
  
  SQL> show errors;

www.bitsCN.net网管博客等你来搏


  PROCEDURE GET_NEWS 出现错误:
  
  LINE/COL ERROR
  -------- -----------------------------------------
  6/1   PLS-00201: 必须说明标识符 'DBMS_OUTPUB.PUT_LINE'
  6/1   PL/SQL: Statement ignored
  SQL> create or replace procedure get_news
  2 as
  3 aa number;
  4 begin
  5 select count(*) into aa from cf_news;
  6 dbms_output.put_line('aa='||aa);
  7 end;
  8 /
  
  过程已创建。
  
  SQL> set serverout on;
  SQL> execute get_news;
  aa=3
  
  PL/SQL 过程已成功完成。
  • 上一篇文章:

  • 下一篇文章:
  • 最新热点 最新推荐 相关文章
    MySQL转换Oracle的七大注意事项
    如何把文本数据导入Oracle中
    oracle中如何取消密码管理停止密码验…
    Mysql数据库名和表名在不同系统下的…
    mysql全文搜索:sql的写法
    了解Oracle启动模式的三个阶段
    Oracle同义词的定义给数据库管理的好…
    解答SQL不许在视图定义ORDER BY子句…
    ORACLE普遍错误代码地说明与处理
    数据库海量数据查询与优化
    关于45IT | About 45IT | 联系方式 | 版权声明 | 网站导航 |

    Copyright © 2003-2011 45IT. All Rights Reserved 浙ICP备09049068号