Oracle 커서 의 간단 한 용법 을 상세 하 게 설명 하 다.
create or replace procedure NW_DelYW(iOPERATION_ID number,
sUserID varchar2) is
sCurDJBH yw_operation_link.djbh%type;
cursor table_yw(ywid yw_operation.id%type) is
select * from yw_operation_link t1 where t1.operation_id = ywid;
begin
for dr in table_yw(iOPERATION_ID) loop
sCurDJBH := dr.djbh;
-- opercationid
/* select t1.operation_id
into sOperationID
from yw_operation_link t1
where t1.djbh = sCurDJBH;*/
--
insert into log_zfywinfo
(DJBH,
DJDL,
DJXL,
DLMC,
XLMC,
SLR,
SLRID,
SQRXM,
FWZL,
ZFRQ,
ZFRID,
zfr)
select distinct sCurDJBH,
t4.id,
t3.id,
t4.name,
t3.name,
t1.slry,
t1.slryid,
t1.SQRXM,
t1.zl,
sysdate,
sUserID,
(select tt.name from pw_user tt where tt.id=sUserID)
from yw_operation t1
join yw_operation_link t2
on t2.operation_id = t1.ID
join BUSINESS_TYPE t3
on t3.id = t1.business_id
join BUSINESS_CLASS t4
on t4.id = t3.parent_id
where t1.ID = dr.operation_id;
exception
when others then
rollback;
dbms_output.put_line(sqlerrm);
end NW_DelYW;
Oracle 은 cursor 커서 순환 을 사용 하여 삭제 업 데 이 트 를 추가 합 니 다.지식 포인트 확장:
Oracle 커서 단순 예시
커서 를 사용 하여 직원 의 이름과 월급 을 인쇄 하 다.
set serveroutput on;
declare
cursor cemp is select ename,sal from emp;
cname emp.ename%type;
csal emp.sal%type;
begin
open cemp;
loop
fetch cemp into cname,csal;
exit when cemp%notfound;
dbms_output.put_line(cname || ' ' || csal);
end loop;
end;
/
매개 변수 가 있 는 커서커서 를 사용 하여 모 부서 번호 의 모든 직원 의 이름 을 인쇄 하 다.
set serveroutput on;
declare
cursor cemp(cno emp.deptno%type) is select ename from emp where emp.deptno = cno;
cname emp.ename%type;
begin
open cemp(10);
loop
fetch cemp into cname;
exit when cemp%notfound;
dbms_output.put_line(cname);
end loop;
end;
/
총결산위 에서 말 한 것 은 소 편 이 여러분 에 게 소개 한 Oracle 커서 의 간단 한 용법 입 니 다.여러분 에 게 도움 이 되 기 를 바 랍 니 다.만약 에 궁금 한 점 이 있 으 면 저 에 게 메 시 지 를 남 겨 주세요.소 편 은 제때에 여러분 에 게 답 할 것 입 니 다.여기 서도 저희 사이트 에 대한 여러분 의 지지 에 감 사 드 립 니 다!
만약 당신 이 본문 이 당신 에 게 도움 이 된다 고 생각한다 면,전 재 를 환영 합 니 다.번 거 로 우 시 겠 지만 출처 를 밝 혀 주 십시오.감사합니다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
자바 작업 은 Clob 또는 NClob 데이터 형식의 저장 프로 세 스 인 스 턴 스 를 포함 합 니 다.텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.