Select the schema dynamically

Hello

I would like to query a table of each scheme, same table exists in more than 20 patterns. So I dynamically select the schema and the result, the coil, but below

statement is not to fetch all the records, can someone help me please?

[code]

Spoo result.txt

Set serveroutput on

declare

cursor c1 is select master, table_name from all_tables where table_name = 'ALLOCATE_TBL '.

order by owner, table_name;

Start

for rec in c1

loop

run immediately "select ALLOCATE_TYPE, ALLOCATE_SUBTYPE from". Rec.Owner |'. ' | Rec.table_name;

end loop;

end;

/

Spoo off

[/ code]

Hello

Whenever you make dynamic SQL code, put all the dynamic instruction in a string variable and displays this string until run you it.  In this way, you can see exactly what it's done, and, if that fails, have a better idea why.  You can comment or remove the statement display under test is finished.  That's what I was doing in the code I posted before:

-dbms_output.put_line (single_table_select |) "= single_table_select"); -for debugging

I don't know what you're trying to do here, so I can't tell you how to do it.  This would help a lot if you could post instructions INSERT, CREATE TABLE and or something equivalent, and the desired output.  For example, "if I have the standard emp table in the scott schema, and I also have a table of emp 3 rows in my own scheme, like this."

CREATE TABLE emp

AS

SELECT eanme. "JR" AS ename

empno

FROM scott.emp

WHERE deptno = 10 - only 3 rows

;

then the output should be... »

You try to put the name of the owner of the table result set?

