当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Result Sets from Stored Proced
 

 

 ·oracle数据库的空间管理技巧    »显示摘要«
    摘要: 在oracle数据库中,dba可以通过观测一定的表或视图来了解当前空间的使用状况,进而作出可能的调整决定。 ---- 一.表空间的自由空间 ---- 通过对表空间的自由空间的观察,可用来判断分配给某个表空间的空间是太多还是不够。请看下列的语句 sql > select a.file_id "fileno",a.tablespace_name "tablespace_name",......
 ·oracle数据库复制常用脚本    »显示摘要«
    摘要:oracle 数据库复制常用脚本(石骁騑 2001年07月30日 17:30) oracle的数据复制是一个oracle数据库产品中比较成熟的一项技术,它是整个分布式计算解决方案的一个重要组成部分。对于具有复制环境的数据库系统,和oracle dba一样,同样要有一个人来专门负责维护oracle的数据复制问题,称之为oracle replication administrator(oracle复......


ResultSetsfromStoredProceduresInOracle

a frequently asked question is: 【程序编程相关:install mysql-standa

result sets from stored procedures in oracle 【推荐阅读:如何取消jakarta-tomcat-5

【扩展信息:转:动态网页的搜索引擎优化

id like to know whether oracle supports procedures (functions) which

returns result sets.

the answer is most definitely yes.  in short, itll look like this:

 

create or replace function sp_listemp return types.cursortype

as

    l_cursor    types.cursortype;

begin

    open l_cursor for select ename, empno from emp order by ename;

    return l_cursor;

end;

/

with 7.2 on up of the database you have cursor variables.  cursor variables are cursors opened by a pl/sql routine and fetched from by another application or pl/sql routine (in 7.3 pl/sql routines can fetch from cursor variables as well as open them). the cursor variables are opened with the privelegs of the owner of the procedure and behave just like they were completely contained within the pl/sql routine. it uses the inputs to decide what database it will run a query on.

here is an example:

 

create or replace package types

as

    type cursortype is ref cursor;

end;

/ create or replace function sp_listemp return types.cursortype

as

    l_cursor    types.cursortype;

begin

    open l_cursor for select ename, empno from emp order by ename;     return l_cursor;

end;

/

examples for sqlplus, pro*c, java/jdbc, odbc, ado/asp, dbi perl and oci follow:

rem sql*plus commands to use a cursor variable variable c refcursor

exec :c := sp_listemp

print c

and the pro*c to use this would look like:

static void process()

{

exec sql begin declare section;

    sql_cursor  my_cursor;

    varchar     ename[40];

    int         empno;

exec sql end declare section;     exec sql whenever sqlerror do sqlerror_hard();     exec sql allocate :my_cursor;     exec sql execute begin

        :my_cursor := sp_listemp;


...   下一页
 ·更改oracle数据库表的表空间    »显示摘要«
    摘要:更改oracle数据库表的表空间(石骁騑 2001年07月20日 17:56) 在oracle数据库管理系统中,创建库表(table)时要分配一个表空间(tablespace),如果未指定表空间,则使用系统用户确省的表空间。 在oracle实际应用中,我们可能会遇到这样的问题。处于性能或者其他方面的考虑,需要改变某个表或者是某个用户的所有表的表空间。通常的做法就是首先将表删除,然后重新建表,在......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE