oracle Function
5.调用函数FN_ADDONE
--------------------
SQL> SET SERVEROUTPUT ON
SQL> DECLARE CNUM NUMBER;
2 BEGIN
3 CNUM := USER1_ADB.FN_ADDONE(3);
4 DBMS_OUTPUT.PUT_LINE('CNUM = ' || CNUM);
5 END;
6 /
CNUM = 4
PL/SQL 过程已成功完成。
6.删除函数FN_ADDONE
--------------------
SQL> DROP FUNCTION USER1_ADB.FN_ADDONE;
相关文档:
表task,字段id_,name_
id_的数据如下形式:
1
1.1
1.1.1
1.1.1.2
1.2
1.2.1
...
10
10.1
10.1.1
10.2.1
10.2.1.1
10.2.1.1.1
10.2.1.1.2
.......
注:“.”标识父子的关系。
现在通过id_查询树结构的效果,并且知道此节点是否为叶子节点leaf。。?
语句如下:
select
......
不可以用保留字做为表名,字段名的。
如果用单个英语单词或词组来表示表名或字段名。这比较容易和保留字冲突。如何知道Oracle用了哪些保留字呢?
系统表v$reserved_words中存放了所有的保留字。
select * from v$reserved_words;
Oracle有500个保留字,记住所有的保留字有点困难,每次都查找会影响到开发速度,如 ......
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
oracle自带文档写的比较清楚
24
DBMS_CRYPTO
DBMS_CRYPTO
provides an interface to encrypt and
decrypt stored data, and can be used in conjunction with PL/SQL
programs running network communications. It provides suppo ......
select column_name from all_cons_columns cc
where owner='SSH' --SSH为用户名称,要注意大小写
and table_name='SYS_DEPT' --SYS_DEPT为表名,注意大小写
and exists (select 'x' from all_constraints c
where c.owner = cc.owner
and c.constraint_name = cc.constraint_name
and c.constraint_type ='P'
......
基本从来不用left/right join
一个项目被迫要用别人写的 sql
本打算改写一下,提高效率
发现:
【1】
select * from a
left outer join b on a.id= b.id AND ...1...
where ...2...
与
【2】
select * from a , b
where a.id= b.id(+)
A ......