PL SQL學習筆記二

2021-08-24 19:39:21 字數 1213 閱讀 9020

-- created on 2009-9-16 by administrator

/*當從成績表裡提取資料時,把成績少於60的學生姓名,

課程,成績插入到不及格學生表,大於60小於80的插入良好學生表,

大於80的插入優秀學生表.*/

/*declare

i integer :=1;

v_tt integer :=1;

sum integer ;

cursor v_empcur is select * from student ;

tt v_empcur%rowtype;

begin

open v_empcur;--開啟游標

loop

fetch v_empcur into tt;

dbms_output.put_line(tt.stuid);

exit when(v_empcur%notfound);

end loop;

end;*/

declare

i integer :=1;

--close v_empcur;--關閉游標

--不能用 × 。因為兩個表內有重複的字段,查詢時衝突

--cursor cur is select s.stuid,s.name,t.course,t.score from student s,score t where s.stuid=t.stuid;

cursor cur is select s.*,t.course,t.score from student s,score t where s.stuid=t.stuid;

begin

for v_tt in cur loop

if(v_tt.score =33) then dbms_output.put_line(v_tt.name);

end if;

end loop;

end;

/* begin

open emp_cursor(10, 'clerk');

loop

fetch emp_cursor into v_empno,v_ename;

exit when emp_cursor%notfound;

dbms_output.put_line(v_empno||','||v_ename);

end loop;

end;

*/

PL SQL學習筆記

from ebs pl sql儲存過程報表輸出 1.fnd file.put line fnd file.log,l err idx 從mes表獲取tool id tool.tool id 出現異常錯誤!2.fnd file.put line fnd file.output,文字輸出內容.獲取物件結...

PL SQL學習筆記

1 啟動sqlplus crtl r sqlplus 啟動sqlplus 輸入使用者名稱密碼登陸oracle 輸出hello world!ps sql set serveroutput on 這句不寫的話不會有結果輸出 sql begin 2 dbms output.put line hello w...

plsql基礎學習 二 PLSQL型別

標量資料型別 a.儲存單一的值 b.沒有內部結構 基本標量資料型別 char,varchar2,long,long raw,number,binary integer,pls integer,boolean,date,timestamp 一 oracle資料型別 1.字元資料型別 char,varc...