Garayed.com  

Go Back   Garayed.com > Oracle
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-06-2007, 02:40 PM
Vojta
 
Posts: n/a
Default Index-by table - compilation errors

Please, can you advise? I created package in which I defined type:

TYPE StrListTyp IS TABLE OF VARCHAR(255) INDEX BY BINARY_INTEGER;

Package was created, it works, procedures can work with this type. Then I
tried to create the same type outside package by executing script:

CREATE OR REPLACE TYPE StrListTyp IS TABLE OF VARCHAR(255) INDEX BY
BINARY_INTEGER;

Type is created with warning: "Warning: TYPE created with compilation
errors". When I try to run procedure using this type I get error "Object
[procedure name] is invalid". If I run the script without "INDEX BY", type
is created without wornings but indexing does not work:

CREATE OR REPLACE TYPE StrListTyp IS TABLE OF VARCHAR(255);

CREATE PROCEDURE MyProc IS
strList StrListTyp := StrListTyp();
BEGIN
strList(1) := 'ABC'; -- Here I get error "Lower index exceeds counter"
END;

Please, what do I do wrong? How can I create index-by table outside package?

Thank you! Vojta


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-06-2007, 02:55 PM
fitzjarrell@cox.net
 
Posts: n/a
Default Re: Index-by table - compilation errors

On Jun 6, 9:40 am, "Vojta" <r...@centrum.cz> wrote:
> Please, can you advise? I created package in which I defined type:
>
> TYPE StrListTyp IS TABLE OF VARCHAR(255) INDEX BY BINARY_INTEGER;
>
> Package was created, it works, procedures can work with this type. Then I
> tried to create the same type outside package by executing script:
>
> CREATE OR REPLACE TYPE StrListTyp IS TABLE OF VARCHAR(255) INDEX BY
> BINARY_INTEGER;
>
> Type is created with warning: "Warning: TYPE created with compilation
> errors". When I try to run procedure using this type I get error "Object
> [procedure name] is invalid". If I run the script without "INDEX BY", type
> is created without wornings but indexing does not work:
>
> CREATE OR REPLACE TYPE StrListTyp IS TABLE OF VARCHAR(255);
>
> CREATE PROCEDURE MyProc IS
> strList StrListTyp := StrListTyp();
> BEGIN
> strList(1) := 'ABC'; -- Here I get error "Lower index exceeds counter"
> END;
>
> Please, what do I do wrong? How can I create index-by table outside package?
>
> Thank you! Vojta


Such tables are PL/SQL constructs, not physical Oracle objects. They
are valid within the scope of a procedure, function or package. They
are not valid outside of PL/SQL.


David Fitzjarrell

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:22 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.