5:查询两表中的所有字段,满足性别为‘男’的记录
1.先创建表t_code_sex
2.创建表t_employee
3.编辑数据
4.执行pl/sql语句块
---pl/sql语句块查询满足性别为男的
declare
type t_employee_record_type is record(
v_empid t_employee.emp_id%type,
v_emp_name t_employee.emp_name%type,
v_sex_name t_code_sex.name%type);
v_t_employee_record t_employee_record_type;
v_sexx varchar2(4);
begin
v_sexx:=('&et');
select emp_id,emp_name,name into v_t_employee_record from t_employee t join t_code_sex e
on t.sex=e.code and e.name=v_sexx;
dbms_output.put_line('编号:'||v_t_employee_record.v_empid);
dbms_output.put_line('姓名:'||v_t_employee_record.v_emp_name);
dbms_output.put_line('性别:'||v_t_employee_record.v_sex_name);
end;
完成!