17,377
社区成员
发帖
与我相关
我的任务
分享
exec fuck;
--或
begin
fuck;
end;
create or replace procedure fuck
is--此处少了is或as
--begin--声明变量要出现在begin end块前
--declare --存储过程中不用declare
v_exists number;
begin--
select count(*) into v_exists from user_tables where table_name = 'TEST1';
if v_exists > 0 then
execute immediate 'drop table TEST1';
end if;
-- end;
-- begin
execute immediate '
create table test1(
mobile_id varchar2(12),
callin_time date,
callout_time date,
status char(1)
)';
--commit;--创建表属ddl语句,不需要commit;
--end;
insert into test1(mobile_id,callin_time,callout_time,
status)
select * from Call_book_info;
commit;
delete from Call_book_info where mobile_id
not in (select min(mobile_id) from call_book_info);
end;
/