Your Ad Here

Tuesday, March 24, 2009

To find a Record in Table

declare
ena emp.ename%type;
jb emp.job%type;
salary emp.sal%type;
no number := &number;
begin
select ename,job,sal into ena,jb,salary from emp where empno = no;
dbms_output.put_line('Employee No = ' || no || ' name = ' || ena || ' job = ' || jb || ' salary = ' || salary);
exception
when NO_DATA_FOUND then
dbms_output.put_line('Sorry!... RECORD NO FOUND...');
end;
/

No comments: