括号不对 select * from (select * from bbs a where rownum<=10 minus select * from bbs where rownum<=5)
select * from (select *,rownum rn from bbs a where rownum<=10) where rn>5
select r,e.* from (select rownum r,* from ( select * from bbs order by id desc)) e where r between 6 and 10;
9i的minus不支持long字段。 友情赠送以下(自己翻译): LONG columns cannot appear in certain parts of SQL statements: n GROUP BY clauses, ORDER BY clauses, or CONNECT BY clauses or with the DISTINCT operator in SELECT statements n The UNIQUE operator of a SELECT statement n The column list of a CREATE CLUSTER statement n The CLUSTER clause of a CREATE MATERIALIZED VIEW statement n SQL built-in functions, expressions, or conditions n SELECT lists of queries containing GROUP BY clauses n SELECT lists of subqueries or queries combined by the UNION, INTERSECT, or MINUS set operators n SELECT lists of CREATE TABLE ... AS SELECT statements n ALTER TABLE ... MOVE statements n SELECT lists in subqueries in INSERT statements Triggers can use the LONG datatype in the following manner: n A SQL statement within a trigger can insert data into a LONG column. n If data from a LONG column can be converted to a constrained datatype (such as CHAR and VARCHAR2), a LONG column can be referenced in a SQL statement within a trigger. n Variables in triggers cannot be declared using the LONG datatype. n :NEW and :OLD cannot be used with LONG columns.
select * from bbs order by id desc)) e
where r between 6 and 10;
友情赠送以下(自己翻译):
LONG columns cannot appear in certain parts of SQL statements:
n GROUP BY clauses, ORDER BY clauses, or CONNECT BY clauses or with the
DISTINCT operator in SELECT statements
n The UNIQUE operator of a SELECT statement
n The column list of a CREATE CLUSTER statement
n The CLUSTER clause of a CREATE MATERIALIZED VIEW statement
n SQL built-in functions, expressions, or conditions
n SELECT lists of queries containing GROUP BY clauses
n SELECT lists of subqueries or queries combined by the UNION, INTERSECT, or
MINUS set operators
n SELECT lists of CREATE TABLE ... AS SELECT statements
n ALTER TABLE ... MOVE statements
n SELECT lists in subqueries in INSERT statements
Triggers can use the LONG datatype in the following manner:
n A SQL statement within a trigger can insert data into a LONG column.
n If data from a LONG column can be converted to a constrained datatype (such as
CHAR and VARCHAR2), a LONG column can be referenced in a SQL statement
within a trigger.
n Variables in triggers cannot be declared using the LONG datatype.
n :NEW and :OLD cannot be used with LONG columns.