PL/SQL Anchored Datatypes


declare
  v_first_name employees.first_name%type;
  v_last_name employees.last_name%type;
begin
  select first_name, last_name
  into v_first_name, v_last_name
  from employees
  where employee_id=100;

  dbms_output.put_line('First name :'||v_first_name||' Last name : '||v_last_name);
  exception
    when no_data_found then
      dbms_output.put_line('No such employee');
end;



declare
  v_first_name employees.first_name%type;
  v_last_name employees.last_name%type;
  v_phone_number employees.phone_number%type;
  v_salary employees.salary%type;
begin
  select first_name, last_name, phone_number, salary
  into v_first_name, v_last_name, v_phone_number, v_salary
  from employees
  where employee_id=101;
 
  dbms_output.put_line('First name '||v_first_name||' Last name '||v_last_name||' Phone number '||v_phone_number||' Salary '||v_salary);
  exception
    when no_data_found then
      dbms_output.put_line('No such employee');

end;

Comments

Popular posts from this blog

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Solution for "Can not obtain Oracle client information from registry"