create or replace procedure p_employee_hire
authid current_user
is
vn_ctn number(2);
STMT_SQL varchar2(500);
begin
select count(*) into vn_ctn from user_all_tables a where a.table_name like upper('T_RESULT_INFO');
if vn_ctn > 0 then
execute immediate 'drop table T_RESULT_INFO';
end if;
execute immediate 'create table T_RESULT_INFO as select e.ename,e.job from emp e where e.job='||''''||'CLERK'||'''';
end ;
authid current_user
is
vn_ctn number(2);
STMT_SQL varchar2(500);
begin
select count(*) into vn_ctn from user_all_tables a where a.table_name like upper('T_RESULT_INFO');
if vn_ctn > 0 then
execute immediate 'drop table T_RESULT_INFO';
end if;
execute immediate 'create table T_RESULT_INFO as select e.ename,e.job from emp e where e.job='||''''||'CLERK'||'''';
end ;
本文介绍了一个PL/SQL过程的创建与使用方法。该过程首先检查是否存在名为T_RESULT_INFO的表,如果存在则删除该表,并创建一个新的T_RESULT_INFO表,其内容为EMP表中JOB为CLERK的所有记录的ENAME和JOB字段。
3998

被折叠的 条评论
为什么被折叠?



