Handling table name changes

Hi,
Because of a change in naming convention, all our source table names are changing (only the prefix: The rest of the name and the table structures will remain the same). We already have developed a significant number of OWB mappings based on the old naming convention. What is the OWB equivalent of doing a global search replace of table names ? Is there a script available for doing this ?
Thanks in advance.
Regards,
Biswa.

The name changing part should be relatively simple to handle. I have included a script that should do the renaming with the prefix 'WH_'. The reconcile will have to be done by you. The script should go something like this (please test your scripts in a test environment as I will not provide support for this).
Regards:
Igor
# Update the connection information here.
# The connect string format is repository_user/repository_pwd@hostname:port:service_name
# Connecting to the repository:
OMBCONNECT owb/owb@localhost:1521:ora9201
puts "Connected to repository."
# Setting the project and prefix variables (set project name here):
set MProject MY_PROJECT
# Everything will be prefixed by WH_:
set wh WH_
#Open the project
# Entering into the Project (CC = Changing Context):
OMBCC '$MProject'
set module_list [OMBLIST ORACLE_MODULES]
# Loop to enter into each project module:
     foreach i in {$module_list}{
          puts "Working on module: $module_list ."
          OMBCC '$module_list'
          set table_list [OMBLIST TABLES]
# Loop to prefix the name of each table in the current module:
               foreach j in {$table_list}{
                    puts "     Working on table: $table_list ."
                    OMBALTER TABLE '$j'
                         RENAME TO '$wh$j'
# Loop to prefix the name of each dimension in the current module:
          set dim_list [OMBLIST DIMENSION_TABLES]
               foreach l in {$dim_list}{
               puts "     Working on dimension: $dim_list ."
                    OMBALTER DIMENSION_TABLE '$l'
                         RENAME TO '$wh$l'
# Loop to prefix the name of each cube in the current module:
          set cube_list [OMBLIST CUBE_TABLES]
               foreach m in {$cube_list}{
               puts "     Working on cube: $cube_list ."
                    OMBALTER CUBE_TABLE '$m'
                         RENAME TO '$wh$m'
# Loop to prefix the name of each mapping in the current module:
          set mapping_list [OMBLIST MAPPINGS]
               foreach k in {$mapping_list}{
               puts "     Working on mapping: $mapping_list ."
# Reconcile your mapping here by using OMBRECONCILE ...
# this will have to be done by you...     
puts "Done."
# Saving the changes:
OMBCOMMIT
# Disconnecting from the repository:
OMBDISCONNECT

Similar Messages

  • SAP BW structure/table name change issue with BODS Jobs promotion

    Dear All, One of my client has issue with promotion of BODS jobs from one environment to another. They move SAP BW projects/tables along with BODS jobs (separately) from DEV to QA to Prod.
    In SAP-BW the structures and tables get a different postfix when they are transported to the next environment.  The promotion in SAP-BW (transport) is an automated process and it is the BW deployment mechanism that causes the postfixes to change.  As a result with the transport from Dev to QA in SAP-BW we end up with table name changes (be they only suffixes), but this does mean that when we deploy our Data Services jobs we immediately have to change them for the target environments.
    Please let me know if someone has deployed some solution for this.
    Thanks

    This is an issue with SAP BW promotion process. SAP BASIS team should not turn on setting to suffix systemid with the table names during promotion.
    Thanks,

  • How Discoverer Reports cope with table name changes

    I want to change the name of an oracle table that is queried by a number of Discoverer reports owned by various users.
    I have been told that Discoverer might have the smarts to handle this without manual intervention of users having to open their reports and repoint them to the new tablename. Would someone be able to enlighten me?

    Thanks Guys for help.
    Additionally I'd like to add for the purpose of the name change is business driven and therefore it is important that business (report writers) see the new name so.....
    For each simple folder in the EUL there are there 3 attributes you need to be aware of:
    (1) Folder Name (the name as seen in Discoverer)
    (2) Identifier
    (3) Physical Database Object name
    (1) and (2) are used by a Disco workbook to resolve back to the physical object name.
    Therefore, you can change either (1) or (2) [but not both] and still have the workbook resolving back to the physical object name on the folder (ie (3)).
    In summation, I changed (1) and (3) while leaving (2) unchanged to resolve the whole glorious mess....

  • Database "TABLE" name change is NOT reflecting on Designer Security

    Hi all members,
    version: BOXI 3.1
    I have change the table name in my Database for some particular reason.
    After changing the name from "A_Table" to "B_Table" it is updating the objects "select"  information correctly by itslef. BUT for security in (Manage Access Rights) old Table name is showing.
    Manaul correction is the only way for it? Can this be updated automatically.
    What is the way to achieve it through SDK.
    Kindly any member guide me.
    I have number of tables to change and each have number of securities applied in universe.
    Thanks in advance
    Regards,
    Izhar

    Universe access security is encapsulated separate from the Universe unv itself.
    Rather, it's a SI_KIND='Overload' InfoObject instance, accessible using the BusinessObjects Enterprise SDK.
    Sincerely,
    Ted Ueda

  • Table name changed in Reports 3.0

    My DBA asked me to change the table name from SA_AWARDS to SAFETY_AWARDS.
    I had already developed a report using table name SA_AWARDS.
    When I change the table name in my report to SAFETY_AWARDS, I get compilation errors.
    How can I fix it ?
    Thanks.
    Suresh

    Hi
    As i understand your problem , you have changed the table name in the query wizard and then tried to compile and it is giving errors ....
    well anytime you modify the sql (even add a space) the column names are renamed ... ie if you originaly had column Customer_name it would be renamed as customer_name1 ....
    now if in the original report you are using the columns for any computation etc it will not find the old column and will give compilaiton errors .... one way is to change the column names back to original names ... or better modify the sql once more by adding space and you will get back the original names most of the times .....
    the best way to avoid this is give alias name in the sql first time around , so it dosnt create problems ....
    once you take care of this i think your problem should be solved .....
    if not do let me know in more detail
    bye
    sudhir

  • Table Name-Changes in SO

    Dear All,
    As we all know that any changes done in Sales order, we can see them by going to Va02-->Environment -->Changes...
    According to our client's requirement, we need to generate a report which can show all the changes done to a SO. For this I want to know the TABLE name in which the changes that we have done to the SO are going to be stored.(Kindly let me know if there is any Standard Report exists in SAP R/3 for this kind of requirement)
    Points assured for Helpful answers
    Thanks & regards
    Krishna Chaitanya

    Hi,
    Please refer the following tables.
    Header : CDHDR
    Item: CDPOS
    Reward points
    Regards,
    Govind.

  • Admin advice: table name changes, etc.

    Our Discoverer system is still evolving and there are instances when a change, say to a table name that users have build workbooks on, is required. Is there a way to scan the workbooks and make this change for the users?

    Hi
    No, this is not possible. You have to be extremely careful making changes to an EUL after workbooks exist. Mind you, just because you change a table name does not mean you need to change the folder name or identifier. You can change the table pointer without making any other changes, so long that is that the new table has the same data items and data types as the original. If it doesn't you could be in deep trouble.
    As a note, you do need to make sure that you correctly maintain both the folder name and the folder identifier and not allow these to take generic names and defaults such as NEWFOLDER1 etc. This is bad EUL design and you will end up with issues in the future.
    If you have a copy of my Oracle Discoverer 10g Handbook, available from good bookstores or amazon.com via http://learndiscoverer.com/books/books.htm, take a look at chapters 17 and 18 which describe in detail how to get going in and maintain business areas. In particular, pages 640 and 641 cover folder management and discuss the impact of changing names and / or identifiers.
    I hope this helps
    Best wishes
    Michael Armstrong-Smith
    URL: http://learndiscoverer.com
    Blog: http://learndiscoverer.blogspot.com

  • Table name change in procedure dynamically

    create table tab1(x number);
    create table dynamic_table (x number);
    insert into tab1 values (1);
    insert into dynamic_table values (1);
    commit;
    create procedure proc1
    is
    v_x number;
    begin
    execute immediate 'create table mytab
    as select tab1.*
    from tab1, tabc
    where tab1.x = dynamic_table.x';
    end;
    begin
    proc1;
    end;
    /dynamic_table --> should be dynamically replaced in the procedure
    There are two more tables in this scenario - tabe and tabf, In the above procedure, I have to dynamically replace dynamic_table first with tabe, call it, then then replace with tabf and execute procedure again
    Is there a way I can do that ? any dynamic sql that will prompt me to call proc1 twice, 1st time replace dynamic_table with tabe, then with tabf
    the structure of tabe and tabf is the same, I am currently passing a parameter to the procedure and replacing dynamic_table with the input parameter, and then
    calling the procedure twice by passing the table names, wanted to follow a better approach
    Currently, I am doing somethig like this:
    create procedure proc1 (i_param in varchar2)
    is
    v_x number;
    begin
    execute immediate 'create table mytab
    as select tab1.*
    from tab1, tabc
    where tab1.x = i_param.x';
    end;
    begin
    proc1('tabe');
    proc1('tabf');
    end;
    /

    Why are you trying to do this?
    Good database design practice means that you don't create tables dynamically within your code.
    Why do you have tables of the same structure with different names?
    Dynamic table names are not a good idea because it means all your code has to be dynamic.
    So whilst it's perfectly possible to do what you are asking, showing you how to do it would be like me showing you how to fly a plane into the ground, i.e. not something that's clever or wise.
    So, better you explain what problem you are trying to solve rather than ask us how to improve on the poor code you are already trying to do.

  • Updated Table Name Changes Applescript Operation in Numbers 3.5

    I've been using Applescript in Numbers for some time to copy/paste data (set cell values) from one sheet table to another sheet table.
    My original script was heavily cribbed from something Yvan Koenig had posted 2-3 years ago.
    I recently updated to Yosemite and Numbers 3.5 after testing to ensure my original script remained functional (and it did).
    I subsequently updated my source data table by duplicating my old table and editing this new source.
    I then updated my Applescript to to reference the new source table.
    Testing yielded a good functional result, but Numbers changed its behavior by displaying its work while setting values in the target sheet table.
    This obviously slows the script down and adds measurable processing time given the amount of data being moved.
    Does anyone know how I can prevent this behavior from occurring?
    I don't believe I changed anything material in my original script so I'm really not sure why Numbers changed its behavior.
    I have included my script below.  Thanks very much for any help!
    property the_goods : {}
    property patient_name : {}
    property patient_count : {}
    property run_date : {}
    on run
      set sheet_source to "1500 EXPORT"
      set table_source to "OA Data"
      set column_source to 1
      set row_source to 2
      set sheet_destination to "CLEARING HOUSE EXPORT"
      set table_destination to "Export Table"
      set column_destination to 1
      set nb_rows to 0
      set nb_columns to 244
      set patient_sheet to "SESSION DB"
      set patient_source to "User Input Table"
      set patient_tracker to "Tracking Table"
      set source_column to 3
      set source_row to 2
      set destination_column to 2
      set date_column to 3
      set patient_count_column to 3
      set patient_count_row to 3
      set run_date_row to 5
      tell application "Numbers"
      set document_source to name of front document as string
      set document_destination to name of front document as string
      end tell
      tell application "Numbers"
      tell document document_source to tell sheet patient_sheet to tell table patient_source
      set patient_count to value of cell patient_count_column of row patient_count_row
      set run_date to value of cell patient_count_column of row run_date_row
      end tell
      end tell
      set row_destination to patient_count
      tell application "Numbers"
      tell document document_source to tell sheet sheet_source to tell table table_source
      set the_goods to value of cells column_source thru (column_source + nb_columns) of rows row_source thru (row_source + nb_rows)
      end tell
      tell document document_destination to tell sheet sheet_destination to tell table table_destination
      set r to 0
      repeat with one_row in the_goods
      tell row (row_destination + r)
      set c to 0
      repeat with one_value in one_row
      set value of cell (column_destination + c - 0) to one_value
      set c to c + 1
      end repeat
      end tell
      set r to r + 1
      end repeat
      end tell
      tell document document_destination to tell sheet patient_sheet to tell table patient_source
      activate
      end tell
      tell document document_destination to tell sheet patient_sheet to tell table patient_source
      set patient_name to value of cell source_column of row source_row
      end tell
      tell document document_destination to tell sheet patient_sheet to tell table patient_tracker
      set value of cell destination_column of row row_destination to patient_name
      set value of cell date_column of row row_destination to run_date
      end tell
      end tell
      set the_goods to {}
      set patient_name to {}
      set patient_count to {}
      set run_date to {}
    end run

    Here is a simple example that copies values from a source row 3 in Table 1 to a target row 5 in Table 2.
    On my aging MBA it was very fast (about a second) with 150 columns.
    In addition to speed, an advantage of this approach is that you don't have to code table dimensions;  the target table will expand automatically if needed.
    Save the script in a script folder (in my case ~/Library/Scripts/Applications/Numbers) and run it from there by choosing it from the script menu. (Running it from Script Editor will paste the values into Script Editor instead of into Numbers as you want).
    If keeping the original number format is important, substitute 'formatted value'  for 'value' in the script.
    SG
    property src : {d:1, s:"Sheet 1", t:"Table 1", r:3}
    property tgt : {d:1, s:1, t:"Table 2", r:5}
    tell application "Numbers"
      tell document (src's d)
      tell sheet (src's s)
      tell table (src's t)
      tell row (src's r)
      set vv to cells's value -- makes AppleScript list
      set the clipboard to my makeTSV(vv)
      end tell
      end tell
      end tell
      end tell
      tell document (tgt's d)
      tell sheet (tgt's s)
      tell table (tgt's t)
      set the selection range to row (tgt's r)'s cell 1
      tell application "Numbers" to activate
      tell application "System Events" to keystroke "v" using {option down, shift down, command down}
      end tell
      end tell
      end tell
    end tell
    to makeTSV(aLst) -- turns AppleScript list into tab-delimited string
      set oTID to AppleScript's text item delimiters
      set AppleScript's text item delimiters to tab
      set tsvStr to aLst as text
      set AppleScript's text item delimiters to oTID
      return tsvStr
    end makeTSV

  • Have tables names changed from CF6/7 to CF 8/9?

    <<Edit>>I might have just answered my question, sort of.  I had already exported the data from the hosted SQL 2000 DB to my local SQL 2000 DB and then backed up and restored it to an empty DB in SQL 2008 Express.  The tables have the dbo. prefix instead of the "xx." prefix in the other DB which went from SQL 2000 to SQL 2008.  The site runs with the dbo. prefix.  Any links to articles/videos/summaries of simple differences between version still appreciated."<</Edit>>
    I built a CF6/7 based site about 5 years ago and I'm trying to move it to the current versions of MSSQL (2008R2 Express) and CF9.  I believe the SQL DB is fine, I have setup the site on the local server, and am getting the following error when trying to view a page that access the DB.
    [Macromedia][SQLServer JDBC  Driver][SQLServer]Invalid object name 'client_info'.
    I exported the DB data from the live DB server into my local SQL 2008 Express and tables now have names like "xx.client_info"  Is it correct to assume that this is a new naming convention so that you can access easily access tables in multiple DBs?  Would I simply need to rename the tables to exclude the "xx." at the begining?  Or would it be advised to export the data into SQL 2000 and then backup/restore the DB to SQL 2008 Express?
    Thanks for any help, and if there's a video or link to simple differences/improvements in CF from 6/7 to 8/9 any link would be greatly appreciated.

    It's not CF-related, it's a SQLServer thing. In SQL 2008 they introduced the concept of Schemas, which I think is what you're seeing here. Rather than dbo.tablename, you now have schema.tablename.
    I don't know the details to be honest, but that's what you need to be looking at.
    O.

  • Urgent Help on Dynamic Table name change in query !!!!!!!!

    Hi Everyone,
    I'm having a repeating frame which displays table_name, count_validate and count_error. How can i dynamically change my table_name in formula column apllied on count_validate and count_error. I can do this with multiple elsif statement, which makes my report slow at runtime. Select statement is same , only change is table_name ?
    Kindly let me know......

    Try to use dynamic ref cursors (defined in a database package).
    This is not exactly what you need, but see:
    "Dynamic Table in the Second Query with Oracle Reports"
    http://www.quest-pipelines.com/pipelines/plsql/tips03.htm#JULY
    Regards,
    Zlatko Sirotic

  • *Dynamic* Table Name in From Clause with input from cursor

    Hello
    I have a cursor say...
    select table_name from dba_tables where <blah>
    The result is
    row1:: emp
    rwo2:: emp_1 ---> Both the tables have same structure and entirely different data... please dont ask why... that's the way it is and we cant change it..
    Now we need to run an Insert...
    insert into tableX (col1,col2,...) select a,b,... from <o/p of the cursor> where <blah> ...
    Note: The table name changes and it the cursor can o/p emp,emp_a and emp_b.
    Am looking to do it parallel instead of doing it serially and with best performance ....no sql injection issues.
    By parallel i mean
    insert into tableX (col1,col2,...) select a,b,... from emp where <blah>
    and insert into tableX (col1,col2,...) select a,b,... from emp_1 where <blah> statements to fire parallel/at the same time to the database. If you can share procedure if you guys already have with you.. is really appreciated
    Thanks a lot for your time....
    Edited by: user007009 on Apr 27, 2013 8:33 PM

    Hello thanks for your time..
    I tried to implement the chunk by sql parallel execution approach and it took 3.1 seconds to complete.. while the SP took around 0.042 seconds and the parallel process didn't throwed any errors and it didn't insert any data either... I am not sure what I am doing wrong... can you please let me know your thoughts...
    Sample Data Creation::::::::::::::*
    drop table table_ASERCARE purge;
    drop table table_MEDCARE purge;
    DROP TABLE TABLE_XYCARE PURGE;
    DROP TABLE TABLE_TIME PURGE;
    DROP TABLE TABLE_LOCATION PURGE;
    drop table table_group purge;
    drop table tablex purge;
    -- select distinct TABLE_NAME from ALL_TAB_COLS where TABLE_NAME like 'EMP%';
    create table table_asercare (time number(30), location_number number(5), value number(5),catg_id number(5));
    insert into table_asercare values  (20110111, 01, 55, 1200);
    insert into table_asercare values  (20110131, 01, 31, 1223);
    insert into table_asercare values  (20120131, 15, 24,1224);
    insert into table_ASERCARE values  (20130131, 03, 555,1200);
    -- Truncate table table_MEDCARE
    create table table_medcare (time number(30), location_number number(5), value number(5),catg_id number(5));
    insert into table_medcare values  (20110113, 01, 23, 1200);
    insert into table_medcare values  (20110128, 02, 78, 1223);
    insert into table_medcare values  (20110130, 03, 100, 1224);
    insert into table_medcare values  (20120111, 04, 57, 1200);
    insert into table_medcare values  (20120221, 05, 64, 1223);
    insert into table_MEDCARE values  (20130321, 15, 48, 1224);
    create table table_xycare (time number(30), location_number number(5), value number(5),catg_id number(5));
    insert into table_xycare values  (20100113, 01, 99, 1200);
    insert into table_xycare values  (20110128, 02, 90, 1223);
    insert into table_XYCARE values  (20130128, 03, 24, 1224);
    create table table_LOCATION ( LOCATION_NUMBER number(5), LOCATION_NAME varchar2(50));
    insert into table_LOCATION values  (01, 'atlanta1');
    insert into table_LOCATION values  (02, 'atlanta2');
    insert into table_LOCATION values  (03, 'atlanta3');
    insert into table_LOCATION values  (04, 'atlanta4');
    insert into table_LOCATION values  (05, 'atlanta5');
    insert into table_location values  (15, 'atlanta15');
    create table table_category (catg_id number(5), catg_name varchar2(30));
    insert into table_category values (1200, 'EMS');
    insert into table_category values (1223, 'LJM');
    insert into table_category values (1224, 'LIO');
    create table table_TIME (YEAR_MONTH_DATE number(30), YEAR_VAL number(4), MONTH_VAL number(2),DATE_VAL number(2));
    insert into table_TIME values  (20110111, 2011, 01,11 );
    insert into table_TIME values  (20110131, 2011, 01,31);
    insert into table_TIME values  (20120131, 2012, 01,31);
    insert into table_TIME values  (20130131, 2013, 01,31);
    insert into table_TIME values  (20110128, 2011, 01,28 );
    insert into table_TIME values  (20110130, 2011, 01,30 );
    insert into table_TIME values  (20120111, 2012, 01,11 );
    insert into table_TIME values  (20120221, 2012, 02,21 );
    insert into table_TIME values  (20130321, 2013, 03,21 );
    insert into table_TIME values  (20100113, 2010, 01,13 );
    insert into table_TIME values  (20130128, 2013, 01,28 );
    --Truncate table table_group
    CREATE TABLE table_group (group_key number,table_name VARCHAR2(30), group_name VARCHAR2(30), catg_name varchar2(30));
    insert into table_group values (1,'table_ASERCARE', 'GROUP_ONE','EMS');
    insert into table_group values (2,'table_MEDCARE', 'GROUP_ONE','LJM');
    INSERT INTO TABLE_GROUP VALUES (3,'table_XYCARE', 'GROUP_TWO','LIO');
    create table TABLEX (YEAR_VAL number(4) ,LOCATION_NAME varchar2(50),tablename VARCHAR2(30), cnt number ); --> Proc data will be inserted into this...
    Stored Procedure++++++++_
    CREATE OR REPLACE
    PROCEDURE ABC(
        GROUP_NAME_IN IN VARCHAR2 )
    is
    type c1 is ref cursor;
        sql_stmt VARCHAR2(200);
        v_sql    VARCHAR2(30000);
        c1_cv c1;
        table_name_f VARCHAR2(30);
        c1_rec TABLE_GROUP%rowtype;
      BEGIN
        SQL_STMT := 'SELECT * FROM TABLE_GROUP WHERE GROUP_NAME = :i';
        OPEN c1_cv FOR SQL_STMT USING GROUP_NAME_IN ;
        loop
          fetch c1_cv  INTO c1_rec;
        exit when c1_cv%notfound;
    --    forall i in c1_rec.FIRST ..c1_rec.last loop
        table_name_f := c1_rec.table_name;
    --      END LOOP;
       EXECUTE immediate
       'INSERT  INTO tablex (YEAR_VAL,LOCATION_NAME, tablename, cnt)
    SELECT
    t.YEAR_VAL,l.location_name, :table_name, count(*) as cnt
    FROM '
        ||table_name_f||
        ' variable_table
    ,table_time t
    , table_location l
    ,table_group g
    ,table_category ctg
    WHERE t.year_month_date = variable_table.TIME
    and variable_table.location_number = l.location_number
    and ctg.catg_id = variable_table.catg_id
    --and ctg.catg_name = g.catg_name
    GROUP BY t.YEAR_VAL,l.location_name,g.catg_name' USING table_name_f;
        --dbms_output.put_line ( 'The SQL is'|| v_sql);
        COMMIT;
        --dbms_output.put_line ( c1_rec.table_name||','||c1_rec.group_name );
        --dbms_output.put_line ( 'The table name is '|| c1_rec.table_name );
      end loop;
        CLOSE c1_cv;
      --null;
    END ABC;
    Parallel Execution Code++++++++++_
    begin
    begin
    DBMS_PARALLEL_EXECUTE.DROP_TASK(task_name => 'TASK_NAME');
    exception when others then null;
    end;
    DBMS_PARALLEL_EXECUTE.CREATE_TASK(task_name => 'TASK_NAME');
    DBMS_PARALLEL_EXECUTE.CREATE_CHUNKS_BY_SQL(task_name => 'TASK_NAME', sql_stmt =>'select distinct group_key, group_key from table_group', by_rowid => false);
    end;
    begin
    DBMS_PARALLEL_EXECUTE.RUN_TASK (task_name => 'TASK_NAME',
    sql_stmt =>'declare
    s varchar2(16000); vstart_id number := :start_id; vend_id number:= :end_id;
    table_name varchar2(30);
    begin
    select table_name into table_name from group_table where group_key=vstart_id;
    s:=''INSERT  INTO tablex (YEAR_VAL,LOCATION_NAME, tablename, cnt)
    SELECT
    t.YEAR_VAL,l.location_name, :table_name, count(*) as cnt
    FROM ''||table_name||'' variable_table
    ,table_time t
    , table_location l
    ,table_group g
    ,table_category ctg
    WHERE t.year_month_date = variable_table.TIME
    and variable_table.location_number = l.location_number
    and ctg.catg_id = variable_table.catg_id
    and ctg.catg_name = g.catg_name
    and g.group_key =:vstart_id
    GROUP BY t.YEAR_VAL,l.location_name,g.catg_name'';
    execute immediate s using vstart_id;
    commit;
    end;',
    language_flag => DBMS_SQL.NATIVE, parallel_level => 2 );
    end;
    / thanks in advance for your time.
    Edited by: user007009 on Apr 28, 2013 12:25 PM

  • Table name in variable

    Hello there,
    I have a question on the following:
    I want to read from a series of tables which a different suffix such as
    table123, table234 and table110
    How can I put them in a loop and extract data from them
    for x in y loop
    select abc, edf, .......
    from tablexxx;
    end loop;
    I have tried the execute immediate command but the sql was loo long.
    Anybody has any idea? Thanks in advance.

    I have tried the execute immediate command but the
    sql was loo long.So you already know that if you have "dynamic" tables then you need "dynamic" sql.
    It's at this point you should ask yourself if "dynamic" tables are really the best solution for your database design.
    Clearly, any application written against the database needs to know what tables it is accessing and, likewise, this should make you think that it's perhaps a good idea that the tables are known at the time the application is designed.
    What is your requirement for having tables with similar names but different suffix's?
    The classic design fault is people who create seperate tables for certain time periods i.e. each month a new table is created for that month of that year. This of course leads to the problem of dynamic tables and dynamic queries.
    In such a situation, the better design would be one of the following...
    a) if you have the partitioning option on your oracle database, create your table with partitions for the required sub sets of data. Partitions can be added, truncated or removed without the table name changing. They can also help the queries to perform faster as the optimiser will be able to determine what partitions it needs to access to get the data.
    b) if you don't have partitioning then consider including relevant columns in the table to provide the relevant sectioning of data. With suitable indexes this can be just as performant, even with a lot of data.
    ;)

  • Dynamically changing name of JPA Table via @Table(name=..)

    In my application I need to change dynamically the name of a table to create, which is annotated
    via @Table(name="MyTable")
    The problem is that the application handled all tables with an internal prefix so that MyTable would
    be changed to something like "application1_MyTable". In xml mappings it is possible by injecting
    a modified version of the xml mapping content, in plain jdbc only dynamic statements must be used
    for this kind of renaming. But how can I achive this with (immutable) annotations?

    Serethos_0 wrote:
    No, I'm betting that you really don't.
    Sounds like a very bad design.
    I'd be shocked if you could manage to give a good, coherent reason beyond "because I said so".There is always a trap which can force you to support a bad design despite better knowledge:Or, if you're really smart, refactor the trap out of existence.
    legacy issues. Depending on the project an old chunk of application code lets you only change
    design to a certain degree (based on time, effort, dependencies to other systems). In my case
    there is a need to keep the distinction of tables by a dynamic prefix.I'll agree that I might not understand fully. Why not temporary tables or materialized views? Is your idea the only way to accomplish this?
    %

  • How to dynamically change the table name inside a view

    Hi All,
    create table t_auto_feeds
    id number,
    table_name vachar2(100));
    insert into t_auto_feeds values(1,'T_FEED_POSITIONS');
    insert into t_auto_feeds values(2,'T_KAP_MTM');
    assume there are 100 records on id=1 in T_FEED_POSITIONS and 100 records of id=2 in T_KAP_MTM (id 1 is present only in t_feed_positions & id 2 is present only in t_kap_mtm)
    i need to create a view such that it needs to give the count of records based on the id
    create or replace view aa_view as
    select count(*), id from t_feed_position group by id
    union
    select count(*), id from t_kap_mtm group by id;
    I am getting a proper result when i query the view like select * from aa_view where id=1 but will the other union query seems to be a overhead?. I am having 10 such tables configured for different id in t_auto_feeds.so do i need to put 10 unions or is there a better way to handle this stuff.
    I know i can use a PLSQL block and dynamically build view structure, the problem is the view itself is configured in a table , so i cant write a proc for this.. can this aa_view be modified such that it queries only the table(using the t_auto_feeds ) which matches the id rather than the entire list.
    Kindly help me in this regard and let me know in case u need any further information from my side.

    >
    so do i need to put 10 unions or is there a better way to handle this stuff.
    >
    Yes - you need 10 unions
    Yes - there is a better way so that only one of the 10 queries does anything.
    You can use SYS_CONTEXT to control the query selection.
    Here is an example of using SYS_CONTEXT. Try this code in the SCOTT schema.
    create or replace context VIEW_CTX using SET_VIEW_FLAG;
    create or replace procedure SET_VIEW_FLAG ( p_table_name in varchar2 default 'EMP')
      as
      begin
          dbms_session.set_context( 'VIEW_CTX', 'TABLE_NAME', upper(p_table_name));
      end;
    select * from emp where 'EMP' = sys_context( 'VIEW_CTX', 'TABLE_NAME' );
    select * from emp1 where 'EMP1' = sys_context( 'VIEW_CTX', 'TABLE_NAME' );
    select * from emp2 where 'EMP2' =  sys_context( 'VIEW_CTX', 'TABLE_NAME' )
    exec set_view_flag( p_table_name => 'EMP' );
    exec set_view_flag( p_table_name => 'EMP1' );
    exec set_view_flag( p_table_name => 'EMP2');
    SELECT sys_context( 'VIEW_CTX', 'TABLE_NAME' ) FROM DUAL
    CREATE VIEW THREE_TABLE_EMP_VIEW AS
    select * from emp where 'EMP' = sys_context( 'VIEW_CTX', 'TABLE_NAME' )
    union all
    select * from emp1 where 'EMP1' = sys_context( 'VIEW_CTX', 'TABLE_NAME' )
    union all
    select * from emp2 where 'EMP2' =  sys_context( 'VIEW_CTX', 'TABLE_NAME' )
    SELECT * FROM THREE_TABLE_EMP_VIEWNote that you set the context for the table you want. This doesn't have to be a table name it could just be flag value
    -- use the emp table
    exec set_view_flag( p_table_name => 'EMP' );
    -- ue the emp1 table
    exec set_view_flag( p_table_name => 'EMP1' );
    -- use the emp2 table
    exec set_view_flag( p_table_name => 'EMP2');

Maybe you are looking for

  • Allocating costs to service orders

    Hi All, I have a scenario I'm hoping one of you may be able to help me with. Currently when an external service technician carries out work at a customers site the costs related to that work are booked to a single service order. This work however may

  • Missing movement type data in 0IC_C03 cube

    Hi Gurus , i  have deltas running for 0ic_c03 cube in B1 7.0 i have used transformations for loading cube . In a report of this cube for plant material stock,  i can c the quantities matching with MB51  report of R/3 where as the values are not match

  • Business partner "PaymentTransactionInitiator" is missing

    Hi Experts, I am implementing PO processing scenario in SNC 7.0. When the payment is processed from ECC,  the IDOC REMADV is triggered from ECC and it is sent to SNC (via PI). But when the respective XML message reaches SNC, it falls over with follow

  • HDD Protection System Service Disabled

    Toshiba PC Health Monitor - HDD Protection System Service is disabled, how can I enable

  • DateTime problem (java.util.*)

    GregorianCalendar day=new GregorianCalendar();           s=day.getTime().toString();           System.out.println(s); // It displays like this           //Wed Aug 31 13:33:19 GMT+06:00 2005 //I want to get only this: //Aug 31 2005 HOW CAN I DO THIS..