Oracle中插入一条数据并且返回该条数据的id:
/*
create or replace procedure worktask_content_Insert
(
theme varchar2,
type varchar2,
status varchar2,
source varchar2,
content varchar2,
slave varchar2,
progress varchar2,
conversionschedule varchar2,
meetingid varchar2,
scheduleid varchar2,
scale varchar2,
liableperson varchar2,
coadjutant varchar2,
starttime varchar2,
endtime varchar2,
completiondate varchar2,
beforestarttime varchar2,
starttype varchar2,
beforeendtime varchar2,
endtype varchar2,
revise varchar2,
departmentstask varchar2,
sontask varchar2,
taskcoding varchar2,
createid varchar2,
libdeparid varchar2,
fathertaskid varchar2,
maxid out varchar2
)
as
maxtaskid varchar2(50);
begin
--插入数据
insert into worktask_content values(sq_worktask_content.nextval,theme, type ,status,source,content,slave,progress,conversionschedule,meetingid,scheduleid,scale,liableperson,coadjutant,starttime, endtime ,
completiondate,beforestarttime,starttype,beforeendtime,endtype,revise,departmentstask,sontask,taskcoding,createid,libdeparid,fathertaskid);
--查出最大值
select MAX(taskid) into maxtaskid from worktask_content;
maxid:=maxtaskid;
--修改数据
update worktask_content set fathertaskid=maxtaskid where taskid=maxtaskid;
commit;
Exception
When others then
Rollback;
end;
*/
/
-- declare
-- b_id varchar(14);
-- begin
-- worktask_content_Insert('23','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1',b_id);
-- dbms_output.put_line(b_id);
-- end;
-- select * from worktask_content
/