ORA-00902 error invalid data type when you use CAST in the PL/SQL Package

I'm getting ORA - 00902 Datatype not valid error when you use cast in getEmpValues (see code below) method in the package I created.
I don't know what is the cause of the error. Any help would be appreciated



CREATE OR REPLACE PACKAGE TEST. TEST_PKG AS

ARRAY TYPE MyTableType IS NUMBER;
TYPE REF_CURSOR IS REF CURSOR;

FUNCTION str2tbl (p_str IN VARCHAR2)
RETURN myTableType;

PROCEDURE getContactValues (p_ParameterString IN VARCHAR2, p_Cursor1 to REF_CURSOR);

END TEST_PKG;



CREATE OR REPLACE PACKAGE BODY TEST. TEST_PKG AS

FUNCTION str2tbl (p_str IN VARCHAR2)
RETURN myTableType
AS
l_str LONG default p_str | ',';
l_n NUMBER;
myTableType l_data: = myTabletype();

BEGIN
LOOP

l_n: = INSTR (l_str, ",");
WHEN the OUTPUT (nvl(l_n,0) = 0);
l_data.extend;
l_data (l_data.count): = ltrim (rtrim (substr(l_str,1,l_n-1)));
l_str: = substr (l_str, l_n + 1);
END LOOP;
L_data return;
END;

/*
p_ParameterString is a string of the form 3, 6, 8, 9'
*/

PROCEDURE getEmpValues (p_ParameterString IN VARCHAR2, p_Cursor1 to REF_CURSOR)
AS


BEGIN


OPEN FOR P_Cursor1

SELECT *.
FROM EMP

WHERE EMP_ID IN (SELECT *)
OF THE (SELECT CAST (TEST.) (TEST_PKG.str2tbl (p_ParameterString) as myTableType) double)

);
END getEmpValues;

END TEST_PKG;

ARRAY TYPE MyTableType IS NUMBER;

This type must be created outside of the package as a SQL type if it must be used in a select statement.

Tags: Database

