Problem with "select * from table" for dynamic IN the list

I have a 'for loop' based a query that does not work. The query is supposed to return the name of the table, the data type and the name of the column in the columns poses a number of name filters. The problem I have is when I run the query into a TOAD with:

schema_list value SCOTT, MED and the clause of 'in' as ' to (select * from table (DATAPUMP_UTIL.in_list_varchar2 (:schema_list))))»

The query returns the expected lines.

When I have it in my code as shown below it returns no rows. I don't know what hurts me, but any help would be great! I'm on Oracle 11.1.0.6.0.
PROCEDURE export_schema_ondemand (schema_list VARCHAR2, encrypt_file NUMBER default 0, mask_sensitive_data NUMBER default 0) IS  
    ...
    schema_list_t := my_package.in_list_varchar2(schema_list);
    ... 
    for c1 in
       (
        with ok_to_mask as (
        select 
            owner,
            table_name, 
            column_name
        from   
           all_tab_columns
        where
            owner in (select * from table(schema_list_t))
        minus
        (SELECT 
            c.owner,
            p.table_name,
            cc.column_name
        FROM 
            all_cons_columns cc, 
            all_constraints p,
            all_constraints c
        WHERE 
            c.owner in (select * from table(schema_list_t))
            c.constraint_type = 'R'
            AND p.owner = c.r_owner
            AND p.constraint_name = c.r_constraint_name
            AND cc.owner = c.owner
            AND cc.constraint_name = c.constraint_name
            AND cc.table_name = c.table_name
        UNION ALL
        SELECT 
            c.owner,
            cc.table_name,
            cc.column_name
        FROM 
            all_cons_columns cc,
            all_constraints p,
            all_constraints c
        WHERE
            p.owner in (select * from table(schema_list_t))
            AND p.constraint_type in ('P','U')
            AND c.r_owner = p.owner
            AND c.r_constraint_name = p.constraint_name
            AND c.constraint_type = 'R'
            AND cc.owner = c.owner
            AND cc.constraint_name = c.constraint_name
            AND cc.table_name = c.table_name))
        select 
            atc.table_name as mask_tab, 
            atc.column_name as mask_col, 
            atc.data_type as mask_type
        from   
            all_tab_columns atc,
            ok_to_mask otm
        where
            atc.owner = otm.owner
            and atc.table_name = otm.table_name
            and atc.column_name = otm.column_name
            and atc.owner in (select * from table(schema_list_t))
            and 
            (
            atc.column_name like '%LAST%NAME%'
            or atc.column_name like '%FIRST%NAME%'
            or atc.column_name like '%NAME_LAST%'
            or  atc.column_name like '%NAME_FIRST%'
            or  atc.column_name like '%ENAME%'
            or atc.column_name like '%SSN%'
            or atc.column_name like '%DOB%'
            or atc.column_name like '%BIRTH%'
            )
            and atc.column_name not like '%PHYSICIAN_%'
            and atc.column_name not like '%DR_%'
            and atc.column_name not like '%PROVIDER_%'
            and atc.column_name not like 'PRESCRIBER_%'     
       )
      loop
         ...

FUNCTION in_list_varchar2 (p_in_list  IN  VARCHAR2)  RETURN VARCHAR2_TT is

    l_tab   VARCHAR2_TT := VARCHAR2_TT();
    l_text  VARCHAR2(32767) := p_in_list || ',';
    l_idx   NUMBER;
        
BEGIN
    LOOP l_idx := INSTR(l_text, ',');
        EXIT WHEN NVL(l_idx, 0) = 0;
        l_tab.extend;
        l_tab(l_tab.last) := TRIM(SUBSTR(l_text, 1, l_idx - 1));
        l_text := SUBSTR(l_text, l_idx + 1);
    END LOOP;

    RETURN l_tab;
        
END in_list_varchar2;
Published by: BluShadow on June 29, 2011 16:11
addition of {noformat}
{noformat} tags.  PLEASE READ {message:id=9360002} TO LEARN TO DO THIS YOURSELF.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

Hello

If you have a query that works well when you launch it directly, and that breaks down when you start with a procedure, this can be a problem of privileges.

Points of view ALL_ * shows only the objects you have access, but using a procedure, privileges must be granted directly to the user and not with a role.

