刚接触Oracle,问题很菜declare
v_deptcode Pub_Department.DeptCode%Type;
v_deptname Pub_Department.DeptName%Type;
v_stopflag Pub_Department.StopFlag%Type;
begin
select DEPTCODE,DEPTNAME,STOPFLAG into v_deptcode,v_deptname,v_stopflag
from Pub_Department
where DEPTCODE='062103' and XSFLAG=1;
end;和select DEPTCODE,DEPTNAME,STOPFLAG
from Pub_Department
where DEPTCODE='062103' and XSFLAG=1;
v_deptcode Pub_Department.DeptCode%Type;
v_deptname Pub_Department.DeptName%Type;
v_stopflag Pub_Department.StopFlag%Type;
begin
select DEPTCODE,DEPTNAME,STOPFLAG into v_deptcode,v_deptname,v_stopflag
from Pub_Department
where DEPTCODE='062103' and XSFLAG=1;
end;和select DEPTCODE,DEPTNAME,STOPFLAG
from Pub_Department
where DEPTCODE='062103' and XSFLAG=1;
一个是返回给变量,且只能返回单行
一个是返回给界面,可多行
(而且查询出来是一行才会正常,否则会报too_many_rows的错误)第一个是一个sql查询语句 返回结果集
dbms_output.put_line(v_deptcode||';'||v_deptname||';'||v_stopflag);
一个是plsql 的匿名快
下面的是检索