Home » SQL & PL/SQL » SQL & PL/SQL » select from Index-By Table in a package has errors (Oracle 10g)
select from Index-By Table in a package has errors [message #347888] Sun, 14 September 2008 23:32 Go to next message
soidamientrung
Messages: 2
Registered: September 2007
Location: HCM
Junior Member
I have a package as following. I want to select data from an Index-By Tabe in my package. But It has error.
Please, can you have me!


CREATE OR REPLACE PACKAGE TN_MUSIC_HaiTest AS
    type myTableType is table of number(4);
    
    PROCEDURE P_Test_indexby_table(
        p_P1 IN myTableType,
        p_curResult out SYS_REFCURSOR
    );
END TN_MUSIC_HaiTest;
/


CREATE OR REPLACE PACKAGE BODY TN_MUSIC_HaiTest AS
    PROCEDURE P_Test_indexby_table(
        p_P1 IN myTableType,
        p_curResult out SYS_REFCURSOR
    ) AS
        --t_empnos myTableType := myTableType(7639,7344,7654);
    BEGIN
        OPEN p_curResult FOR
        SELECT column_value as C1
        from table(cast(p_P1 as myTableType));
        --from table(cast(t_empnos as myTableType));
    END P_Test_indexby_table;
END TN_MUSIC_HaiTest;
/
Re: select from Index-By Table in a package has errors [message #347890 is a reply to message #347888] Sun, 14 September 2008 23:36 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & FOLLOW the Posting Guidelines as stated in URL above


> I want to select data from an Index-By Tabe in my package. But
HUH? I do not understand what this means

Please use CUT & PASTE to show complete SQL & results.

>It has error.
ERROR? What error? I do not see any error.
Re: select from Index-By Table in a package has errors [message #347910 is a reply to message #347888] Mon, 15 September 2008 01:02 Go to previous message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You can't select a PL/SQL type, you have to use a SQL one created with CREATE TYPE.

Regards
Michel
Previous Topic: System variable for the current procedure/function
Next Topic: dbms_jobs
Goto Forum:
  


Current Time: Thu Feb 06 10:28:50 CST 2025