Re: [讨论] PL/SQL 是否可以SELECT里再SELECT

楼主: rongkuo (small kuo)   2014-06-16 21:37:18
※ 引述《MerrickJiang ()》之铭言:
: 大家好~
: 小弟最近初学PL/SQL,
: 最近遇到一个问题想请教一下,
: 就是PL/SQL语法里是不是不能在SELECT里在用SELECT?
: 例如以下这样写法:
: SELECT (SELECT FROM A WHERE ...) aa,
: bb
: FROM B
: WERE ...
: 如果不允许这样写法,请问有什么解决方法?
SQL应可在SELECT里在用SELECT,但有限制,他称为 Scalar Subquery。
从 oacle 11g SQL Language Reference文件叙述,Scalar Subquery限制
传回一字段且1个值。 原文如下:
A scalar subquery expression is a subquery that returns exactly
one column value from one row.
The value of the scalar subquery expression is the value of the
select list item of the subquery. If the subquery returns 0 rows,
then the value of the scalar subquery expression is NULL.
If the subquery returns more than one row, then Oracle
returns an error.

Links booklink

Contact Us: admin [ a t ] ucptt.com