How would you do that if you could hard-code the owner (SCOTT) and the name of the table (ALLOCATE_TBL')?  You would do something like that?

SELECT 'SCOTT' as owner

allocate_type

allocate_subtype

SCOTT. ALLOCATE_TBL

;

?  If you want to replace the parts in red with a dynamic text, you can concatenate variables instead of hardcoded text.  You already do that correctly for SCOTT and ALLOCATE_TBL on the last line; you just need to do the same thing for SCOTT on the first line.  And don't forget, when you want to have a sungle quote inside a string literal, use 2 single quotation mark in a row.  Maybe you want to do something like this:

insert_statement: = "INSERT INTO coll_test (owner, allocate_type, allocate_subtype).

|| ' SELECT DISTINCT "'

|| Rec.Owner

|| ""', allocate_type, allocate_subtype FROM ".

|| Rec.Owner

|| '.'

|| Rec.table_name;

Never answer my question

... Why do you have these similar tables in several patterns?   The fact that you need to interview all the ALLOCATE_TBLs at the same time suggests that logically they are all part of the same table.  Why not physically stored in the same table?

All you want to do, I suspect that you are making it harder than it needs to be,

Tags: Database

Similar Questions

  • Select the schema name. How?

    Hi all

    Can be a very simple question, how can I select the scheme name that I am connected. I don't wear DBA privileges.


    -Sam
    SELECT USER FROM DUAL
    
  • Name of the schema in the DB adapter

    Hello

    Schema name is hardcoded in the adpater DB, even if I do not select the schema name everything in creation.

    < jca:operation
    SchemaName = "APPS".
    PackageName = 'XX_PKG. '
    Procedurename = "POPULATE_DATA."
    InteractionSpec = "oracle.tip.adapter.db.DBStoredProcedureInteractionSpec" > "

    ...


    How can I make generic? Can I remove the SchemaName settings?

    My JNDI Url may change dynamically and the target database may have different schemas.


    Thank you
    Rishi

    SchemaName is an optional parameter.
    You can delete it.

    Prasanna-

  • Read-only subsidies on the schema

    Dear all,

    I created a user on the database, within this database, I want to give read only allowance (Select SELECT) the schema of objects such as tables and views. Number of tables being too high is possible if I can give grant SELECT on all tables so that the user only once? I mean any command?

    Thank you

    SQL > spool c:\script.sql
    SQL > SELECT 'GRANT SELECT ON SCOTT."| Table_name |' to NEW_USER;' from DBA_TABLES where OWNER = 'SCOTT ';
    SQL > spool off

    c:\>@ c:\script.sql

  • How can I dynamically select the shared Variable API programming data type?

    I am trying to create a configuration of open connections of variable shared using the programming API. It seems to me that the cleanest way to do would be to put one "open and check" routine in a loop, then call it for each variable in the library.

    The question that I am running is that I have different types of data in my library (to help a server Modbus i/o and data types 'boolean' and 'single' in my library.) How can I dynamically select the data type of the shared variable API?

    See the attached snipit.

    Thank you

    What I ended up doing was doing a Subvi to open, read, write, and close each data type, I use the packaged in 4 polymorphic SubVIs (polymorphic Open, read, etc...)

    Now all I have to do I drop in the polymorphic Subvi and it switches automatically to the appropriate data type

  • Insufficient privileges in the creation of MV that he select another schema table

    Hello

    Before asking this question, I checked with similar questions in the forum, but I don't see my situation, or I'd say I'm not clear on the solution.

    I got the privileges CREATE MATERIALIZED VIEW and CREATE ANY MATERIALIZED VIEW and I want to create a MV in my schema, but the MV selects data in another schema, and I had the privilege to choose this table. Here is my code

    Create VIEW MATERIALISEE CPY_GL_HANDS_OFF_DTL

    UPDATE THE BEGINNING WITH THE LARGEST (SYSDATE, TO_DATE ('2013.10.30.23.30.00 ',' YYYY.)) MM DD. HH24.MI. THE NEXT SS SYSDATE')) + (50519 /(24*60*60)) FULL

    ENABLES QUERY REWRITE

    SELECT

    *

    Of

    User_a.GL_HANDS_OFF_DTL@dblink;

    I run it, and I get ORA-01031: insufficient privileges. According to my research so far, the schema of the latter requires the CREATE TABLE privilege, even though she already had RESOURCES (which already includes the CREATE TABLE). Is this true? That's my problem. I only have read access to the table of the dblink, I can't control the privileges of this scheme. Advise please if this is the real problem?

    Thanks and greetings

    acquired through ROLE privileges do NOT apply in the PL/SQL name procedures

  • Select the list with the list of dynamic values with more than 4000 tank of query

    Hello

    I have no application where users can store SQL queries in a CLOB column. This query is then used to populate the list, select a dynamic element through LOV. Following the code returns the query for dynamic LOV used to populate the select list. It works fine except when the length of the lv_sqlStatement becomes more than 4000 characters. Then application crashes with "ORA-06502: PL/SQL: digital or value error: character string buffer too small" when Select the list item rendering.

    Any ideas how to get around this problem? Any help is appreciated. Do not say to them to write shorter than 4000 queries because I can't (it's operational requirements).

    DECLARE
    lv_sqlStatement end_user_set.sql_statement%type;
    BEGIN
    lv_sqlStatement: =: P2_SQL_STATEMENT;
    return ' select the label, value of (' | lv_sql_statement | t ')
    To_char (t.value) if not in (select value from end_user_set_member eusm)
    where eusm. EUSRSET_ID = ' | : P2_EUSRSET_ID | ')';
    END;

    I just blogged about this problem and posted a solution. See this announcement:

    http://www.deneskubicek.blogspot.de/2013/03/select-list-with-dynamic-lov-and-Ora.html

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • How do I select the checkbox in a dataGrid created dynamically by program

    How do to select the checkbox everything programmatically in a dataGrid created dynamically as shown below
    <! [[CDATA
    Import mx.controls.dataGridClasses.DataGridColumn;
    Import mx.collections.ArrayCollection;

    Import mx.controls.DataGrid;
    Import mx.controls.CheckBox;

    [Bindable]
    private var dtGrid:DataGrid;
    [Bindable]
    private var chkBox:CheckBox;

    [Bindable]
    private var peeps: ArrayCollection collection;

    private function init (): void
    {
    friends = new ArrayCollection();
    peeps.addItem ({firstName: "Beautiful", lastName: "Dude", age: 24 gender: "male"});
    peeps.addItem ({firstName: "Red", lastName: "Dude", age: 25 gender: "male"});
    peeps.addItem ({firstName: "Top", lastName: "Guy" of the age: 25 gender: "male"});
    peeps.addItem ({firstName: "Cute", lastName: "Girl", age: 24, sex: "female"});
    peeps.addItem ({firstName: lastName "to"hot,":"Chick", age: 24, sex:"female"});
    peeps.addItem ({firstName: lastName "Lazy",: "The man", age: 25 gender: "male"});

    var dataGridColumn:DataGridColumn = new DataGridColumn("");
    dataGridColumn.itemRenderer = new ClassFactory (CheckBox);

    dtGrid = new DataGrid();
    dtGrid.dataProvider = friends;
    this.addElement (dtGrid);

    var tempColArray:Array = new Array();
    tempColArray [0] = dataGridColumn;

    for (var i: int = 0; dtGrid.columns.length > i; ++ i)
    {
    tempColArray [i + 1] = dtGrid.columns [i];
    }

    dtGrid.columns = tempColArray;
    dtGrid.invalidateDisplayList ();
    }
    []] >
    Thanks and regards,
    Kake

    You might be better off working examples of CheckBox DataGrid on my

    blog

    --

    Alex Harui

    Flex SDK Team

    Adobe System, Inc..

    http://blogs.Adobe.com/aharui

  • Failed to load the schema of dynamic flow

    Local:
    OS - Windows XP
    Dreamweaver CS3 + the Developer Toolbox

    Distance:
    1.3.3 Apache Web server (Unix)
    PHP - 4.4.7
    MySQL - 4.1.22 (Standard)

    My connection to the remote server Dreamweaver settings:
    URL - http://www.mydomainname.tld
    PHP MySQL - Server
    FTP - ftp.mydomainname.tld + myusername mypassword
    Folder - /public_html/
    URL of the folder root - http://www.mydomainname.tld/

    My MySQL database connection settings remote Dreamweaver:
    MySQL server - localhost + prefix_mydatasbaseusername + mypassword
    Database - prefix_databasename

    ____________________________________________________________________

    Hello

    I followed this tutorial)

    ( http://www.adobe.com/devnet/dreamweaver/articles/spry_xml_export.html )

    through all the simple steps and following all the instructions for the

    letter, but I got stuck when I got to page 4 of 5 in the tutotrial.

    I've been looking for an answer/solution to the problem of the last

    a few days but nothing found so far.

    Page 1-3 of this tutorial, I got the following:

    (1) inserted examples of SQL Tables provided with the tutorial in my

    MySQL database.

    (2) got Dreamweaver to connected to my MySQL database.

    (3) creating a recordset with data from my MySQL database.

    (4) using the Dreamweaver Extension (Developer Toolbox), exported the newly

    create the recordset as XLM, using a web page named 'export_test.php '.

    (5) uploaded the folder ' includes / XMLExport ' & content

    folder "/public_html/" on my remote server.

    Previewed 6) the 'export_test.php' and it shows exactly as the tutorial

    illustrated. No problem.

    Up to this point, all right.

    (7) as shown in the tutorial, I created another web page named

    'spry_sample.html '.

    (8) according to the instructions, I clicked on the "XML Spry Data Set" and the guest

    presents itself. I entered the following:

    Name of the DataSet - dsTest
    Source XML - export_test.php (on the local machine)

    When I clicked on 'Get schema', I got a prompt saying:
    "Unable to get the schema of dynamic flow (export_test.php). Please do
    of course the test server is configured in the Site definition. »

    I deleted all the files and folder (local and remote) created by the present
    tutorial and redo the tutorial, but it is still end up getting stuck with
    the same problem.

    What have I done wrong here?

    Any advice would be much appreciated.

    Thanks in advance.

    Tommy

    >>
    When I clicked on 'Get schema', I got a prompt saying:
    "Unable to get the schema of dynamic flow (export_test.php).
    >>

    that s all right, because the dynamics of power generates XML data 'on the fly' and when it is running on the server, Dreamweaver expects a 'real' at this stage XML schema - for the test that you will need to provide a static XML file, later, you can switch to "export_test.php."

  • Select the dynamic channel to fill in the legend

    Hello no,.

    I am the acquisition of 16 channels each channel has their own name, when I double click on the graph, the populous select.vi channel and it will list the name of the channel. If I select the first channel 5 or last name 5 channels or channel. the selected channel must be complete on behalf of legend.

    I am facing the problem, when I select the way to any list of channels his does not display does not name, the same method that I did with labview 7.1, which has been working well.

    Please find this attachment, my code

    Hello

    Find error or anything just a blank field name while doing this operation.

    A point I can see here is:

    1. the table "name out" which bears the names of channel should have clues covered by array index.  If the index covered by index out is not in the name of then an empty string will be returned.

    Please check if this condition is met.

  • Grants to only read the schema

    Hi all

    We want to create read only one schema with dynamic read-only access to a source schema.

    We knew that the steps to create read only schema, but we would like to know, how grant us only read access for new objects created in the source schema?

    Let's say, test pattern source today has 100 items. We have created reading scheme (test_ro) with select on / execute on for all 100 objects in the schema source (test).

    After a week, another 30 new objects are created on the test. Now how we automate reading only grants for these 30 new items to read only one schema (test_ro) of the schema of the source (test)?

    Thank you in advance...

    Thank you

    Dinesh.

    A simple approach could be like below. Readonly_role is a user-defined. You can add any number of privileges in the execute stmt.

    create or replace trigger .AUTO_ASSIGN_GRANT_READONLY
         after CREATE on .schema
          declare
          l_str varchar2(255);
          l_job number;
          begin
          if ( ora_dict_obj_type = 'TABLE' )
          then
          l_str := 'execute immediate "grant select on .'||ora_dict_obj_name ||' to READONLY_ROLE";';
          --execute immediate 'grant select on .'|| ora_dict_obj_name ||' to READONLY_ROLE;';
         dbms_job.submit( l_job, replace(l_str,'"','''') );
         end if;
         end;
      /
    

    I copied this over the internet a few years back and I modified to suit my needs...

    The unknown author is the one who should take the credit.

  • get the names of the columns dynamically

    Hi gurus,
    I have the list item filled with lots of names of a table schema.
    I did grid in oracle 10g and I want to fill in the grid with the data that should come at least four/more columns.
    I want to get the trigger list change when whenever any name a table is selected/changed.

    How can I get the names of the columns dynamically
    Please give me the step by step process
    for the filling of the grid...

    Hello

    If you want to get the details of the column, and then use the USER_TAB_COLUMNSview.

    SELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 
    

    Kind regards

    Manu.

  • grant access to the schema

    Some may give me a script to do the following:

    I have a scheme name ABC and I want to give a user XYZ a read access to all objects in the schema of the CBA. IE (TABLES, VIEWS. SWQUENCES etc.)

    Just to emphasize a point that maybe isn't obvious, there are two general approaches that have been discussed - dynamic generation of scripts and SQL scripts.

    Build scripts of scripting occurs when you have one (or several) SQL statements that generate many SQL instructions you have here. It must be a two step process in this case. You spool the SQL statements that you build in a file (a SQL script), and then run the SQL script, that you just created. Simply to generate the script has no effect on the database. The SQL statement that you posted would be part of a script generating approach of scripts, then you must do something like

    SQL> spool my_script_file.sql
    SQL> <>
    SQL> spool off;
    SQL> @my_script_file.sql
    

    The other approach is to use dynamic SQL statements. This is the approach of using EXECUTE IMMEDIATE in a PL/SQL block, i.e.

    BEGIN
      FOR x IN (
          SELECT *
            FROM dba_objects
           WHERE object_type IN ('TABLE', 'VIEW', 'SEQUENCE' )
             AND owner IN ('XYZ', 'PQR' )
      )
      LOOP
        EXECUTE IMMEDIATE 'grant select on ' || x.owner || '.' || x.object_name || ' to ABC';
      END LOOP;
    END;
    

    Dynamic SQL will actually affect the database - you build and run the SQL statements in a single step. This eliminates the need of the coil of the output of the SQL statement in a file, and then run this script.

    Justin

  • Convert a Macintosh HD to the MBR to the schema GUID

    My drive hard macintosh is installed on a 1 TB drive that has a MBR partition scheme. Currently, I run snow leopard 10.6.8. you want to upgrade to el captain. When I click the installer I get a msg "this disc does not use the GUID Partition table schema. Use disk utility to change the partition scheme. Select the drive, click the Partition tab, select the configuration of Volume and then click on Options". but as u see my screenshot below the 'options' tab is grayed out. How should I proceed? If your answer is to reinstall my os x or re-partition my drive... Please explain step by step because I am a beginner on mac. also I don't have a startup dvd for snow leopard.

    FYI: I backed up my data using TM and super duper (Smart Update) to the same external hard drive.

    You will have to reformat the hard disk to change it from MBR to GUID.

    When you that all data on the hard drive with deleted then save whatever it is, you want to save first.

  • Know how OR example 'select the dialogue signal' its dialog box

    Hi, guys!

    It should be a very simple problem. I was looking for examples OR to learn how to create a dialog box to set the parameters. "Select the signal dialog box" is nice, but I can't understand how it works through code in the block diagram (it seems too easy!). and I copy all the entire schema in an another white vi, may not work (does not display the dialog box)... can someone tell me where is the trick? THX!

    Hello

    I don't know what your question.

    Want to know how a VI is made to work like a dialog box? You said that you have copied the block diagram for a new vi. I guess her you missed on the properties of VI. Try the following:

    1 Select the properties of the VI VI, on the file Menu, go to the window appearance properties in the menu dropdown.

    2. Select "Dialogue" as the appearance option and click on 'Ok '.

    3. save your vi and Run.

    If this is not what you are looking for, please explain once again.

Maybe you are looking for

  • Y at - it a keyboard 3/4 for iPhone application

    I have no feeling in my hands and can't use the small keyboard qwerty on an iPhone then have a 3/4 app my Samsung galaxy 4 - however I really want an iPhone that I have an iPad and all the grandchildren have iPhones and iPads... If not a 3/4 keyboard

  • HP Envy dv6 with Qualcomm Atheros AR9485 wireless issues

    Hello! I have a few questions on a computer I bought recently, HP ENVY Notebook PC, number of product B5Y66AV dv6 wireless. The internet speed is much slower that it should be and also randomly disconnects / reconnects, a problem that I didn't with m

  • 8 driver for LaserJet 2300d; Auto part and other print

    I've recently updated to 8 of the window. I have 2300 d printer LaserJet. The original driver of the printer was PCL 5 which allow the capablity to print automatically on both sides of a page. Windows are and to upgrade the driver to a PCL 6. This al

  • The anonymous user security breaches?

    Hello What, exactly, is anonymous user? Please clarify on this, that would help us know the breaches of all anonymous logons. Any additional information. on safety violations relating to the event ID would be appreciated. Thank you Arjun

  • pushGlobalScreen of background application give runtime exception.

    Hi all I've implemented an application extending application. making background app. also, I updated the property system and auto-start module. Now, I want to display a message to the screen. to do this, I used following code... showMessage (final St