惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - liuqun

oracle优化7(如何干预执行计划 - hints) oracle优化6(使用sql_trace/10046事件进行数据库诊断) oracle优化5(用索引提高效率) oracle优化4(sql语句性能诊断,sql执行计划) oracle优化3(访问Table的方式) oracle优化2(选用适合的ORACLE优化器) oracle优化1(数据库、数据表、数据表I/O优化原则) Oracle常用命令14(.net / java代码调用(sql代码、程序包过程)) Oracle常用命令13(数据库的启动、关闭) Oracle常用命令12(导入:imp、导出:exp) Oracle常用命令11(触发器) Oracle常用命令10(程序包) Oracle常用命令8(过程) Oracle常用命令7(游标) Oracle常用命令6(PL/SQL) Oracle常用命令5(同义词、视图、索引) Oracle常用命令4(表分区) Oracle常用命令3(DDL、DML、TCL、DCL、序列) Oracle常用命令2(用户、角色管理)
Oracle常用命令9(函数)
liuqun · 2011-03-29 · via 博客园 - liuqun

函数:

CREATE [OR REPLACE] FUNCTION

  <function name> [(param1,param2)]

RETURN <datatype>  IS|AS

  [local declarations]

BEGIN

  Executable Statements;

  RETURN result;

EXCEPTION

  Exception handlers;

END;

函数的调用

1

作为pl/sql的一部分

begin

        变量 := 函数名(参数列表)

End;

2 作为sql语句的一部分

Select 函数名(参数列表) from dual;

例:根据订单编号 返回 订单总金额(根据订单明细中的商品价格、数量)

create or replace function getOrderMoney(v_id number)

return number

is

       totalmoney number(7);

begin

       select sum( D_QUANTITY * D_PRICE ) into totalmoney from orderDetail where O_ID = v_id;

       return totalmoney;

end;

--测试函数:根据订单编号 返回 订单总金额

select getOrderMoney(1) from dual;