1、新建一个存储过程
create or replace procedure Test_getTast(in_id in VARCHAR2,
out_name out VARCHAR2
)
is
begin
select title into out_name
from assignment t
where task_id = in_id;
exception
when NO_DATA_FOUND then dbms_output.put_line('exception');
end Test_getTast;
2、新建一个测试窗口
-- Created on 12-12-7 by ADMINISTRATOR
declare
-- Local variables here
i varchar2(7);
j varchar2(8000);
begin
i := '25978';
dbms_output.put_line(i);
Test_getTast(i,j);
dbms_output.put_line(j);
end;
本文将介绍如何在SQL中创建存储过程,并演示如何通过变量进行数据查询与输出。包括异常处理与输出控制。
&spm=1001.2101.3001.5002&articleId=8270513&d=1&t=3&u=3998e1c3ba61401896d70598ad4f1b83)
4万+

被折叠的 条评论
为什么被折叠?