Similar Questions

  • ORA-01403: no given available problem when you use FETCH of AUTOMATIC LINE to fill

    ORA-01403: no given available problem when you use FETCH of AUTOMATIC LINE to fill out a form.

    1) has created a FORM on the use of assistants of EMP. This creates an AUTOMATIC FETCH of LINE
    NAME OF THE TABLE - EMP
    The PRIMARY KEY containing - P2099_EMPNO point
    Primary key column - EMPNO

    By default, automatic extraction has a "process Error Message' of"Unable to fetch line."

    (2) created an HTML region. In this region add
    text P2099_FIND_EMPNO element
    GET_EMP submit button
    The update branch the conditional branch created when the Create button to set P2099_EMPNO with & P2099_FIND_EMPNO.

    If I then turn the page, enter an employee in P2099_EMPNO number and press the GET_EMP button, the form is filled correctly. But if I get an employee who does not exist, then I get error oracle ORA-01403: no data found and no form but a message at the top of the page 'Action transformed '. I was expecting a blank form is displayed with the message 'Could not extract line.'

    In conditioning automated extraction so that it checks that the line exists first, I can work around that. Change the fetch EMP automated line so that it is conditional
    EXIST (SQL query returns at least one row)

    Select 'x '.
    from EMP
    where EMPNO =: P2099_EMPNO


    But this means that when the employee exists I must be get DB twice, once to the State, and then again for the extraction of the actual line.

    I can't change so I don't get the Oracle error, rather than work around for a above is there something? I wonder now if the automatic extraction of line is only supposed to be used when you bind a report to a form and that I should manually write the extraction process. The reason for which I don't have at the moment, it is that I'm trying to stick with the auto generation Assistant as I can.

    Any ideas?

    Thanks, Pete

    Pete:

    The process Assistant APEX (ARF, ARP etc) errors are generally not recoverable. The error encountered is simply displayed on a page by using the model of "Error Message. So as you said yourself, you create your own process line Fetch and have the opportunity to customize the management mistakes, or you paste a validation on the page to verify that a folder can be accessed for the views expressed.

    CITY

  • details of error: code 80071a 91 when you try to install the 'a security update for windows vista (kb2855844).

    details of error: code 80071a 91 when you try to install the 'a security update for windows vista (kb2855844).

    does anyone know how to go beyond this error?

    Thank you.

    Moved from Vista to install, upgrade and activate Forum.

    Take a look at this thread:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update/unable-to-install-updates-getting-error-code/27a21977-F964-4376-BFAB-2f29ea127c6a

  • Error 0 x 00000709 when you try to delete the print job and/or pritner.

    Original title: error 0 x 00000709.

    I have a dell laptop running windows vista Home premium SP1 with a 64-bit operating system.  I tried to remove a printer HP 1310 on my computer and it is stuck on "suppression of 1", I stop, then restart the printer spooler and now I have error 0 x 00000709 when you try to delete the print job and/or pritner.   What can I do to remove this printer.   I installed a Canon MX330 printer, but due to the printer HP being locked, I can't print with a PictBridge compatible printer.

    Hi LauraD,

    You can try to remove the printer from the safe mode and check.

    Step 1:

    You can read the following article to start in safe mode:

    Start your computer in safe mode

    Step 2: Remove the printer.

    You can read the following article to remove the printer.

    Add or remove a printer

    After deleting the printer, you can start in normal mode and try to install Canon printer.

    Hope this information is useful.

  • Satellite L300 - 29 X just crashes when you use some of the programs installed

    I bought a Toshiba L300 29 X for my daughter (30 years) help in its work of the University.
    Since we took this home and installed the OS it is questions. At first, I thought it was to do with Vista and so I bought the upgrade to Windows 7 and installed, but the same issues are there it just freezes when you use some of the programs installed.

    I tried restoring factory several times with Vista and still once I even made restoration to the first State to install W7 disk then updated from the web and then she still uses it for his United work and it freezes.

    There is nothing wrong with his work United as when using my laptop or even its partners a there aren't any issues or problems.
    Programs are in Office 2007 and it is the same copy I have in my laptop and they are both up-to-date.

    Its mobile partners is lower than its own specification and has less RAM so that to have only a single processor.
    I tried to install the W7 as a 32-bit and a 64 bit OS, and whenever there is any change in the problems with programs

    Can someone out there suggest a possible cause or same difficulty for am I at the end of my knowledge on this issue and my daughter is about to throw the thing out the window.

    Hello

    I think that the described issue could be related to a hardware problem, given that the laptop should not have problems running the Microsoft Office applications.

    In many cases, the s for laptop system could freeze due to a higher temperature.
    My girlfriend repeatedly asked for help because the laptop froze too.

    But the problem was linked to a higher temperature because cooling fans were clogged and cooling fans might not work correctly. She used the laptop sitting on the couch and there was not a lot of free space around the laptop to ensure good air circulation

    I want to say is that there are several reasons for such behavior annoying cell phone I think it would be wise to check the hardware first
    This should be done by the technician of the ASP.

  • Correct way to use Bind variables when you use an interface to MS SQL Server

    Hey,.
    I have some difficulty to find how to use bind variables in a view, when you use an interface to MS SQL Server. For some reason when I use an ApplicationModule who has a library of MS SQL Server JDBC loaded and I try to click on OK when you change the following query:

    SELECT kit_status, component_id
    OF numbered_inv
    WHERE trialname =: 1

    I get an error stating that ' SQL Query Error Message incorrect syntax near ':'. JDeveloper is compatible with SQL server for bind variable as this query works fine if I replace the: 1 with a Word to say "Test test".

    Thanks in advance

    Edited by: NullCheck December 15, 2010 14:06

    Use positional JDBC Style Binding to bind variables
    Try to use? Instead of:
    As shown here:
    http://www.Oracle.com/technetwork/developer-tools/jdev/multidatabaseapp-085183.html

  • When you use find on the page (ctrl + F on Windows) it is a message indicating the total number of matches. What does the first number?

    When you use find on the page (ctrl + F on Windows) it is a message indicating the total number of matches. What does the first number?
    I'm more interested in the case when this number is smaller than the total.

    Hello

    I think you mean the text stating "x of there matches", to the right of the box where you entered the search term.

    The first number ("x" in my example above) indicates the current entry highlighted on the page that matches the search phrase. If you use the upper and down arrows to navigate through the instances of this term on the page, you will see this number go up and down.

    I hope this helps, but if not please come back here and we can look at another solution for you.

  • Why always, I received management is not available when you use maps for the iPhone 6 and I live in the Qatar?

    Why I always get direction is not available when you use maps for the iPhone 6 more?

    Currently I live in the Qatar.

    Hi Alison, Sameh

    The reason why you see directions is not available, it's that for cards of Apple, turn-by-turn directions is not a feature that is available in the Qatar. You can search for places and satellite imagery
    Take a look at the link below for more details on what features are available in the Qatar.

    iOS 9 feature availability
    http://www.Apple.com/iOS/feature-availability/

    Nice day

  • Get "Not responding" when you use law ON the.

    Get "Not responding" after each keystroke when you use law on the.  I see the message and then after about 10-15 seconds, if you press the tab key.  Literally, it happens after every key stroke.  I've never had this happen before.  My laptop has Windows 8.  At this rate, it'll take a week to complete my tax return.

    Hello

    Thank you for your response.

    I'm sorry for the late reply.

    I appreciate your efforts to resolve the issue.

    I suggest you run the system file checker (SFC) and see if it helps.
    Reference:
    Use the System File Checker tool to repair missing or corrupted system files
    http://support.Microsoft.com/kb/929833

    System File Checker is a Windows utility that allows users to find corruptions in Windows system files and restore the damaged files.

    Note: It can ask the difficulty Windows installation DVD and allowing SFC to do more than minor repairs. Could some of the files saved on your computer are deleted when fixing corrupted files.

    Please keep us updated on the status of the issue.

    Thank you

  • I get an error-invalid data type

    DECLARE
    CURSOR med_rec_cur
    IS
    SELECT *.
    OF temp_records_med;

    p_success NUMBER;
    strQuery VARCHAR2 (10000);
    v_count NUMBER;
    v_filename temp_records_med.filename%TYPE;

    TYPE med_rec_tab IS TABLE OF temp_records_med % ROWTYPE;

    ErrNum NUMBER;

    Slno_tab TYPE IS a TABLE OF VARCHAR2 (100);

    v_med_rec_tab med_rec_tab;
    dml_errors EXCEPTION;
    v_slno NUMBER;
    v_all_slno VARCHAR2 (1000);
    v_slno_tab slno_tab;
    tba_slno temp_records_med.slno%type;

    BEGIN
    OPEN med_rec_cur.

    LOOP
    BEGIN
    EXTRACTION med_rec_cur
    LOOSE COLLECTION v_med_rec_tab LIMIT 1000;

    FORALL I IN 1... v_med_rec_tab. COUNT SAVE EXCEPTIONS
    INSERT INTO meddetail
    VALUES v_med_rec_tab (i)
    RETURN slno BULK COLLECT INTO v_slno_tab;

    EXCEPTION
    WHEN dml_errors
    THEN
    v_all_slno: = ', '. To_char (v_all_slno);
    END;

    EXIT WHEN med_rec_cur % NOTFOUND;
    END LOOP;

    CLOSE Med_rec_cur;

    INSERT INTO BOSSDRAGON - INVALID DATA TYPE
    SELECT * FROM TEMP_RECORDS_MED WHERE SLNO NOT IN (SELECT tba_slno FROM)
    (TABLE (CAST (v_slno_tab AS slno_tab) tba_slno))) ;

    END;

    Published by: user8731258 on Sep 6, 2010 23:14

    Casting will not change the fact that you have a local collection type in a SQL statement, which is not allowed. You can create a stand-alone type with CREATE TYPE? Or use something like SYS. DBMS_DEBUG_VC2COLL that is already defined.

    You don't need a CAST explicitly in the TABLE expressions after around Oracle 8i.

  • Error 80071 has 30 when you try to install the updates.

    What does it mean error code a 80071, 30 when you try to install the updates

    Hello

    1. are you able to install the updates as soon as possible?

    2 has there been recent changes made on the computer before the show?

    I suggest you to please follow the provided steps and update us with the results.

     

    Method 1: Perform the clean boot and try to install the updates.

    To help resolve the error message, you can start Windows Vista or Windows 7 by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

     

    Please note: After troubleshooting, be sure to start your computer in normal mode by following step 7.

     

    Method 2: Run (CheckSur.exe) system update readiness tool

    Download and run the system update readiness tool. This tool runs an ad hoc analysis of inconsistencies that might prevent future maintenance operations. For more information about how to download and run the CheckSur.exe tool, click on the number below to view the article in the Microsoft Knowledge Base:

    http://support.Microsoft.com/kb/947821

    (947821) description of the preparation tool system update for Windows Vista for Windows Server 2008, for Windows 7 and for Windows Server 2008 R2

    Try to install updates again.

    Method 3: How to reset Windows Update components?

    http://support.Microsoft.com/kb/971058

    Registry warning

    To do: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    322756 (http://support.microsoft.com/kb/322756/)

    How to back up and restore the registry in Windows.

    Method 4: Scan of the file system (CFS) auditor.

    Perform a scan of the checker (SFC) system files on your computer. SFC tool scans system files and replaces incorrect versions of system files by using the correct versions.

    See the following article for more information on using SFC tool to troubleshoot missing or corrupted system files:

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    You can also check the updates failed.

    a. open Windows Update by clicking on the button start. In the search box, type Update, and then in the list of results, click Windows Update.

    (b) in the left pane, click view update history.

    I hope that helps!

  • Error 0 x 80070424 when you try to install the recommended updates or custom

    Help, please!

    This error message when:

    1. in Internet Explorer, choose Tools-> Windows Update

    2 Update site analyzed successfully updates

    3. offer to install via Express or custom

    4. after the selection of * either * of these options, the next screen shows:

    >>

    The website has encountered a problem and cannot display the page you are trying to view. The options provided below may help you solve the problem.

    For self-help options:

    To support options:

    Hello

    Method 1:
    I suggest you try the procedure described in the link and check if it helps.
    Error 0 x 80070424 occurs when you use Windows Update, Microsoft Update, or Windows Firewall
    http://support.Microsoft.com/kb/968002/en-us
    Method 2:
    If the problem persists, you can try the procedure described in the link and check.
    Cannot install updates in Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2
    http://support.Microsoft.com/kb/2509997
    Important: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:
    322756 (http://support.microsoft.com/kb/322756/)
    How to back up and restore the registry in Windows
    For more information, please see the link.

    "Internet Explorer cannot display the webpage" error in Internet Explorer
    http://support.Microsoft.com/kb/956196

    Warning: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.

    NOTE: Turning off Windows Firewall may make your computer (and your network, if you have one) more vulnerable to damage caused by worms or hackers.


    I hope this information helps!
  • error 0 x 81000019 when you try to run the Windows backup utility

    original title: 0 x 81000019... Attention Microsoft

    Error code 0 x 8100019 and a sub-code when you use the utility backup of Windows 7... Finally resorted to re - format and re-installation of Win 7, then ran backup before installing the Microsoft updates, which was a success.

    Downloaded and installed the Microsoft updates and then run backup... back to the original problem. Logically, Microsoft, it appears that one or more of your updates has interfered with the Windows 7 backup utility... my time is limited and I paid for the product rather than be given to the problems with the product to sift... may your Tech run this through clean install and add each update to identify what, if any. are the cause of the problem?

    Hello leighbordignon,

    I suggest you follow the link below and look at the steps suggested by Sneha, I see that this has contributed to many users with the same question:

    http://social.technet.Microsoft.com/forums/en-us/w7itprogeneral/thread/fce6950d-C06D-4dd0-A850-67022db4fe04

    Thank you
    Irfan H, Engineer Support Microsoft Answers.

  • Unexpected ' digital or the error value "when you use CAST COLLECT

    I have a problem with string using CAST aggregation / COLLECT and function to_string described on various sites around the net, including AskTom and http://www.oracle-developer.net/display.php?id=306.

    I get "digital or value error: character string buffer too small", but cannot see what limit I'm exceeding.

    I implemented a simple test case to highlight this problem I pasted below.

    The error does not come from the function to_string itself (otherwise, I expect that we would see "TO_STRING threw an exception" in the error message that is returned).

    Popular thoughts,

    Thank you, Andy

    SQL*Plus: Release 10.1.0.4.2 - Production on Tue Jun 15 09:56:53 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> CREATE TYPE table_of_varchar2 AS TABLE OF VARCHAR2(32000);
      2  /
    
    Type created.
    
    SQL> CREATE OR REPLACE FUNCTION to_string (
      2              nt_in IN   table_of_varchar2
      3      ,       delimiter_in    IN VARCHAR2 DEFAULT ',')
      4      RETURN VARCHAR2
      5      IS
      6          l_idx   PLS_INTEGER;
      7          l_str   VARCHAR2(32767);
      8          l_dlm   VARCHAR2(10);
      9
     10      BEGIN
     11
     12          l_idx := nt_in.FIRST;
     13          WHILE l_idx IS NOT NULL LOOP
     14              l_str := l_str || l_dlm || nt_in(l_idx);
     15              l_dlm := delimiter_in;
     16              l_idx := nt_in.NEXT(l_idx);
     17          END LOOP;
     18
     19          RETURN l_str;
     20      EXCEPTION
     21          WHEN OTHERS THEN
     22              raise_application_error(-20000
     23                                  ,   'TO_STRING raised an exception. '||
     24                                      'The reported error was: '||sqlerrm);
     25     END to_string;
     26  /
    
    Function created.
    
    SQL> DECLARE
      2      l_longstring varchar2(32000);
      3  BEGIN
      4      SELECT  to_string(CAST( COLLECT( substr(object_name,1,1) ) AS table_of_varchar2 ) )
      5      INTO    l_longstring
      6      FROM    all_objects
      7      WHERE   rownum < 2001;
      8
      9  EXCEPTION
     10      WHEN OTHERS THEN
     11          raise_application_error(-20001
     12                ,   'The anonymous block raised an exception: '||
     13                    sqlerrm||'. '||DBMS_UTILITY.format_error_backtrace);
     14  END;
     15  /
    
    PL/SQL procedure successfully completed.
    
    SQL> DECLARE
      2      l_longstring varchar2(32000);
      3  BEGIN
      4      SELECT  to_string(CAST( COLLECT( substr(object_name,1,1) ) AS table_of_varchar2 ) )
      5      INTO    l_longstring
      6      FROM    all_objects
      7      WHERE   rownum < 2002;
      8
      9  EXCEPTION
     10      WHEN OTHERS THEN
     11          raise_application_error(-20001
     12                ,   'The anonymous block raised an exception: '||
     13                    sqlerrm||'. '||DBMS_UTILITY.format_error_backtrace);
     14  END;
     15  /
    DECLARE
    *
    ERROR at line 1:
    ORA-20001: The anonymous block raised an exception: ORA-06502: PL/SQL: numeric
    or value error: character string buffer too small
    ORA-06512: at line 1. ORA-06512: at line 1
    ORA-06512: at line 4
    ORA-06512: at line 11

    Hi André,.

    You have reached the limit of VARCHAR2 in SQL, which is 4000. The concatenated string is much longer. You get an even more informative error message if you deposit 20 to 24 lines in the to_string function.

    Kind regards
    Rob.

  • Why my windows phone says he can not download the file type when you try to install the firefox browser?

    I have no restrictions on the phone. I tried to be sure and use the features of security as... Safe search, cookie and other block. He repeated, however, unable to download the file type when I try and install one of the browsers to date. What is interesting to say the least. Because my browser already uses the version more up-to-date. I have internet explore using a nokia windows 8

    Hello, the mobile version of firefox is not available on the windows phone platform: Firefox work on my mobile?

    There was technical and legal obstacles in the app store initially that discouraged mozilla to start any developments in this direction. I do not know the current situation, but given that mozilla is now focusing its efforts on the creation of firefox os as a platform open source web-based, I doubt you'll see firefox on your windows phone device in the foreseeable future...

Maybe you are looking for