Re: NEED ORACLE SQL FORMS HELP!!!

From: John Morgan <John_Morgan_at_OIT.PeachNet.EDU>
Date: 28 Jul 1994 15:45:25 GMT
Message-ID: <318jql$a50_at_news-feed-1.PeachNet.EDU>


In article <318ick$69l_at_news.bu.edu> Struktur, crofoot_at_cs.bu.edu writes:
>Hi, I am trying to test to see if a value from a field in sql forms3.0 is
>in a table and if so then do some statements. I have set up an if
>statement to do it, but it gives me a "subquery not allowed in
>this context." error message.
>
>here is the code I tried:
>
>IF :block_name.field_name IN (SELECT column_name FROM table) THEN
>statements;
>statements;
>END IF;
>
>I was thinking of trying to bring each value from the table into a
 variable
>then test to see if they are equal by using a loop.
>Will this work, or is there a better way (examples would be appreciated.)
>
>
>thanks,
>
>Matthew
>

Try this:
DECLARE
   MATCHES NUMBER;
BEGIN
  SELECT COUNT(*) INTO MATCHES
      FROM table
  WHERE :BLOCK_NAME.FIELD = column_name;   

  IF MATCHES > 0 THEN
     .....do whatever you want
  END IF;
END; Received on Thu Jul 28 1994 - 17:45:25 CEST

Original text of this message