Sikander Hayyat
Sikander Hayyat

Reputation: 115

PL/SQL: Using two variables in query

SQL plus is giving "from keyword not found where expected". I think my query is correct select ... from ... where I think there is a possibility that we cannot use two variables in a query in PL/SQL block (I'm not sure about that).

DECLARE
  LHID   NUMBER(1);
  LNOPAT NUMBER(6);
BEGIN
  SELECT HID INTO LHID, 
         NUMPATIENTS INTO LNOPAT 
    FROM HOSPITAL065 
   WHERE HLOCATION='LAHORE';

   DBMS_OUTPUT.PUT_LINE ('HID:  ' || LHID || ' GOT PATIENTS  ' ||  
                         LNOPAT || '  LOCATED IN         LAHORE');
END;

Suggestions are welcome!

Upvotes: 1

Views: 79

Answers (1)

René Nyffenegger
René Nyffenegger

Reputation: 40499

You want to use one into only:

select hid, numpatients
   into lhid, lnopat
....

Upvotes: 1

Related Questions