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 the use of function "module procedure" in pl/sql?
What is delete command in sql?
What is parameter substitution in sql?
How do you know if a relationship is 2nf?
Why we use cross join?
what is a constraint? Tell me about its various levels. : Sql dba
what are the nonstandard string types? : Sql dba
What plvcmt and plvrb does in pl/sql?
how can we submit a form without a submit button? : Sql dba
Is sql an operating system?
what are the differences between binary and varbinary? : Sql dba
Explain what is sql?
What is the difference between row level and statement level trigger?
What are the parameter modes supported by pl/sql?
What is difference between mysql and postgresql?