最简单的存储过程写法及调用
2013-07-26 17:45
330 查看
--创建临时表
create table test_table_tmp(test_id varchar2(50),test_name varchar2(50),modify_date date);
insert into test_table_tmp values('3','c',sysdate);
create table test_table as select * from test_table_tmp where 1 = 2
--创建存储过程 传入参数 test_num 传出参数 out_num
create or replace procedure My_test_proce(test_num in varchar,out_num out varchar)
as
cursor test_cur is select * from test_table_tmp;
begin
dbms_output.put_line(test_num);
for test_table in test_cur loop
out_num := test_table.test_name;
dbms_output.put_line(test_table.test_id||test_table.test_name||test_table.modify_date);
insert into test_table values(test_table.test_id,test_table.test_name,test_table.modify_date);
commit;
end loop;
end;
--调用存储过程
declare
test_num varchar(50);
begin
My_test_proce('2',test_num);
dbms_output.put_line(test_num);
end;
create table test_table_tmp(test_id varchar2(50),test_name varchar2(50),modify_date date);
insert into test_table_tmp values('3','c',sysdate);
create table test_table as select * from test_table_tmp where 1 = 2
--创建存储过程 传入参数 test_num 传出参数 out_num
create or replace procedure My_test_proce(test_num in varchar,out_num out varchar)
as
cursor test_cur is select * from test_table_tmp;
begin
dbms_output.put_line(test_num);
for test_table in test_cur loop
out_num := test_table.test_name;
dbms_output.put_line(test_table.test_id||test_table.test_name||test_table.modify_date);
insert into test_table values(test_table.test_id,test_table.test_name,test_table.modify_date);
commit;
end loop;
end;
--调用存储过程
declare
test_num varchar(50);
begin
My_test_proce('2',test_num);
dbms_output.put_line(test_num);
end;
相关文章推荐
- 简单的存储过程分页,删除多条记录的存储过程,存储过程中调用存储过程
- 数据库_MySQL_简单的存储过程 创建_调用_查找
- 最简单的SQL存储过程调用(不会存储过程的人非常值得看,很有实际意义)
- Oracle定时调用存储过程(简单易懂)
- 存储过程的调用简单调用
- sql 存储过程 几个 简单例子,及在asp.net(C#)中调用存储过程的代码
- Web Services调用存储过程简单实例
- 简单的存储过程编写及MySQL中event调用
- C# 怎么调用存储过程 经典写法
- oracle job 定时job调用存储过程写法 及实例 存储过程 建表
- 第四节: EF调用存储过程的通用写法和DBFirst模式子类调用的特有写法
- 关于oracle中PL/SQL语句,即存储过程的写法和调用。
- 数据库技术_Orcale技术(0002)_5分钟会用存储过程_存储过程简单实例(包含循环、条件、增改查、参数传入、变量赋值、java调用等)
- Ajax调用存储过程简单实例
- ASP中调用存储过程、语法、写法-sql server数据库
- 简单的.NET存储过程调用
- ASP中调用存储过程、存储过程语法、存储过程写法-sql server数据库
- C#简单轻松调用存储过程(SqlServer2000)
- ASP中调用存储过程、语法、写法-sql server数据库(转)
- ASP中调用存储过程、语法、写法-sql server数据库