Write a simple program on cursors
Answers were Sorted based on User's Feedback
Answer / a.jyothsna
declare
cursor cur_t is select * from test;
var_t test%rowtype;
begin
open cur_t;
loop
fetch cur_t into var_t;
exit when cur_t%notfound;
dbms_output.put_line('a: ' || var_t.a || ', b: ' ||
var_t.b);
end loop;
end;
/
Is This Answer Correct ? | 12 Yes | 2 No |
Answer / subhendu
CREATE OR REPLACE Function test( I_name IN varchar2 )
RETURN number
IS
CURSOR c1
IS
SELECT course_number,
instructor
from courses_tbl
where course_name = I_name
FOR UPDATE of instructor;
v_number courses_tbl.course_number%type;
v_instructor courses_tbl.instructor%type;
BEGIN
open c1;
fetch c1 into v_number,v_instructor ;
if c1%found then
UPDATE courses_tbl
SET instructor = 'SMITH'
WHERE CURRENT OF c1;
COMMIT;
end if;
close c1;
RETURN v_number;
END;
Is This Answer Correct ? | 5 Yes | 1 No |
what are the demerits of sql?
I need to write a simple query,which one is better select statement or stored procedure?and why?
what is a materialized view? : Sql dba
What is a relationship and what are they?
Explain architecture of sql server notification services?
Can cursors be part of a trigger body?
Can you create a table with Primary Key not as the clustered index.
What is Overloading of procedures ?
What is the difference between functions, procedures, and packages in pl/sql?
What is record in pl sql?
What is sql select statement?
How can you view the errors encountered in a trigger?