日期:2014-05-16 浏览次数:20379 次
create or replace procedure output_date is begin dbms_output.put_line(sysdate); end output_date;
begin output_date; end;
-- Create table create table TEST_USER ( USERID NUMBER not null, USERNAME VARCHAR2(20), PASSWORD VARCHAR2(20), REALNAME VARCHAR2(20), SEX CHAR(1), TYPE CHAR(2), STATUS CHAR(2) )
-- Create/Recreate primary, unique and foreign key constraints alter table TEST_USER add constraint TEST_USER_PK primary key (USERID) using index pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited );
insert into test_user (USERID, USERNAME, PASSWORD, REALNAME, SEX, TYPE, STATUS) values (1, 'tomcat', 'hahaha', 'da', '1', '01', '01');
create or replace procedure get_username(param_userid in number,param_username out varchar2) as begin select username into param_username from test_user where userid = param_userid; --变量赋值 exception when no_data_found then raise_application_error(-1,'该用户不存在!'); end get_username;
declare username varchar2(20); begin get_username(1,username); dbms_output.put_line(username); end;