Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Initialiazing collection variable in Package spec

NSK2KSNOct 5 2015 — edited Oct 6 2015

Hi Experts,

I know this might be a basic question, below is my piece of code

I have a variable g_number declared as number data type and initialized to 10

I have EMP_SAL_TAB which is of EMP_SAL data type which is defined in line 6.

but am getting error when am trying to initialize it in line 11. 

now my query is why am getting error for collection initialization at line 11 ?????  sorry for a very basic question, but it is always good to clear a query.

create or replace PACKAGE emp_sal AS

g_salary_spec number;

   PROCEDURE find_sal(c_id emp.empno%type);

   FUNCTION CONCATE_NAMES (C_ID EMP.EMPNO%TYPE) RETURN VARCHAR2;

  

   type emp_sal is table of char(2) index by binary_integer;

   emp_sal_tab emp_sal;

  

   g_number number:=10;

  

   emp_sal_tab(1):= 100;

  

END emp_sal;

This post has been answered by unknown-7404 on Oct 5 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2015
Added on Oct 5 2015
4 comments
383 views