declare
v_count number(8,3);
v_sal scott.emp.sal%type := '&P_sal';
cursor cur_name is select sal from scott.emp where sal
between (v_sal-100) and (v_sal +1000);
begin
v_count :=nvl(sql%rowcount ,0);
if v_count = 0 then
dbms_output.put_line('no records are fetch in the given sal
range');
else
dbms_output.put_line('There is/are '||to_char(v_count)||
' salaries are selected in the given range ');
end if;
end;
in the above programm .....for any sal range ....always it
shows the following message..
no records are fetch in the given sal range
please find the mistake and share with me...with thansk and
regards..sarao....
Answer Posted / rohit
declare
v_count number(8,3);
v_sal scott.emp.sal%type := &P_sal;
cursor cur_name is select sal from scott.emp where sal between (v_sal-100) and (v_sal +1000);
begin
for i in cur_name loop
v_count :=nvl(cur_name%rowcount ,0);
exit when cur_name%notfound;
end loop;
dbms_output.put_line(v_count);
if v_count = 0 then
dbms_output.put_line('no records are fetch in the given sal range');
else
dbms_output.put_line('There is/are '||to_char(v_count)|| ' salaries are selected in the given range');
end if;
end;
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
what is myisam? : Sql dba
what are date and time data types? : Sql dba
What is the purpose of a sql?
How can you load microsoft excel data into oracle? : aql loader
how to use myisamchk to check or repair myisam tables? : Sql dba
what does the t-sql command ident_current does? : Transact sql
Can a table contain multiple foreign key’s?
Does sql between include endpoints?
what is the difference between myisam static and myisam dynamic? : Sql dba
What is difference sql and mysql?
what are null values? : Sql dba
How does sql store data?
What is a full join sql?
What does (+) mean in sql joins?
Can you join views in sql?