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

推荐订阅源

Recorded Future
Recorded Future
Security Archives - TechRepublic
Security Archives - TechRepublic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
I
InfoQ
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
腾讯CDC
GbyAI
GbyAI
V
Visual Studio Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
博客园 - 聂微东
美团技术团队
The Register - Security
The Register - Security
Engineering at Meta
Engineering at Meta
Apple Machine Learning Research
Apple Machine Learning Research
雷峰网
雷峰网
S
Schneier on Security
量子位
A
About on SuperTechFans
H
Help Net Security
MongoDB | Blog
MongoDB | Blog
S
SegmentFault 最新的问题
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
PCI Perspectives
PCI Perspectives
B
Blog
K
Kaspersky official blog
V
Vulnerabilities – Threatpost
aimingoo的专栏
aimingoo的专栏
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
G
Google Developers Blog
L
LINUX DO - 最新话题
Forbes - Security
Forbes - Security
AWS News Blog
AWS News Blog
P
Palo Alto Networks Blog
Security Latest
Security Latest
爱范儿
爱范儿
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
L
LINUX DO - 热门话题
D
Docker
P
Proofpoint News Feed
Y
Y Combinator Blog
P
Proofpoint News Feed

博客园 - 系咪噶

[JAVA基础]流文件读写文件编码转换 最近转战东软 apache 新建虚拟机 +Zend Framework建立 Apache + php 配置 php基础教程之PHP面向对象技术(全面讲解) 今日无事,将一同志之毕设完结 SQL查询基本练习1:(作业) SQL Server 高级应用(周六讲座) 面向对象之CoreJava(第一课) CVS的使用(一课时) PL/SQL第三课(学习笔记) PL/SQL第二课(学习笔记) PL/SQL第一课(学习笔记) Oracle第五课(学习笔记) Oracle第四课(学习笔记) 全步骤安装mysql SQL Server 存储过程的分页 无法连接到Visual Studio 的Localhost Web服务器 Oracle第三课(学习中笔记)
PL/SQL第二课(作业)
系咪噶 · 2008-08-15 · via 博客园 - 系咪噶

作业讲解

1.1、查询语句
SELECT b.first_name
FROM s_emp a,s_emp b
WHERE a.manager_id = b.id--manager_id作为外键,与 b 表里的id 连接
AND a.id = 5;
1.2、存储过程
CREATE OR REPLACE PROCKDURE proc_GetManager(
    p_id IN s_emp.id%TYPE,
    p_name OUT s_emp.first_name%TYPE
)
BEGIN
/*
    SELECT first_name
    FROM s_emp
    WHERE manager_id = NULL;*/
    SELECT b.first_name
        INTO p_name
    FROM  s_emp a, s_emp b
    WHERE a.manager_id = b.id
        AND a.id = p_id;
END
1.3、调用传递
DECLARE
     v_first_name s_emp.first_name%TYPE;
BEGIN
    proc_GetManager(3,v_fisrt_name);
    DBMS_OUTPUT.PUT_LINE('v_fisrt_name = '||v_first_name)
END

2.1、

SELECT a.id, a.first_name, a.salary
    FROM s_emp a, s_dept b
WHERE a.dept_id = b.id
    AND b.region_id = 2;

2.2、
CREATE OR REPLACE FUNCTION fun_getDept(
    p_rid s_region.id%TYPE
    RETURN s_dept.name%TYPE)
AS
    v_dept s_dept.name%TYPE
 CURSOR cur_emp IS
    SELECT name
    from s_emp a, s_dept b
    where a. dept_id = b.id
     and b.region_id = p_ id
    ORDERby salary DESC;
BEGIN
    OPEN cur_emp;
    FETCH cur_emp INTO fun_getDept();
    CLOSE cur_emp;
END

2.3
DECLARE
    v_dept s_dept.name%TYPE;
begin
    v_dept := fun_getDept(2);
    DBMS_OUTPUT.PUT_LINE(v_dept);
end