Answer Posted / 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 |
Post New Answer View All Answers
What is string join?
Can there be more than one function with a similar name in a pl/sql block?
Why do we use function in pl sql?
how to see the create table statement of an existing table? : Sql dba
What is sql partition?
How do you exit in sql?
what is the difference between a local and a global temporary table? : Sql dba
How can we implement rollback or commit statement in a trigger?
Explain autonomous transaction.
What is a pdo connection?
In pl/sql, what is bulk binding, and when/how would it help performance?
How do I run sql profiler?
How do I clear the screen in sql plus?
Why do we use view in sql?
What is a dirty read sql?