0

I have a procedure:

CREATE OR REPLACE PROCEDURE recommend_book(
  in_ID_user IN number
)
IS
  --zmienne
  zmienna1 number(9,0);
BEGIN
  SELECT COUNT(GENRE) 
    INTO zmienna1 
    FROM BOOKS
   WHERE ID_BOOK IN(SELECT ID_BOOK  
                      FROM SIGNATURES
                     WHERE SIGNATURE IN (SELECT SIGNATURE 
                                           FROM ORDERS 
                                          WHERE ID_READER=in_ID_user)
                    );  
END;
/

I'm getting the error

PL-00428: An INTO clause is expected in this SELECT statement

Could you please help me identify what's missing/what's wrong here?

Nick Krasnov
  • 26,886
  • 6
  • 61
  • 78
monterinio
  • 49
  • 2
  • 11
  • it does not give error in oracle 11g r2 , – CompEng Oct 25 '16 at 14:41
  • 1
    Which version of Oracle (and SQL Developer) are you using? That doesn't immediately make sense... Are you sure the error in the log is from the second compilation of the function, not the first? (Looking at your screenshot...). Is the error still in `user_errors`? – Alex Poole Oct 25 '16 at 14:42
  • SQL Developer Version 3.2.20.10 – monterinio Oct 25 '16 at 14:43
  • 1
    @monterinio Are you 100% sure that the error you're seeing isn't from a previous compilation attempt? Your procedure looks perfectly fine. – Frank Schmitt Oct 25 '16 at 14:44
  • @FrankSchmitt well, actually you're right. When i restarted SQL Developer everything seems to work fine and the procedure compiles perfectly. How can I prevent situations like this one from happening? I belive I'm not supposed to rerun SQL Dev everytime something doesn't compile...? – monterinio Oct 25 '16 at 14:48
  • @monterinio - I suspect that's the old version being a bit odd; I tried compiling your code to get that error and then again with clean code, and the old log message wasn't kept - but that's in SQL Developer 4.2. Are you able to upgrade to a more recent version? – Alex Poole Oct 25 '16 at 14:49
  • If your run and debug buttons are enabled, then it compiled. – JDro04 Oct 25 '16 at 14:51
  • @AlexPoole yes, I am and I will update it. – monterinio Oct 25 '16 at 14:53

1 Answers1

0

For other developers when see this question, it should be an answer:

As Frank says:

Are you 100% sure that the error you're seeing isn't from a previous compilation attempt? Your procedure looks perfectly fine.

Just restart your compiler.

CompEng
  • 7,161
  • 16
  • 68
  • 122