-- Create table
create table USER_INFO
(
id VARCHAR2(4),
name VARCHAR2(15),
pwd VARCHAR2(15),
address VARCHAR2(30)
)
--Create procedure
create or replace procedure AddUser(
n_id test_user.id%TYPE,
n_name test_user.name%TYPE,
n_pwd test_user.pwd%TYPE,
n_address test_user.address%TYPE) as
begin
--向表中插入数据
INSERT INTO user_info
(id,name,pwd,address)
VALUES
(n_id,n_name,n_pwd,n_address);
end ;
--执行(sql窗口)
declare
n_id test_user.id%type='11';
n_name test_user.name%type='dane';
n_pwd test_user.pwd%type='12345';
n_address test_user.address%type='beijing'
begin
adduser(n_id,n_name,n_pwd,n_address);
dbms_output.put_line('已成功插入');
end
输出结果可以到 "输出"查看
执行(命令窗口)
execute AddUser('21','1','1','beijing');