You should check the SELECT privileges to your user through roles and give them directly to the user.

Hope this will help.

Sylvie

Tags: Database

Similar Questions

  • Oracle 10g - problem with "DELETE from TABLE WHERE ID in (1,2,3)" (use cfqueryparam)

    Hello, everyone.

    I have problems with executing a DELETE statement on an Oracle 10 g server.

    DELETE 
    FROM tableA
    WHERE ID in (1,2,3)
    

    If there is only a single ID for the IN clause, it works.  But if more than one ID is provided, I get an error message "SQL command" not correctly completed.  Here's the query as CF:

    DELETE 
    FROM TRAINING
    WHERE userID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(form.userID)#">
         AND TRAINING_ID in <cfqueryparam value="#form.trainingIDs#" cfsqltype="CF_SQL_INTEGER" list="yes">
    

    Someone at - it works with Oracle that can help me with this?  I'm a developer experienced in MS - SQL; Oracle is new to me.

    Thank you

    ^_^

    So much worse... a colleague just told me I should always use parentheses around the values in the IN clause.

  • Problem with copy paste function (for images) using the TinyMCE editor

    Can not copy paste images (a document - text Copies OK) to the tinyMCE editor in Windows 8. Seems to be the specific question of operating system.

    Use the tinyMCE editor for info on the download Web site. Copy-paste function works very well on a Windows7 machine

    Hi Anand,

    I would be grateful if you can help me with the following information related to the TinyMCE editor:

    1. What is the Web browser that you use to copy and paste images via the application editor TinyMCE?
    2. What exactly happens when you try to copy and paste images using the editor? You receive an error message?

    This problem may occur because of the compatibility of the browser with the TinyMCE editor.

    Check out these links and check if the suggestions help you to solve the problem:

    http://www.TinyMCE.com/forum/viewtopic.php?PID=34916

    http://www.TinyMCE.com/develop/bugtracker_view.php?id=6075

    If the problem is specific to the TinyMCE editor, you can also contact the support of TinyMCE:

    http://www.TinyMCE.com/enterprise/support.php

    Please let us know if you need more help on this issue. Otherwise, feel free to ask for more queries on Windows.

  • Problem with cable support announced for Germany, are the cables carrying Austrian also affected?

    I read about a problem on older charge cable which are sold until 2015. In some cases electrical discharges can occur and I wanted to ask the Austrian weather products are also affected.

    It seems very likely.

    Here are instructions from Apple on the reminder.

    https://www.Apple.com/UK/support/usbadapter-European/

  • I have a problem with hotmail from microsoft, they have blocked my hotmail a/c, saying that unusual activy was noted.

    How is that ms send me texts, but I never freceive them

    I have a problem with hotmail from microsoft, they have blocked my hotmail a/c, saying that unusual activy was noted.

    1} I have not myself sent messages in my sent mail, I spoke to microsoft, their response was ok reset your passsword we will send you a code to your mobile phone that write you it in the box that allows you to reset your password.

    {my mobile is a nokia model last slidder 2220 series and receive sms and text 2} microsoft has the correct number then why I do not receive the code of

    Microsoft?

    help please

    Hotmail is part of Windows Live takes Center.

    Your account has been blocked because you have somehow (according to Hotmail) violated the agreements of the end user.

    Post here or in the Microsoft forums will help you.

    You deal personally with Hotmail.

    Here are 2 links that you use...

    1. the present link tells you what you need to do. It is not a Q & A. Some instructions:

    Your account has been temporarily blocked:

    http://windowslivehelp.com/solution.aspx?SolutionID=f172cbee-3c73-4506-8a1d-4e6e82adb846

    2. this link is for you to ask questions.

    http://windowslivehelp.com/forums.aspx?ProductID=1

    Don't waste your time here. Stay in Hotmail forums.

  • I'm having a problem with a sound used for Norton ccSvcHst.exe process. And perhaps dwm.exe

    I'm having a problem with a sound used for Norton ccSvcHst.exe process. I have all the dates of the last mounted and I roughly 1 000 000 errors page an hour and the hard drive of my computer is crazy with me doing nothing. Norton has been included in the software package supplied with the computer. so I hope that support you. What can I do to calm my computer runs to stop this service... I have also about 500 000 for the service dwm.exe. What could cause this?

    Hi dude, on average

    A. from when what happens?

    B. recent changes made on your computer?

    C. you get any error message?

    First of all, I suggest you to uninstall and reinstall Norton using the Norton Utilities disk and check if the problem persists.

    Second, you may have to perform an auditor of the system files on your computer in order to replace the files corrupted on your computer.

    Open an elevated command prompt. To do this, click Start, click programs, accessories principally made, right-click Guest, and then click Run as administrator. If you are prompted for an administrator password or a confirmation, type the password, or click on allow.

    Type the following command and press ENTER: sfc/scannow

    The sfc/scannow command. analyzes all protected system files and replaces incorrect versions with appropriate Microsoft versions.

    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

    Bindu S - Microsoft Support
    [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

  • Insert into MDQ_OLD select * from table (lt_monitorMdq);

    I'm trying to insert into a table that has only a single column, which is a column of a user defined type (UDT). The UDT is nested, that is one of the attributes of the UDT is an another UDT.

    I aim to insert into the table like this pseudo-code:

    INSERT INTO T1 SELECT * FROM THE UDT;

    CREATE TABLE MDQ_OLD (myMDQ UDT_T_MONITOR_MDQ)

    NESTED TABLE myMDQ

    (T1_NEW) ACE STORE

    THE NESTED TABLE MONITOR_MDQ_PRIM_RIGHTS

    STORE AS T2_NEW);

    The MONITOR_MDQ_CLI procedure. Read below returns the parameter lt_monitorMdq which is a UDT type as announced. The statement "insert into select MDQ_OLD * table (lt_monitorMdq);" fails, while the second insert statement works.

    Is it possible to get the first statement of work?

    I'm on Oracle 11 g 2.

    DECLARE

    lt_monitorMdq UDT_T_MONITOR_MDQ;

    BEGIN

    MONITOR_MDQ_CLI. Reading (TRUNC (SYSDATE),

    TRUNC (SYSDATE),

    NULL,

    NULL,

    "MILLION BTU.

    lt_monitorMdq); -Note lt_monitorMdq is an OUT parameter

    -This insert does not work

    Insert into MDQ_OLD select * from table (lt_monitorMdq);

    BECAUSE me in 1... lt_monitorMdq.count

    LOOP

    Dbms_output.put_line ('lt_monitorMdq: ' | .mdq_id lt_monitorMdq (i));

    -This integration works

    INSERT INTO MDQ_OLD (MYMDQ)

    VALUES (UDT_T_MONITOR_MDQ (UDT_R_MONITOR_MDQ)

    lt_monitorMdq (i) .gasday,

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    () UDT_T_MONITOR_MDQ_PRIM_RIGHT

    () UDT_R_MONITOR_MDQ_PRIM_RIGHT

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    (NULL)));

    END LOOP;

    END;

    have you tried:

    INSERT INTO MDQ_OLD (myMDQ) VALUES (lt_MonditorMDq);

    curiosity:

    Is there a particular reason, why you have created a table with a single column of type UDT instead of:

    CREATE TABLE... OF UDT_T_MONITOR_MDQ;

    I can tell you from experience that using a nested table, you can easily query the data in the nested table.

    MK

  • problem with my laptop asking for the administrator password or power on password

    I have the same problem with my laptop asking for the administrator password or power on password. It is a compaq presario cq61. It happened when my hard drive failed and was not used for a long time. With the password, any help would be much appreciated. It says system turn off after a few trials with the key: 55427586

    Hello

    Try to enter: 40585508

    Kind regards

    DP - K

  • Cisco VPN problem with security update KB3057839 for Vista

    Someone had problems with any connection Cisco VPN works after the installation of update of security KB3057839 for Vista? When this update is installed, the pop-up to enter the password and user id not come, need to use the Task Manager to close the program. The first time I went back to the restore point to get my VPN to work, this time I tried to reinstall the VPN but that doesn't work anymore. I started to uninstall updates (had 7 of them), when I got to it, KB3057839, the VPN began working again.

    Mike

    See this on the real issue:

    http://www.chiark.greenend.org.uk/~sgtatham/PuTTY/wishlist/Vista-update-breaks-config.html

    It turns out that the logon dialog box is invisible, but still, it agrees to enter you your password and LOG you!

  • I get a box that says, please verify your billing information. We discovered a problem with your last payment for creative cloud. Go online to manage your account and check your billing account. 19 days remaining. What is c?

    I get a box that says, please verify your billing information. We discovered a problem with your last payment for creative cloud. Go online to manage your account and check your billing account. 19 days remaining. What is c?

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • I have a problem with corruption.  How can I change the timeline on an existing project.  Each image is moved about 2.5 min.;  My preferences are for 180 frames.  It does not seem to consider one after the fact.  Is it possible to copy the entire thing on

    I am new to use the forums.  How to start a discussion?  The ICO next which is grayed out.

    I have a problem with corruption.  How can I change the timeline on an existing project.  Each image is moved about 2.5 min.;  My preferences are for 180 frames.  It does not seem to consider one after the fact.  Is it possible to copy the whole thing and put it in a new, m not corrupted project?

    Hello and welcome.

    I feel for you after reading your story, however, it that are supposed to do? It is a forum for Dreamweaver and to my knowledge, Dreamweaver has no functionality called the chronology.

    Could you please explain the problem so that we can understand?

  • Problems with deployment of GPOs for the Flash player 10,2,159,1 msi

    Hi all

    I had problems getting 10,2,159,1 msi to deploy via GPO I did all the other versions until this one, which worked well.

    When you add the MSI file to the existing GPO the following error on the server appers "no package in the installation of software in the Active Directory data does meet this criterion.

    This adds the msi to the Group Policy object, but it will not install.

    I tried runing the MSI manually but when installing, msi errors out and don't fail to install flash.

    Server 2008r2 deployment machines XP SP3 and win 7 pro.

    Deploy only IE active x file being used 'install_flash_player_10_active_x.msi '.

    Anyone else having this problem?

    Thank you very much

    Richard

    Sorry for the delay, it was ultimately a problem with our communication server not correctly when the Group Policy object creation took place.

    Also, after the new version of Flash in this version, it's the previous version that caused this error.

    You must run restart flash removal tool, run flash removal too new and then install the new version of flash by either EXE or MSI.

  • Select * from TABLE (tst_name_pw.list);

    Windows XP + 10.2.0.1.0 Oracle

    I did tst_name_pw desc and show as below:

    PROCEDURE Argument name default input/output Type
    ------------------------------ ------------------------------ ---------------------------------------------------------- --------- -------
    (FUNCTION) < return value > TABLE LIST unknown


    I have don see the table as tst_name_pw or the list name in the database.
    Anyone it clarify it please?
    Thank you

    Hello

    782150 wrote:
    Windows XP + 10.2.0.1.0 Oracle

    I did tst_name_pw desc and show as below:

    PROCEDURE Argument name default input/output Type
    ------------------------------ ------------------------------ ---------------------------------------------------------- --------- -------
    LIST (FUNCTION) TABLE OF strangers

    I have don see the table as tst_name_pw or the list name in the database.
    Anyone it clarify it please?
    Thank you

    It seems that tst_name_pw is a package, not a table.

  • I have to remove the duplicate files, but having problems by selecting more than one file in the player at the time.

    I have to remove the duplicate files, but having problems by selecting more than one file in the player at the time. How can I select multiple files at the same time so I can just delete them. I used to be able to do this in previous versions of Media Player, but this function seems now blocked or unavailable. The problem is this: through previous use of media player, it plays all my multimedia files several times whenever a device support has been added. He would try to save the files on my main drive, but since there is not enough room this would save the files somewhere else. This happened several times, I suppose, because when I upgraded my computer and a media scan was conducted he found duplicates of all my media various times of at least 6-8. I've consolidated since my plates on 3-disc multi to, but have now records duplicated hundreds and thousands of duplicate media files. Previous versions of Media Player would allow me to select all files and then delete them both of the reader, but also from my hard drive. So now I'm stuck with more than 300 GB of duplicate media I have to search line by line through all my hard drives to find each duplicate both, unless I can get media player to do what it can. Any help in this area would be appreciated.

    Hello

    1. did you of recent changes on the computer?

    2. is Windows media player files in double creation during playback of music files?

    To delete duplicate entries, click on another feature tab in the drive (for example the current playback), and then click library.

    If this does not remove duplicates from your library, you can use the Add to library dialog box to search computer to analyze a file on your computer the duplicate entries not valid-pointing. The player will remove invalid entries in your library that point to files that no longer exist in the folder.

    Complete the steps above for files that are stored in the hard disks.

    Method 1: Use the add to Library dialog box search for computers

    (a) start Windows Media Player.

    (b) press F3 on your keyboard to open Add to the library of the find computers dialog box.

    (c) click the Browse button to locate the folder on your computer so that your library contains invalid entries. Specify the location of the folder in the box look in.

    If you are not sure what duplicate in your library entry is not valid, you can add a path column to display in your library. Specify the folder on your computer that corresponds to the path not valid file displayed in your library.

    (d) click on the Search button.

    The player will search for digital media files and playlists in the folder that you specify and remove invalid entries in your library that point to files that no longer exist in the folder. If not valid in double entries point to other folders on your computer, repeat this procedure, specify a different folder every time.

    If only a small number of duplicate entries exist, you can delete those invalid manually by right-clicking on the invalid entry, and then clicking Delete .

    For large double-number of entries in your library (or if all your library is duplicated), it might be better to create a new library and delete the files.

    Method 2:

    After you remove the duplicate entries, run the troubleshooting of Windows Media Library settings to solve this problem.

    Open the troubleshooter in Windows Media Library

    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-library-Troubleshooter

    Let us know the results.

    I hope this helps.

  • AI CS5 keyboard shortcuts do not work. I restarted and have no other problem with my MacBook Pro. What is the problem?

    AI CS5 keyboard shortcuts do not work. I restarted and have no other problem with my MacBook Pro. What is the problem?

    Bill,

    The following is a general list of things, try when the question is not in a specific file, and when it is not caused by problems with opening a file from external media. You tried/made some of them already; 1 and 2) are easier for temporary strangenesses and 3) and 4) specifically preferences might be corrupt); ((5) is a list in itself and 6) is the last resort.

    If possible / there is, you must record a current work first, of course.

    (1) close Illy and open again.

    (2) restart the computer (you can make up at least 5 times);

    (3) close Illy and press Ctrl + Alt + Shift / Cmd + Option + shift during startup (easy, but irreversible);

    4) move the folder (follow the link with this name) with closed Illy (more tedious but also more thorough and reversible), for CS3 - CC you can find the file here:

    https://helpx.Adobe.com/Illustrator/KB/preference-file-location-Illustrator.html

    5 look through and try the relevant among the other options (click on the link with that name, item 7) is a list of the usual suspects among other applications which can disturb and confuse Illy, point 15) applies to the maybe CS5, CS6 and CC);

    Even worse, you can:

    (6) (check the box to delete the preferences), run the cleanup tool (if you have CS3/CS4/CS5/CS6/CC) to uninstall and reinstall.

    http://www.Adobe.com/support/contact/cscleanertool.html

