Answer Posted / ramdeep garg
A cursor is a SELECT statement that is defined within the
declaration section of your PLSQL code. We'll take a look
at three different syntaxes for cursors.
Cursor without parameters (simplest)
The basic syntax for a cursor without parameters is:
CURSOR cursor_name
IS
SELECT_statement;
For example, you could define a cursor called c1 as below.
CURSOR c1
IS
SELECT course_number
from courses_tbl
where course_name = name_in;
The result set of this cursor is all course_numbers whose
course_name matches the variable called name_in.
Below is a function that uses this cursor.
CREATE OR REPLACE Function FindCourse
( name_in IN varchar2 )
RETURN number
IS
cnumber number;
CURSOR c1
IS
SELECT course_number
from courses_tbl
where course_name = name_in;
BEGIN
open c1;
fetch c1 into cnumber;
if c1%notfound then
cnumber := 9999;
end if;
close c1;
RETURN cnumber;
END;
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
Briefly explain what is literal? Give an example where it can be used?
How many types of database triggers exist?
What is a dynamic performance view in oracle?
How to increment dates by 1 in oracle?
Which is better Oracle or MS SQL? Why?
Explain the use of full option in exp command.
Respected sir, Please send me technical questions related to oracle apps..
A table t is there.If you perform insert ,update and delete then the trigger will fire.What is the minimum no of trigger required for a table.
We are using Oracle apps with XML publisher.In that,we are facing some problems while giving a Footer in RTF Template.While giving a footer in RTF Template it is Visible in all the pages,but after the PDF is getiing generated,the Footer are Visible on alternate pages only (like on first page ,third page) and so on. Please provide the Solution for getting the Footer on all the pages.
How many types of synonyms in Oracle?
What is a trigger and what are its types?
List the various oracle database objects?
What are the common oracle dba tasks?
What is a package in oracle?
interview questions with answer for cts