Oracle 批量导入Sequence
select 'create sequence '||sequence_name||
' minvalue '||min_value||
' maxvalue '||max_value||
' start with '||last_number||
' increment by '||increment_by||
(case when cache_size=0 then ' nocache' else ' cache '||cache_size end) ||';' //这个是实时的Sequence
from user_sequences
select d.text,d.name from user_source d where type ='PROCEDURE' ; //查询所有存储过程
SELECT DBMS_METADATA.GET_DDL(U.OBJECT_TYPE, u.object_name)
from USER_OBJECTS u
where U.OBJECT_TYPE IN ('TABLE','INDEX','PROCEDURE','sequence');//得到一个用户下的所有表,索引,存储过程,sequence .......的ddl
相关文档:
今天XXX说要把Oracle 里的几张表重新整理下,呵呵 结果阿发现10来张表还真是说多不多说少一点都不少 。因为表里面的commet已经填上了 。偷懒的想法顿时出现嘎嘎
select t.COLUMN_NAME 字段名, t.DATA_TYPE||'('||t.DATA_LENGTH||')' 字段类型,t.NULLABLE 是否为空,t.DATA_DEFAULT 默认值,p.comments 字段说明
fro ......
As you may know, Oracle dropped support for Borland Compilers in OCI
some time back. Well, it isn't all that hard to set up again.
I'm running 9i Release 2 Enterprise Edition on this PC at work and I am
using Borland C++ Builder 6 to 'play' with OCI programming - I intend to
build a set of compo ......
select t.*, t.rowid from indicators t start with (t.isleaf='1' and t.rid='26020')
connect by prior t.pid = t.id order by t.inum
从叶子节点依据id=pid的关系向上递归到跟节点。
select t.*, t.rowid from indicators t start with (t.pid='0' and t.rid='26020')
connect by prior t.id = t.pid order by t.i ......
一直听到的都是说尽量用exists不要用in,因为exists只判断存在而in需要对比值,所以exists比较快,但看了看网上的一些东西才发现根本不是这么回事。
下面这段是抄的
Select * from T1 where x in ( select y from T2 )
执行的过程相当于:
select *
......
在某些场合下,存储过程或触发器里的SQL语句需要动态生成。Oracle的DBMS_SQL包可以用来执行动态SQL语句。本文通过一个简单的例子来展示如何利用DBMS_SQL包执行动态SQL语句:
DECLARE
v_cursor NUMBER;
v_stat NUMBER;
& ......