Maybe you are looking for

  • Re: Questions about reinstalling Windows XP

    Hello...I have a portable satellite, and I must confess that I do not understand why everything should be formatted when reinstalling the system.I have several questions if someone could help please. Is it possible to reinstall Windows without losing

  • Why the windows installer opens whenever I start Outlook Express?

    Why is open MSI whenever I start Outlook Express, the only way to kill this process via ctrl/alt/del, when I try to stop the process also kills outlook.

  • XPS 8700 not enough memory (long live RAM)

    When I try to save the document recorded at 600 dpi I get "is not enough (live RAM) memory available on the computer to complete the scan. If Please lower the setting of the resolution of the scan and try again. » I have a lot of RAM and running the

  • ACL to restrict the SCP Protocol

    Dear Sir I want to allow the SCP Protocol on my Cisco devices (routers, switches, wap,...) for a single host (a server that backs up the configuration by SCP). But if I'm not mistaken, the SCP Protocol through the SSH protocol. So, do you know if it

  • Consumer, Bloomberg blackBerry Storm Smartphones - Landscape Mode

    Downloaded the Bloomberg Consumer since the Blackberry AppStore app yesterday... when it was first installed, it displays the application in landscape and it was awesome!  now, every time I raise it displays in portrait mode and landscape when I turn