Oracle pl/sql中有一種方法可以創建數據結構,如Java Hashmap,它可以具有記錄類型作爲值和String作爲索引。PL/SQL數據結構像Hashmap
例如;
type emp_rec_type is record (emp_id number,emp_salary number);
emp_rec emp_rec_type;
type emp_assoc_array is table of emp_rec_type indexed by varchar2(30);
emp_map emp_assoc_array;
我想能夠做到以下
emp_rec.emp_id := 1;
emp_rec.salary := 1000;
emp_map('Rohan') := emp_rec;
才能實現這一目標? 我不能使用嵌套表,因爲我只能通過整數索引它。 對於關聯數組,我不能使用對象類型作爲屬性。
也想這樣做,而不必創建一個對象或模式數據類型。 你能提出一些建議嗎?
你已經在你的榜樣答案。小修改。不是'索引',而是'索引',你很好走。 –