stored proc.txt
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- Stored Procedures for Auto-Generated Keys
- -----------------------------------------
- Here we have an example of a stored procedure that will insert a row into the database and return the auto-generated primary key field within the same database call. The primary key is needed to return from ejbCreate, as mandated by the spec. The stored procedure uses an Oracle sequence named accountID to generate primary keys.
- InsertAccount stored procedure for Oracle
- create or replace procedure insertAccount
- (owner IN varchar,
- bal IN integer,
- newid OUT integer)
- AS
- BEGIN
- insert into accounts (id, ownername, balance)
- values (accountID.nextval, owner, bal)
- returning id into newid;
- END;