从Oracle数据库中查出某列值,作为存储过程中的变量!能实现吗?
create proc procName
declare
variableName varcher(30);
begin
select fieldName into variableName from tableName where ; // 这样就可以了,但只能提取这个列的一个值。如果要提多个就需要用游标。
end;
create proc procName
as
cursor cursorName is select fieldName from tableName;
variableName varchar2(30);
begin
open cursorName;
loop
fetch cursorName into variableName;
end loop;
end;