Answer the question
In order to leave comments, you need to log in
How to see the result of a query?
Sorry for the very stupid question. How to view the content of a request
declare
V_StudentRecord students%ROWTYPE;
V_Department classes.department%TYPE;
V_Course classes.course%TYPE;
begin
select *
into v_StudentRecord
from students
where id = 1000;
select department, course
into v_Department, v_Course
from classes
where room_id = 99997;
end;
Answer the question
In order to leave comments, you need to log in
select *
from students
where id = 1000;
select department, course
from classes
where room_id = 99997;
It is also possible to display the result of the query in output, for this you need to wrap the select in a cursor, and then output the result to the output in a loop using the dbms_output.put_line ( ) procedure. But there is one point, the put_line() procedure takes data with the varchar2 type (or types converting to it) as input, so put_line() will have to enumerate all the cursor fields, and then concatenate them.
The result will be something like this:
begin
for rStudent in (
select S.Id, S.Name, S.Age
from Students S
) loop
dbms_output.put_line (rStudent.Id || ' ' || rStudent.Name || ' ' rStudent.Age);
end loop;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question