Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Is there any way we can exclude all possible values ?
oh,a wonderful method,I have tried the second method,it does work very well. And that is what I want.
Thank you very much!
Best Regards
A sureshot method to work will be
select 'x' from student
where
course_score not in
(select course_score from student)
Another easy way if course_score column is "Not NULL"
select 'x' from student
where course_score is NULL.
Hope this help, although both solution maybe resource heavy.
Thx,
PB Singh
hi,
I am sorry for my poor english and thank you for your warmhearted reply. I mean I want to write a function which returns a predicate(like where clause), and the predicate is based on some column of a table,such as column 'COURSE_SCORE' in table 'STUDENT', and the predicate can excluede all the possible values of the column to be assigned, For example, the value of 'COURSE_SCORE' is perhaps 10,20,30,40.then I want the function returns 'COURSE_SCORE not in (10,20,30,40)',perhaps the predicate is like COURSE_SCORE ='a',here 'a' can be any character, because the value of the number column 'COURSE_SCORE' can not be character,I just want the functon returns a predicate (where clause),when I execute query aginst table 'STUDENT' with this predicate,I will get no data row, in fact, here I want to use VPD to implement some need. for example:here is the table STUDENT: STUDENT_ID STRUDENT_NAME COURSE_SCORE 1 wxy 10 2 feeling 20 3 king 30 4 merry 40
SQL> select * from student;
STUDENT_ID STRUDENT_NAME COURSE_SCORE 1 wxy 10 2 feeling 20 3 king 30 4 merry 40
if with a where clause like the following: SQL> select * from student where course_score no in (10,20,30,40) ;
or
SQL> select * from student where course_score='a';
or
SQL> select * from student where course_score='b'; .....
That is what I want to do, and based on some reason, the where clause must be based on one of the columns in the table.
I do not know if I have made my intent clear...
Best Regards and Happy New Year!
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Jan 02 2007 - 19:44:30 CST
![]() |
![]() |