PL/SQL 學習日記

ysjxjf發表於2006-07-20
記錄自己的學習過程,不斷的更新![@more@]
2006.07.20
-----------------------
問題:有關列名與變數名一致的情況的處理(在從 SQL SERVER 遷移到 Oracle 中處理儲存過程時可能會遇到該問題 )
解決:在變數名前加限定詞create or replace procedure test_update(job_id varchar, my_salary int) as begin update test set min_salary = my_salary where job_id = test_update.job_id; end;

Multilevel VARRAY Example ( For Oracle )

declare
 type t1 is varray(10) of integer;
 type nt1 is varray(10) of t1; -- multilevel varray type
 va t1 := t1(2,3,5);
-- initialize multilevel varray
 nva nt1 := nt1(va, t1(55,6,73), t1(2,4), va);
 i integer;
 va1 t1;
begin
 -- multilevel access
 i := nva(2)(3); -- i will get value 73
 dbms_output.put_line(i);
 -- add a new varray element to nva
 nva.extend;

 nva(5) := t1(56, 32);
-- replace an inner varray element
 nva(4) := t1(45,43,67,43345);
-- replace an inner integer element
 nva(4)(4) := 1; -- replaces 43345 with 1
-- add a new element to the 4th varray element
-- and store integer 89 into it.
 nva(4).extend;
 nva(4)(5) := 89;
end;
/

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/66634/viewspace-850733/,如需轉載,請註明出處,否則將追究法律責任。

相關文章