- %rowtype for complete row into
1
2
3
4
5
6
7
8
9
10
declare
mrec rahul_emp%rowtype;
begin
select * into mrec from rahul_emp
where empno=7900;
dbms_output.put_line(' the salary of employee '||mrec.ename||' is '||mrec.sal ||' job= '||mrec.job);
exception
when no_data_found then
dbms_output.put_line('no such employee found');
end;
- taking input in plsql
1
2
3
4
5
6
7
8
9
10
declare
mrec rahul_emp%rowtype;
begin
select * into mrec from rahul_emp
where empno=&input;
dbms_output.put_line(' the salary of employee '||mrec.ename||' is '||mrec.sal ||' job= '||mrec.job);
exception
when no_data_found then
dbms_output.put_line('no such employee found');
end;
- taking input in plsql for a varchar requires single quotes in where
1
2
3
4
5
6
7
8
9
10
declare
mrec rahul_emp%rowtype;
begin
select * into mrec from rahul_emp
where ename = '&input';
dbms_output.put_line(' the salary of employee '||mrec.ename||' is '||mrec.sal ||' job= '||mrec.job);
exception
when no_data_found then
dbms_output.put_line('no such employee found');
end;
- taking input in plsql for a varchar requires single quotes in where , making input to upper case
1
2
3
4
5
6
7
8
9
10
declare
mrec rahul_emp%rowtype;
begin
select * into mrec from rahul_emp
where ename = upper('&input');
dbms_output.put_line(' the salary of employee '||mrec.ename||' is '||mrec.sal ||' job= '||mrec.job);
exception
when no_data_found then
dbms_output.put_line('no such employee found');
end;