这是可以的,不过用view 就行不通了,可以用function 来实现。 大概是这样的: 先建一个function,但这个function反回值的类型是一个table.具体怎么建这个function 自己去查查语法去吧。 然后select your_function( val ) from dual 就可以了。 function可以返回一个table类型是9i新增的功能 。
Creating a View with Constraints: Example The following statement creates a restricted view of the sample table hr.employees and defines a unique constraint on the email view column and a primary key constraint for the view on the emp_id view column:CREATE VIEW emp_sal (emp_id, last_name, email UNIQUE RELY DISABLE NOVALIDATE, CONSTRAINT id_pk PRIMARY KEY (emp_id) RELY DISABLE NOVALIDATE) AS SELECT employee_id, last_name, email FROM employees;
SELECT * FROM A WHERE DATE=‘pp’就想把这个 pp 当作参数传过去。
先查整个视图,再筛选,速度无法接受
大概是这样的:
先建一个function,但这个function反回值的类型是一个table.具体怎么建这个function
自己去查查语法去吧。
然后select your_function( val ) from dual 就可以了。 function可以返回一个table类型是9i新增的功能 。
The following statement creates a restricted view of the sample table hr.employees and defines a unique constraint on the email view column and a primary key constraint for the view on the emp_id view column:CREATE VIEW emp_sal (emp_id, last_name,
email UNIQUE RELY DISABLE NOVALIDATE,
CONSTRAINT id_pk PRIMARY KEY (emp_id) RELY DISABLE NOVALIDATE)
AS SELECT employee_id, last_name, email FROM employees;