help the collection and immediate execution

Hello

I have problems with this code:
DECLARE
   l_stmt   VARCHAR2 (11111);

   TYPE strarrt
   IS
      TABLE OF VARCHAR2 (500)
         INDEX BY BINARY_INTEGER;

   strarr   strarrt;
BEGIN
   l_stmt :=
      'SELECT      ''UPDATE ''
           || cols.table_name
           || '' SET ''
           || cols.column_name
           || '' = '' '' WHERE ''
           || cols.column_name
           || '' IS NULL;''
    FROM   (SELECT   column_name, uc.table_name
              FROM   USER_CONSTRAINTS UC, USER_CONS_COLUMNS UCC
             WHERE       UCC.TABLE_NAME = UC.TABLE_NAME
                     AND UCC.CONSTRAINT_NAME = UC.CONSTRAINT_NAME
                     AND UC.CONSTRAINT_TYPE = ''P''
                     AND UCC.TABLE_NAME LIKE ''B136T%''
                     AND ucc.table_name NOT IN
                              (''B136T017'',
                               ''B136T018'',
                               ''B136T0029'',
                               ''B136T034'',
                               ''B136T450'')) keyz,
           (SELECT   column_name, table_name
              FROM   user_tab_cols
             WHERE   TABLE_NAME LIKE ''B136T%'' AND data_type LIKE ''%CHAR%'') cols
   WHERE   keyz.column_name = cols.column_name
           AND keyz.table_name = cols.table_name;';

   EXECUTE IMMEDIATE l_stmt INTO   strarr;

   FOR i IN strarr.FIRST .. strarr.LAST
   LOOP
      DBMS_OUTPUT.put_line (strarr (i));
   END LOOP;
END;
The error is

Error on line 2
ORA-06550: Line 37, column 36:
PLS-00597: expression 'STRARR' in the list IS of the wrong type
ORA-06550: Line 37, column 4:
PL/SQL: Statement ignored

Any ideas?

Published by: user10962462 on 27.03.2010 19:24

Try

DECLARE
   l_stmt   VARCHAR2 (11111);

   TYPE strarrt
   IS
      TABLE OF VARCHAR2 (500)
         INDEX BY BINARY_INTEGER;

   strarr   strarrt;
BEGIN
   l_stmt :=
      'SELECT      ''UPDATE ''
           || cols.table_name
           || '' SET ''
           || cols.column_name
           || '' = '''' '''' WHERE ''
           || cols.column_name
           || '' IS NULL;''
    FROM   (SELECT   column_name, uc.table_name
              FROM   USER_CONSTRAINTS UC, USER_CONS_COLUMNS UCC
             WHERE       UCC.TABLE_NAME = UC.TABLE_NAME
                     AND UCC.CONSTRAINT_NAME = UC.CONSTRAINT_NAME
                     AND UC.CONSTRAINT_TYPE = ''P''
                     AND UCC.TABLE_NAME LIKE ''B136T%''
                     AND ucc.table_name NOT IN
                              (''B136T017'',
                               ''B136T018'',
                               ''B136T0029'',
                               ''B136T034'',
                               ''B136T450'')) keyz,
           (SELECT   column_name, table_name
              FROM   user_tab_cols
             WHERE   TABLE_NAME LIKE ''B136T%'' AND data_type LIKE ''%CHAR%'') cols
   WHERE   keyz.column_name = cols.column_name
           AND keyz.table_name = cols.table_name';

   EXECUTE IMMEDIATE l_stmt BULK COLLECT INTO   strarr;

   FOR i IN strarr.FIRST .. strarr.LAST
   LOOP
      DBMS_OUTPUT.put_line (strarr (i));
   END LOOP;
END;

Tags: Database

