创建数据库对象脚本失败,求救!

zealot_zk 2004-11-10 10:17:23
我写的一个创建数据库存储过程的脚本,就是把所有的存储过程的定义全部放在一起,如下:

create or replace produce my_pro_1(...) as
....
begin
...
end produce my_pro_1;


create or replace produce my_pro_2(...) as
...
begin
...
end my_pro_2;

...

这样只能创建第一个过程,其余的都没发创建,而且其余的过程定义都做为第一个过程的代码了;但是把他们一个个的分开执行就都可以执行成功,不知道为什么,请高手指教
...全文
136 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zealot_zk 2004-11-23
  • 打赏
  • 举报
回复
先谢谢楼上了,可是你的方法对我来说意味着要修改大量的应用程序,因为,我的应用已经完成了,所以不能在干生包,这样的话调用时都要修改。

我回去又是了一下,发现,只要在两个存储过程的定义之间多加一个回车换行就可以了,现在我的安装程序已经作完了,谢谢你
lishuguang 2004-11-10
  • 打赏
  • 举报
回复
这种应该创建成包,创建包时,包的定义和包的内容被分别地生成.具体可以看看相关的资料,我给你一个具体例子:
包定义:
create or replace package wfe_flow_dbfunc is
-----------------------------------------------------------------------------------
function inst_create (
i_tmpl_id in wfe_flow_tmpl.tmpl_id%type,
i_user_id in sys_users.id%type,
i_inst_id in wfe_flow_inst.inst_id%type,
i_inst_name in wfe_flow_inst.inst_name%type,
o_form_file out wfe_flow_form.form_file%type,
o_task_id out wfe_flow_task.task_id%type
) return varchar2;
end wfe_flow_dbfunc;

包体:
create or replace package body wfe_flow_dbfunc is
function inst_create (
i_tmpl_id in wfe_flow_tmpl.tmpl_id%type,
i_user_id in sys_users.id%type,
i_inst_id in wfe_flow_inst.inst_id%type,
i_inst_name in wfe_flow_inst.inst_name%type,
o_form_file out wfe_flow_form.form_file%type,
o_task_id out wfe_flow_task.task_id%type
) return varchar2 is
v_form_id wfe_flow_form.form_id%type:='';
v_node_id wfe_flow_inst_node.node_id%type:='';
begin
o_task_id:=-1;
o_form_file:='';
if ut_tmpl_ok(i_tmpl_id)<>'1' then return '错误:非法的流程模板id -> '||i_tmpl_id; end if;
if ut_user_ok(i_user_id)<>'1' then return '错误:非法的用户id -> '||i_user_id; end if;
if lengthb(i_inst_id)<>'32' then return '错误:非法的流程实例id -> '||i_inst_id; end if;
if ut_inst_ok(i_inst_id)<>'0' then return '错误:已经存在的流程实例id -> '||i_inst_id; end if;

begin
--取模板的form_id,form_name
select ff.form_id,ff.form_file into v_form_id,o_form_file
from wfe_flow_tmpl ft,wfe_flow_form ff
where ft.tmpl_id=i_tmpl_id and ff.form_id=ft.form_id;
--插入流程实例记录
insert into wfe_flow_inst
(inst_id,inst_name,state,tmpl_id,form_id,
create_user,create_time,locker,locktime,des)
values (i_inst_id,i_inst_name,'Y',i_tmpl_id,v_form_id,
i_user_id,sysdate,null,null,null);
--复制所有的模板节点到流程实例节点
insert into wfe_flow_inst_node
( inst_id,node_id,node_pid,node_idx,node_name,node_type,
node_skip,node_target,node_current,node_rights,
node_users,node_users_cp,node_limit
)
(select i_inst_id,t.node_id,t.node_pid,t.node_idx,t.node_name,t.node_type,
t.node_skip,t.node_target,t.node_current,t.node_rights,
t.node_users,t.node_users_cp,t.node_limit
from wfe_flow_tmpl_node t where t.tmpl_id=i_tmpl_id);
exception when others then
return '错误:创建流程实例失败 -> '||sqlerrm;
end;

begin
--取实例节点的启动节点
begin
select i.node_id into v_node_id from wfe_flow_inst_node i
where i.inst_id=i_inst_id and i.node_idx=1;
exception when NO_DATA_FOUND then
return '错误:启动流程实例失败,该流程的模板未定义(空流程)';
end;
--取一个任务号
select wfe_flow_seq_task_id.nextval into o_task_id from dual;
--生成并开始一个任务
insert into wfe_flow_task
(task_id,task_pid,inst_id,node_id,user_id,real_user_id,do_begin_time,do_end_time,do_sent_time)
values (o_task_id,0,i_inst_id,v_node_id,i_user_id,i_user_id,sysdate,null,null);
--修改启动节点的属性成实际情况
update wfe_flow_inst_node
set node_type=10,node_skip=0,node_target=1,node_current=1,
node_users=i_user_id,node_users_cp=null,node_limit=-1
where inst_id=i_inst_id and node_idx=1;
exception when others then
return '错误:启动流程实例失败 -> '||sqlerrm;
end;
return '';
end;
end wfe_flow_dbfunc;


17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