Reputation: 1
Hi there i currently having an error code on my pl/sql query
Here is the code:
declare
people varchar2(20);
total varchar2(20);
begin
SELECT P.PTITLE ,COUNT(S.SNAME) into people,total
FROM POSITION P
INNER JOIN SNEEDED S
ON P.P#=S.P#
;
dbms_output.put_line('Name :'|| people ||' '||'Total Number of Subject :'|| total);
end;
/
In pl/sql, can we select multiple variable and output on the same line ?
Upvotes: 0
Views: 58
Reputation: 377
I think in this case you can not use COUNT() keyword and another field without insert a GROUP BY clause, try this:
SELECT P.PTITLE ,COUNT(S.SNAME) into people,total
FROM POSITION P
INNER JOIN SNEEDED S
ON P.P#=S.P#
GROUP BY P.PTITLE;
Upvotes: 2