Similar Questions

  • Changing table via the package with immediate execution (problem)

    Hello

    I have a unusual problem. I have a package that contains the procedure that via execute immediate statement, creates a table on which he performs different actions for example:

    -alter table some_owner.dummy_table noparallel

    -create index some_owner.idx_name on some_owner.dummy_table (column)...

    But I only managed to run move and create synonym table/public via execute immediate statement. Actions as alter table and create index fails with error ORA-01031: insufficient privileges.

    Note If call these commands outside the package (a simple script) this all done OK.

    I found a way, where I set the AUTHID CURRENT_USER command create package statement. In this way all the actions executed OK.

    I wonder why I can't change the table via the package with immediate execution on a table that is in the tablespace "SOME_TABLESPACE" and the title of owner "SOME_OWNER", without putting the AUTHID command on the package.

    There must be a problem why a package cannot change the table which is owned by the user 'SOME_OWNER '.

    All useful responses would be appreciated.

    I have a unusual problem.

    No - you don't have. This question has been answered SEVERAL times on this forum and others.

    But I only managed to run move and create synonym table/public via execute immediate statement. Actions as alter table and create index fails with error ORA-01031: insufficient privileges.

    OK - your username doesn't have privileges to do these operations or only received privileges through roles.

    Roles are DISABLED in named PL/SQL blocks that use of the AUTHOR's rights.

    Note If call these commands outside the package (a simple script) this all done OK.

    I found a way, where I set the AUTHID CURRENT_USER command create package statement. In this way all the actions executed OK.

    Of course - the roles are NOT disabled in named PL/SQL blocks that use the rights of the APPELLANT or in anonymous blocks.

    I wonder why I can't change the table via the package with immediate execution on a table that is in the tablespace "SOME_TABLESPACE" and the title of owner "SOME_OWNER", without putting the AUTHID command on the package.

    Well now you know!

  • difference btw dbms_sql.execution and immediate execution

    Hello

    IAM using 10g, difference btw immediate.please dbms_sql.execution and execution to tell me.

    797525 wrote:

    IAM using 10g, difference btw immediate.please dbms_sql.execution and execution to tell me.

    SQL all (and all the anonymous PL/SQL blocks) are analyzed by Oracle as a SQL cursors. These cursor structures are stored in the Shared Pool in the SGA (shared memory area which are essentially the "brain" of the database instance).

    Once a cursor was created for a statement SQL, how to use and interface with this SQL cursor on the server (from the point of view of the customer)?

    We use on the client side, a calling interface (or API) that allows our code to interact with this SQL cursor on the server. This interface can be ODBC. Or BDE. Or ADO. Or many other 3-4 letters for database interfaces.

    PL/SQL is also a language of 'customer' from a SQL perspective. Such as Java and c#, the code PL/SQL will be calls to the SQL engine to analyze and create SQL cursors.

    Of course, PL/SQL differs in 2 areas. It runs in the process of the Oracle server. It is the neighbour of the SQL engine.

    For this reason, PL/SQL is much more perfectly integrated with the SQL than Java or c#.

    But even in spite of this integration, you still need an interface in the client (PL/SQL) to interact with the SQL cursor, that you have created. In PL/SQL, there are a number of such interfaces customer.

    There are explicit and implicit cursors. And there are sliders DBMS_SQL and reference. And there are implicit cursors created through immediate enforcement.

    The difference between DBMS_SQL and immediate execution is therefore a difference in customer language interface. The SQL cursor on the server (in the shared Pool) doesn't know what customer interface is used. He cares not.

    Client side, each of these client interfaces to a SQL cursor has a different function. And determines which one to use.

    run immediately , it's fast and easy for dynamic SQL, but it cannot be used to determine the structure (called projection SQL) returned by a cursor to Select . So despite the dynamic SQL code, we must always know the encoding of time, just what this slider will return to consume its production.

    DBMS_SQL to 'describe' the cursor SQL projection. So, we can create a dynamic Select SQL cursor. We can question its interface describe in order to determine the number, names and the data types of the columns returned. It can be removed these column values dynamically and consume the cursor.

    There are therefore a major difference in the two feature sets. Tools for interfacing with the same SQL cursor.

    So the main points to remember are:
    -all SQL liquidation as SQL cursors on the server
    -you have different interfaces in the language of the client to interact with a SQL cursor

    ++

    Your mission as a programmer, if you choose to accept it, is to determine which of these client interfaces is better suited to meet the requirements in your code.

    This message will self-destruct in... 5.4.3 2...

  • sql dynamic and immediate execution

    Hello all;

    Just curious... Why developers are still using dynamic sql... and run immediately, because I always thought that dynamic sql were negative and the use of immediate execution as well...

    or did I miss something...

    I like this white paper on the topic: SQL in PL/SQL
    http://www.Oracle.com/technetwork/database/features/PLSQL/overview/doing-SQL-from-PLSQL-129775.PDF

  • Classification of the Collections and Collection sets (inside Collection sets)?

    What are the rules for how elements (specifically, the collections and other collection sets) are classified into a set of collection?

    I tried to get a collection to appear at the top of the list of items in a set of collection, but it seems to get stuffed below all other series collection regardless of the name given to the collection.

    -Strathglass

    Entire collection / Smart Collections / Collections (alphabetical order in each case)

    It is the same within a collection set.

    If a collection will never appear above a smart collection or collection set regardles of that name. If you create a Collection Set, and then create two games in (01, 02) 01 Set could contain Collections and thus appears above smart collections in the 02 series.

  • Some sets of the Collection and some don't show the pictures together?  Difficulty?

    I'm having a strange problem with some of my collections.  I recently moved to a Windows 7 machine from an iMac computer and simply stated my installing Lightroom to the catalogue of the version of the iMac.  I guess it's the correct way to proceed.

    In any case, there is an inconsistency in the library shows how the images.  I have nested sets of collection for pictures of the organization until I got down to collections where are real photos.  This translates into a nesting, sometimes a few levels deep.  On some devices of collection level higher, if I click on it in the left bar it will show pictures in that location in the center of the screen, even when there is more than one collection.  However, some games of collection level say that there are no photos in the collection, although photos show if I choose the lower level collection within the whole.  For example:

    LRCatalogExample.JPG

    Here, I have a trip to ft. Myers and a trip to New York City with collections for purposes of organization and edit.  These collection sets are defined in the title of a collection of travel.

    However, if I highlight ft. Myers travel as I show above, no pictures appear in the central screen, and as you can see, it has zero photos in the path of the collection, even if they are present in the collections of picks and shoot fully:

    LRCatalogExample2.JPG

    Now, look at when I select the game of Collection of New York:

    LRCatalogExample3.JPG

    It shows pictures at this level (not the sum because some are shared between three collections of basis) and automatically selects the first (where the selected 1 and the photo dng listed).

    I wonder if I messed up something with virtual Copies when you configure some of these collections, but I don't know how to check.  This really isn't a big deal, but it makes navigation a little disconcerting and incoherent collections, anyone has an idea how can I remedy without repeating of those who are not display correctly?  Thank you all.

    This is a bug.

    A description and a difficulty.

  • On the collection and ForAll

    Dear Guru

    (1) I have some documents on the collection of 10 g
    and the example of function Forall.

    (2) question: I the procedure called Test_ps
    How to see the source code for the procedure
    At: User_source

    But I want to see how my setting are there in the procedure is there any option?

    Thanks in advance...

    You can use DSEC to see the list of arguments

    PRAZY@11gR1> create or replace procedure test_proc(a number,b number) is
      2  begin
      3  null;
      4  end;
      5  /
    
    Procedure created.
    
    Elapsed: 00:00:00.01
    PRAZY@11gR1> select text from user_source where name='TEST_PROC' order by line;
    
    TEXT
    --------------------------------------------------------------------------------------------
    procedure test_proc(a number,b number) is
    begin
    null;
    end;
    
    Elapsed: 00:00:00.01
    PRAZY@11gR1> desc test_proc;
    PROCEDURE test_proc
     Argument Name                  Type                    In/Out Default?
     ------------------------------ ----------------------- ------ --------
     A                              NUMBER                  IN
     B                              NUMBER                  IN
    

    Kind regards
    Prazy

  • I tried to install 17 and with EACB updates of them, I get the error 646... follower of the tried help the regcure, and I am running vista ultimate 64-bit wich regcure support not... What can I do?

    need help with the code 646 error and unltimat of vista running 64-bit... Let me know what you need to know to help.  Thank you...

    Hello

    Try this 1st to see if it helps, and it should:

    Description of the Patch registration cleanup tool
    http://support.Microsoft.com/kb/976220/

    ------------------------------------------------------

    If necessary :

    Try this - Panel - Windows Updates - on every update that will not be installed - click on the important updates
    or the update itself - double click a view more information (or click top then discovers on the right)

    Those who will take you to a page where you can download the update.

    Or go here and the KBxxxxxx number to download it.

    Download Center - mount the KBxxxxxx.

    Microsoft Download Center
    http://www.Microsoft.com/downloads/en/default.aspx

    Download - SAVE - go to where you put them - click on - RUN AS ADMIN

    Then you can right click on the update in the updates Windows and HIDE.

    If you get an error Installer install this version:

    Windows install 4.5 Redistributable
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en

    ----------------------------------------------------

    Then run this:

    How to reset the Windows Update components? -a Mr Fixit
    http://support.Microsoft.com/kb/971058

    Description of the system for Windows Vista, Windows Server 2008, update tool and
    for Windows 7
    http://support.Microsoft.com/kb/947821

    ------------------------------------------------------------
    Because these are all Office updates you might get more information if necessary in the Agency of those groups that
    may have experienced the same problem.

    Office newsgroups
    http://www.Microsoft.com/Office/Community/en-us/FlyoutOverview.mspx

    Microsoft.public.office.misc discussions
    http://www.Microsoft.com/communities/newsgroups/list/en-us/default.aspx?DG=Microsoft.public.Office.misc&cat=en_us_01cb749f-c998-4762-8099-df71793c11c7&lang=en&CR=us

    ------------------------------------------------------------

    If necessary you can incident free get reports however the above should take care of it for you.

    Windows updates - free Incident report

    Go here and click on-> Windows Update fails while searching, downloading or installation of updates
    http://support.Microsoft.com/GP/wusupport#tab3

    The security updates, you can get free support Incident report
    http://www.Microsoft.com/protect/resources/support.aspx

    I hope this helps.

    Rob - bicycle - Mark Twain said it is good.

  • LR3 - Export in JPEG then add to the collection and replace existing?

    Is this possible? I know how to export to JPEG, and then add the file in my collection, but is it possible to get it to automatically replace the image I just exported, also delete its settings? Basically just update the original file.

    Thank you

    I could give you several reasons why this is not a good idea, and also why it is beating all the non-destructive nature of Lightroom...

    But no, I don't think that there is an automated way to do it. You must do this manually, but not worth it, it's just not a good idea. Just edit the photo in LR and the modified version appears in your collection, without export and by replacing the existing. Its much easier than what you propose.

  • Helps the numbering and bullets

    Hello

    I have a paragraph style that uses numbering, it is called the newspaper. When I apply a paragraph of subtitle style, I want to have balls that take this title number and add a point (.) and then the sequence numbers after that. See the example.

    1. dogs (paragraph title style)

    1.1 reproduces (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    1.2 colors (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    1.3 etc etc etc (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    2 cats (paragraph title style)

    2.1 reproduces (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    2.2 colors (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    2.3 etc etc etc (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    3 rabbits (paragraph title style)

    3.1 breeds (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    3.2 colors (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    3.3 etc etc etc (style subtitle would take the number of title and add a point (.) and then the numbering in order after that)

    I've tried a few things, but nothing works... someone can help me understand this?

    Thank you!

    Babs

    Note the characters used in the dialog boxes.

  • Helps the cut and fill

    In the past (10 years and more) I could have sworn that when I cut a shape with a fill the filling would leave, feel that a form that was not closed could not have a fill... all of a sudden when I cut a form and he says not closed, he still keeps filling. I had a stroke... it was always this way or did, I hit a button command that I've never seen before! Help

    When FH imports an Illustrator's document shows fills to open paths imported as Illustrator.

    If you want to remove the fill of these paths, you must set the fill to 'none '.

    Open newly created curvilinear fillings are controlled by preference

    Preferences > object > see fill it open avenues.

    I suspect that this verified by accident.

  • problem with the collection and refcursor

    I have the 'ServerDisconnect2' function below. It should return as 'ref_cursor' on the parameter that is a data container of deleted rows slider, Java developers insist on using this type of data/collection. I don't know how to code to return the values of ID removed as 'ref_cursor '. See commented "open pDeleteList" - sentence, it is commented as does not compile.
    CREATE OR REPLACE PACKAGE oe_ctx AS
      TYPE gIntegerTable IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;
      TYPE cursor_type IS REF CURSOR;
    ....
    
      PROCEDURE ServerDisconnect2(pCasinoCode NUMERIC, pCasinoServerCode NUMERIC, pChannelServerCode CurrentLogins.ChannelServerCode%TYPE, pDeleteList OUT cursor_type) 
      IS
        vDeleteList oe_ctx.gIntegerTable;
      BEGIN
        DELETE FROM
        (
           SELECT cl.* FROM CurrentLogins cl, Accounts a
           WHERE cl.CasinoCode = pCasinoCode
           AND cl.CasinoServerCode = pCasinoServerCode
           AND cl.ChannelServerCode = pChannelServerCode
           AND cl.Code = a.code
           AND a.Type = 'lplayer'
           ORDER BY a.code
        ) RETURNING Code
          BULK COLLECT INTO vDeleteList;
          
    /*    OPEN pDeleteList FOR
          SELECT * FROM TABLE(vDeleteList);*/
          
        COMMIT;
      END ServerDisconnect2;
    Is it possible to convert the variable 'vDeleteList' in ref_cursor?
    So my only solution would be to open the ref_cursor BEFORE delete-clause with the same query delete clause has. But I'm afraid that then after opening the instant cursor after a milliseconds the deletion clause removes different lines and the procedure would be data incorrect in pDeleteList.

    Published by: CharlesRoos on August 26, 2010 06:10

    You need a collection of sql (created with CREATE TYPE...):

    I'll use the predefined collection sys.odcivarchar2list demonstation purposes:

    SQL> var cur refcursor
    
    SQL> declare
       ret_coll       sys.odcivarchar2list;
    begin
       delete from emp
         returning ename
              bulk collect into ret_coll;
    
       open :cur for select * from table (ret_coll);
    end;
    /
    PL/SQL procedure successfully completed.
    
    SQL> print
    
    COLUMN_VALUE
    -----------------------------------------------------------------------------------------------------------------------------
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER                                                                                                                       
    
    14 rows selected.
    
  • Helps the RichList and managers for a new Blackberry developer

    Hi all, I searched through the blackberry Quick reference Guide as well as the API on get a RichList to work in my application. However, I'm not entirely sure how Managers are used (I'm building my little app using the latest version of the BB SDK, 7.1). Here is my code (Simplified): http://pastie.org/4163177

    Basically, my screen pushes this full screen and it provides a Manager. I did this is because getManager() did not work (getManager() returned null, so I got an error), so I pushed the Director of the screen through. Now my list does not appear on the screen. So my question is: how to use managers, and how do I get my RichList appears?

    using menuManager which was transmitted through my screen:

    using getManger():

    A handler can be added to a single screen.  Try to use your screen in your full screen Manager (or any instance of another screen) will not work.  I recommend reading this guide on the managers. Let us know if you have any questions after checking that.

  • How to organize the collection and display of information in html5 Photoshop CC Panel

    Hi all .

    I do Panel for Photoshop CC 2015 He will contain several items entries selectscheck boxes yourbs. I want to to fill fields opening Panel of. For the convenience information want to keep in an XML - of the file the name of the user the list of project files, etc.

    I think that you need to to have an XML (?) with a description how (items id) is what value to set (< selected li 2 >) or show ("Andy") .

    Can not quite come with the mechanism of implementation of this. I would be grateful for tips, examples, ideas.

    Hello

    There is no need a second xml, because you can make the link in javascript. For example, if you have a xml like:

    
       John
       Whatever
    
    

    You can read it and then assign to, say, a text input value in the JS:

    document.getElementById("firstInput").value = firstInputValue;
    

    To parse a XML file, you should be able to:

    var dataString = cep.fs.readFile(filePath) // sync process
    var dataObj = (new window.DOMParser()).parseFromString(dataString, "text/xml");
    

    Then you should be able to:

    firstInputValue = dataObj.firstInput;
    

    I have not tested it myself but it should do the job, let me know.

    Davide Barranca

    www.davidebarranca.com

    www.cs-extensions.com

  • audit trail helps the poster and allows several track audit on a table

    Hi all

    Can I update to audit on the view?

    Can I allow multiple tracks of verification on the hz_cust_acct_sites_all table?

    Concerning

    I try to interpret your post...

    1. If you want to say "I can check update to the poster", then Yes.
    2. you can audit multiple operations on a single table, such as audit select, update and insert on the table hz_cut...

Maybe you are looking for

  • Activation key for Vista will not work

    Re-installed Vista (valid copy) 3 times on different computers in the House and then tried to intall on your laptop - now the product key does not work. So rather than buy a new product key for Vista, I prefer to get Windows 7 but do not want to spen

  • light on next to my camera portable blue... want to go down the light

    Blue lighti is on... next to my camera cell phones... want to go down the light!

  • API for open action for the listview element menu.

    Hello! Is there an API to open the action menu with elements of action for CustomListItem? A possible solution is to create a custom menu like ActionMenu standard with managers and signals defined by the user. Anybody know standard way?

  • View the ASA 5540 framework

    I have a question about ASA on the GUI, I have the choice to choose the framework which I wish to see. I have 2 one called mgmt and the other admin one. When I ssh into the asa all I can see is the context view admin how to look at the configuration

  • How you attach photos to emails on surface rt?

    It seems that there is no function copy / paste to attach photo to an e-mail on my rt surface. There is also no button attach on the client. Help?