Re: Is there any way we can exclude all possible values ?

  • From: "xiaoyan" <xiaoyezi.xyz@xxxxxxx>
  • To: "Job Miller" <jobmiller@xxxxxxxxx>
  • Date: Sat, 30 Dec 2006 11:13:26 +0800

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
  if not any where clause with the query,I will get all the data rows through 
the following query:
 
  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!

   
 
  ----- Original Message ----- 
  From: Job Miller 
  To: xiaoyezi.xyz@xxxxxxx 
  Sent: Friday, December 29, 2006 11:04 PM
  Subject: Re: Is there any way we can exclude all possible values ?


  your question doesn't make much sense to me.  "we want to return COL=a"  
what's that mean?  

  give a better example and you might get some better help from the list.

  are you talking about check constraints in the db? or are you talking about 
something in some code someone is writing?




  xiaoyan <xiaoyezi.xyz@xxxxxxx> wrote:
    hi all,
       Is there any way we can exclude all possible values to be  assigned to a 
column in a table  without knowing the type of the column ?
       For example,suppose the name of the column is COL,if the type of the 
column is number,perhaps we want to return COL =a, since the type of the column 
is number,so the value to be assigned to it can not be 'a',through this we can 
exclude all the possible value.
       Though this seems to be queer, but in our project, we have this need.
       
       Can anyone tell my how to do?

       Thank you in advance
       Best Regards
       


  __________________________________________________
  Do You Yahoo!?
  Tired of spam? Yahoo! Mail has the best spam protection around 
  http://mail.yahoo.com 

Other related posts: