name of the dynamic table in a view

How can I create a view of a table whose name is dynamically determined?

for example, I have tables for each month table_2010401, the table_201402, the 201403 table and so on. I need to extract the data from the last table. This is more or less what I want to do:

CREATE OR REPLACE VIEW VW_TABLE

AS

SELECT * FROM

(SELECT TRIM (MAX (TABLE_NAME)) FROM ALL_TABLES WHERE TABLE_NAME LIKE 'POL_LINK %' AND OWNER = 'ACTUARYD')

);

Can anyone help? Thank you in advance.

Most approach simple and straight forward it would be to recreate every month a CURRENT_TABLE view or a synonym that points to a table 'current' - table_2010401 or table_20140301.

You can recreate this view, or synonym every month just after creating the table current.

Another approach would be to create a view based on a function of pipeline that derives from a necessary table name and uses dynamic SQL statements to get the lines of him to channel them in the view.

Tags: Database

Similar Questions

  • Problem with the name of the dynamic Table

    Hi all

    I can't using a dynamic table name. I have the following code...
    declare l_cur sys_refcursor;
    l_ID int;
    l_tableName varchar(30);
    BEGIN
    
    open l_cur for
    select hkc.ColumnID, mapping from &HKAPPDB_Schema_Name..doctablemapping ddm
    inner join &HKDB_Schema_Name..HKColumns hkc on hkc.doctablemappingid = ddm.id
    where ddm.id > 0;
    LOOP
         FETCH l_cur into l_ID, l_tableName;
         EXIT WHEN l_cur%notfound;
                
         -- update missing VerbID in DocumentDocMapping table
         UPDATE &HKAPPDB_Schema_Name..IndexedDocument 
         SET VerbID = (SELECT t.VerbID 
                             FROM (SELECT DocRef, VerbID, DateUpdated 
                                  FROM &HKAPPDB_Schema_Name..l_tableName dd        - this is where the dynamic table name is used
                                  WHERE dd.VerbID is not NULL))
         WHERE HKColumnID = l_ID AND VerbID is NULL;
    
    END loop;
    end;
    /
    When I try to execute it I get an error

    ORA-00942: table or view does not exist

    What I am doing wrong?

    Kind regards
    Toby

    You cannot use a variable instead of a table name. You must build the dynamic SQL. Search for IMMEDIATE EXECUTION or DBMS_SQL in Document Oracle.

  • Name of the dynamic table is possible?

    Hi guys,.

    I have fact tables every day with the same structure, each table in a day: fact20090701, fact20090702 etc.
    Every night a new table is created.

    Database is Oracle.

    I need a single command prompt date and then run a query on the corresponding table.

    Is this possible?

    Direct application of the database is not an option.

    Thank you
    Alex

    Hello

    In the physical layer, go to table special and double click on it (go to properties) > general tab.
    You will find the option use dynamic names. When you click on this it asks the name of the variable.

    so, you must create a session variable that contains the dynamic value. And use it here...
    SQL is something like: SELECT 'fact' | to_char (sysdate, 'yyyy') | to_char (sysdate, 'mm') | to_char (sysdate, 'dd') block initialization
    assign it some variable... He uses...

    Hope this helps you...

  • name of the dynamic table

    In the ODI interface, can a target table name be specified dynamically? For example, the name of the table will be decided until a variable is updated in the package. The target table must also an AK force.

    Use a smaller name and project code before the variable.

    Do not use a '_' before the ' # '.

    Something like:

    TEMP_MIL #PROJECTCODE.v_thread_number

    In addition, if you use Oracle as technology, go to the topology, the physical Architecture, modify the technology itself and the language tab, let the delimiter 'object' to nothing.

    Let me know if works...

    Published by: Cezar Santos on 29/01/2009 16:55

  • Data does not save in the dynamic table

    My form has been active player and all the information can be recorded with the exception of the data entered by the user in the dynamic table.

    Should I change the binding of data?

    https://Acrobat.com/#d=SWkT2mrJBJbxk * QJGmN0Ng

    Appreciate any help!

    Tracy

    Hello

    OK, I found the root of all evil.

    To resolve this problem, you need to replace the script that caculates the dates in the dynamic table by another.

    Go to table calculate a remove the event script.

    Then, select the Date field in the first row of the table and add this script to its change event.

    var StartDate = $event.newText
    var DateFormat = "MM/DD/YY"
    
    if (StartDate ne $event.prevText) then
              var selectedDate = Date2Num(StartDate, DateFormat)
                var selectedDay = Num2Date(selectedDate, "DD")
              var selectedMonth = Num2Date(selectedDate, "MM")
              var selectedYear = Num2Date(selectedDate, "YY")
              var firstDay = Date2Num(Concat(selectedMonth, "/", "01/", selectedYear), DateFormat)
              var lastDay = 0
              var dayNumber = firstDay
    
              $event.change = Num2Date(firstDay, DateFormat)
    
              for i = 0 upto 30 step 1 do
                        if (Num2Date(firstDay, "MM") eq Num2Date(dayNumber, "MM")) then
                                  dayNumber = dayNumber + 1
                                  lastDay = dayNumber
                                  Table._Row.addInstance(1)
                                  Table.Row[i].Date = Num2Date(dayNumber - 1, DateFormat)
                                  Table.Row[i].Day = Num2Date(dayNumber - 1, "EEE")
                        endif
              endfor
              Table._Row.removeInstance(Table._Row.count - 1)
    endif
    

    https://Acrobat.com/#d=qEVfk * AbNz5qfmJqF * BovA

  • Find the name of the underlying table for ViewObject in AMImpl

    Hi all

    I have a method where I would like to extract the name of the underlying table based on top of which I have my ViewObject in my AMImpl datamodel. Is there a way I can do?

    Thank you

    User,

    In general, non - case because display objects can be based on arbitrary SQL queries that have more than one table. If the ViewObject is based on entity objects, you can call getEntityDefs() on the VO then getSource() on the EntityDefs to get the source of table names.

    John

  • Name of the dynamic property of object in the table based on the value of a variable

    I have two paintings of custom class objects

    var obj1:Object1
    var obj2:Object2
    
    var array1:Array = [obj1[0], obj1[1], ...]
    var array2:Array = [obj2[0], obj2[1], ...]
    

    Object1 has a property named. Name while Object2 has a property named. Title.

    Now I have a common function including cab accepts an array (array1 or array2) and the name of property the object ("Name" or "Title") as input and needs to access this name of the property of the objects in the array:

    function myFunction(arr:Array, fieldName:String)
    {
        arr[0].fieldName  = "xxx";
    }
    

    the problem I have this achievement does not because the code in the function assumes that the property of that object in the table is actually a string "fieldName" while I want to dynamically determine the names of the fields based on the value of this variable, but cannot understand the syntax to do!

    Don't know if I'm clear - hope that makes sense... ;-) Thank you

    Hey p3pp3r,

    I think I understood you. Try the following and see if you get good results:

    function myFunction(arr:Array, fieldName:String)
    {
        arr[0][fieldName]  = "xxx";
    }
    

    Let me know how it turns out. Good luck!

  • Name of the dynamic pageFlowScope variable on a page of amx, possible?

    Hi all

    I have a problem that I can't seem to move at the moment. I have java classes that try to update some data, and if it is not successful it returns the ID of the control that contains the error. Then I take this control id and use it to highlight the field in error so that the user knows where it is. Usually, this works very well for any other than to a list view.

    For a grid/listView error control is returned in the form of something like "1.14" of the appeal of java, this is equivalent to the number of the line '1' and the id of the control "14". I can easily strip away the '. ' in java but I need a path in my AMX page to define a variable on the fly for example pageFlowScope #{pageFlowScope. {{} row.rowKey} 14} but I get EL analysis of errors try like this, the error is "ERROR_EL_PARSER_NESTED_EL_NOT_SUPPORTED". Basically, I'm trying to have conditional styles depending on whether E {pageFlowScope.114} is set to 1 or not. I can't imagine a better way to implement this in a listView?

    I can only suggest a medium crude to achieve.

    One way to see dynamic values in EL is to use a hash table and use the dynamic value as the key. I would record a HashMap per input element and then store the error with the line indicator not. You can even create your own implementation of HashMap and hoist the flag when running by overloading the get method.

    [For example #{pageFlowScope.elem14ErrorMap [row.rowKey}]

  • Create procedure upsert (name of the existing table, incoming table name)

    Is it possible to create a procedure that makes a merge (upsert) with only two parameters:

    1. Existing Table name - name of table that will have data merged into it.
    2. Incoming Table name - name of the table that has developed data day/news.

    The method would be:

    1. Use primary keys on the "existing" table as the condition links
    2. Fact and update if exists and insert new
    3. no record
    4. no clues
    5. no removal clause

    Oracle 11g

    MERGE < tip > < table_name >

    USING < table_view_or_query >

    (< CONDITION >)

    WHEN MATCHED THEN < update_clause >

    DELETE < where_clause >

    WHEN NOT MATCHED THEN < insert_clause >

    [ERRORLOG < log_errors_clause > < reject limit < integer | unlimited >];

    < table_name > - from input parameter

    < table_view_or_query > -socket input parameter

    < condition > - primary key links (how search a single/multiple primary keys and return the list?)

    < update_clause > - update all columns (other than KP, how to get and use a dynamic list of columns)

    < where_clause > - not used

    < insert_clause > - insert new records for all columns (including the PK (s))

    declare

    p_source varchar2 (30): = "EMP_X";

    p_target varchar2 (30): = "EMP_Y";

    query varchar2 (32000);

    function get_cols (p_table in varchar2) return varchar2 is

    VARCHAR2 (32000) retval;

    Start

    Select the Group (order of column_id) listagg (column_name, ',')

    in retval

    of user_tab_cols

    where table_name = p_table

    Table_name group;

    Return retval;

    end;

    function get_keys (p_table in varchar2) return varchar2 is

    VARCHAR2 (4000) retval;

    Start

    Select listagg (cc.column_name, ',') in the Group (order by cc.position)

    in retval

    from user_constraints c,.

    user_cons_columns cc

    where cc.table_name = p_table

    and c.constraint_type = 'P '.

    and cc.table_name = c.table_name

    and cc.constraint_name = c.constraint_name

    C.table_name group;

    Return retval;

    end;

    function merge (p_merge1 varchar2, p_merge2 varchar2, p_link varchar2) return varchar2 is

    Merge1 varchar2 (32000): = p_merge1 | «, » ;

    merge2 varchar2 (32000): = p_merge2 | «, » ;

    VARCHAR2 (32000) retval;

    Start

    then merge1 is not null

    loop

    retval: = retval | » t.'|| substr (Merge1, 1, InStr (Merge1, ',') - 1) |'s =.' | substr (merge2, 1, InStr (merge2, ',') - 1);

    Merge1: = substr (merge1, instr(merge1,',') + 1);

    merge2: = substr (merge2, instr (merge2, ',') + 1);

    If merge1 is not null then

    retval: = retval | p_link;

    end if;

    end loop;

    Return retval;

    end;

    Chopper (p_cols p_keys varchar2, varchar2) return varchar2 is

    passes varchar2 (32000): = ', '. p_cols | «, » ;

    keys varchar2 (32000): = ', '. p_keys | «, » ;

    VARCHAR2 (32000) retval;

    Start

    While the keys! = «, »

    loop

    If instr (passes, substr (keys, 1, instr(keys,',',1,2))) = 1 then

    cols: = substr (collars, instr(cols,',',1,2));

    on the other

    cols: = substr (passes, 1, instr (passes, substr (keys, 1, instr(keys,',',1,2))) | substr (collars, InStr (collars, ',', InStr (passes, substr (Keys, 1, InStr(Keys,',',1,2))), 2) + 1);)

    end if;

    keys: = substr (keys, instr(keys,',',1,2));

    end loop;

    return trim (both ',' collar);

    end;

    Start

    query: = 'merge'. p_target |' t ' |' using (select ' | get_cols (p_source): ' from ' | p_source |') s '.

    ' on ('|) Merger (get_keys (p_target), get_keys (p_source), 'and') |') ' ||

    "When matched then update set ' | '. Merger (Chopper (get_cols (p_target), get_keys (p_target)), Chopper (get_cols (p_source), get_keys (p_source)), ',').

    «When not matched then insert ('|)» get_cols (p_target) |') values (s.'|) Replace (get_cols (p_source),', ', ', s') |') ';

    dbms_output.put_line (Query);

    end;


    Fusion in EMP_Y t using (select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO EMP_X) s on (t.EMPNO = s.EMPNO and t.ENAME = s.ENAME) when matched then update set t.JOB = s.JOB, t.MGR = s.MGR, t.HIREDATE = s.HIREDATE, t.SAL = s.SAL, t.COMM = s.COMM, t.DEPTNO = s.DEPTNO when not matched then insert (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) values (s.EMPNO, s.ENAME, s.JOB, s.MGR, s.HIREDATE, s.SAL, s.COMM, s.DEPTNO)

    Concerning

    Etbin

  • need help on the name of the column in double materialized view ORA-00957

    I have a query, long enough and several (8ways) joins.

    When I run it as a SQL query, it is fine.

    When I add create materialized, view myViewName it errors with
    ORA-00957: duplicate column name.

    How is there is no problem when executing the SQL statement, and how to fix this?

    Thank you.

    Hello

    Columns in a query do not need a unique name:

    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    D D
    - -
    X X
    

    At least not in SQL * Plus; other front ends might oppose it.
    In previous versions of Oracle, subqueries (such as online views) does not need to have unique names, but you've got an error if you tried to reference a non-unique column (and it is unnecessary to have the column if never reference you).

    Columns in a table or a view need unique names:

    CREATE OR REPLACE VIEW view_x
    AS
    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    ,     dummy
          *
    ERROR at line 4:
    ORA-00957: duplicate column name
    
  • Problem with the af:table links and views

    I want to display a table with data from a database table called PERSON, so I use af:table tag.

    The PERSON table has the following fields:

    • PERSON_CODE
    • PERSON_NAME
    • PERSON_COD_STATE

    The PERSON_STATE field is a foreign key to another table called PERSON_STATE:

    • PERSON_COD_STATE
    • DESCRIPTION

    I created a view for the data of the PERSON (personView) table. Because I want to show the person status description in the af: table, I created another view for the data in table PERSON_STATE (personStateView). And I've also created a link between personView and personStateView.

    In the column of the af: table that represents the State of no one, I drop the field 'description' of the State view linked to the view of anyone.

    When I run the JSP, the State is not displayed correctly. All persons are displayed with the same State.

    During the test directly with the application module, the display link works correctly.

    View links inside an af:table work?

    I work with ADF 10 g.

    Thank you

    Your scenario should be treated with a sql (VO on two EOs) join with a relationship master / detail. The table will be able to browse the details for each master record to time stamping.

  • Create a Trigger - what is the name of the new table?

    Hello

    I want to implement a new trigger (CREATE TABLE) on my database only for specific tables in a table space.
    As far as I know, I have to set the trigger for the entire database and filter tables in the trigger to
    that I want to do any action.

    It's my first try:

    CREATE OR REPLACE TRIGGER compress_new_tables
    AFTER CREATE ON THE DATABASE
    BEGIN
    dbms_output.put_line ("' new Table name");
    END;
    /

    Unfortunately I do not know how to determine the user as well as the name of the table that was created.
    Could someone help please?

    Py wrote:
    Hello

    I want to implement a new trigger (CREATE TABLE) on my database only for specific tables in a table space.
    As far as I know, I have to set the trigger for the entire database and filter tables in the trigger to
    that I want to do any action.

    It's my first try:

    CREATE OR REPLACE TRIGGER compress_new_tables
    AFTER CREATE ON THE DATABASE
    BEGIN
    dbms_output.put_line ("' new Table name");
    END;
    /

    Unfortunately I do not know how to determine the user as well as the name of the table that was created.
    Could someone help please?

    http://www.morganslibrary.org/reference/ddl_trigger.html

  • Only of first line of the dynamic table records in pdf format

    Please help me with this.  I have a dynamic array in an xdp which can be transformed by adding lines (called the details).  It seems to work in the browser, when I edit.  However, when I save as pdf, saves only the top line.  No idea why the entire table is not save the PDF?  Thanks in advance.

    I compared files markup of the xdp to form that works and one that does not.  I found that there is a line named templateDesigner expand {BTW dough doesn't seem to work in this window here, which is irritating}.  In any case, the form that did not work, it was 0 and in those who worked it is 1, so I guess that's why.

    I wanted that are correlated with a checkbox in the hierarchy of the Adobe Livecycle Designer GUI, but I would not again and now I have other projects to work on.  However, I hope this will help others with this problem.

    If anyone knows where the checkbox for this is the hierarchy in Adobe Livecycle architects, thanks for posting here.

    I used the tool of comparison was SVN diff, which opens WinMerge if installed on your machine.  The two form of work in a * powerful * tool of comparison.

    Of course, the xdp editing can be very risky, so be careful if you go this route.

    Thank you!

  • cannot find the table name of the multiple tables which has more columns.

    Hello

    I'm trying to find the NAME of the TABLE from multiple tables which has more columns. I can't count the number of columns in the table, but cannot find the name of the table that has larger columns in other tables.

    SELECT TABLE_NAME, COUNT (*) FROM THE USER_TAB_COLUMNS WHERE TABLE_NAME LIKE '% LOC' GROUP TABLE_NAME


    Thank you.

    in SQL, you can try this:

    var v_name varchar2(40)
    
    begin
       with
          subq1 as ( select table_name, count(*) as column_count from user_tab_columns where table_name like 'FIBER%'
                         group by table_name
                         order by count(*) desc )
       select table_name
         into :v_name
        from subq1
       where rownum = 1;
    end;
    

    To get the result:

    select :v_name from dual
    

    The clause "with" brings together all the tables and ordered them all first, by the greatest number of columns
    The final query uses the rownum restriction so that it takes the first name from the table of results of the subquery.

    The restriction of rownum also exactly guarantees a result each time so that it will work with the variable binding.

    RP

  • Number of item in the dynamic Table Quirk

    I am a new user of LC, ramping up the speed on this package, thanks to all for the useful information here and elsewhere.

    By using the tips and info here,

    http://www.assuredynamics.com/wp-content/uploads/2010/11/assure-Dynamics-building-dynamic-tables.PDF

    I added a dynamic array of a form, I've worked on that.  Mostly, everything works, except the legend on the number of line/article.  So I yanked on the subform with the table top to create a single copy of the form to post here.  Get this... it works on the simple form.  So there is something to do in my not so simple form which prevents my line/workstation number.

    I hope if I post here the two forms, can someone help me solve this thing.

    It's the form that works:

    http://inthequeue.com/adobeLC/Template_excerpt.PDF

    It's the shape that doesn't work:

    http://inthequeue.com/adobeLC/Template_std.PDF

    Thanks in advance

    John Q.

    Hi John,.

    Try to change the code in the layout event: ready to go;

    This.Caption.Value.Text = (this.parent.index + 1) m:System.NET.SocketAddress.ToString ();

    TO;

    This.Caption.Value.Text.Value = (this.parent.index + 1) m:System.NET.SocketAddress.ToString ();

    It's adding another "value".

    Your form that works target Reader 8.0 or later and who only targets Reader 9.0 or later, I guess that's the difference.

    Concerning

    Bruce

Maybe you are looking for

  • I can't use the Microsoft support page. Why?

    I have a problem connecting to MSN Messenger and my Windows Live Mail says he has encountered a problem and needs to close. I think it is perhaps something to do with my recent download of QQ International. My friend can connect to their account usin

  • How can I restore icons to my system tray?

    I had a virus attack on my computer.  All viruses and maleware are removed, but now some functions were not restored.  How can I restore icons to my system tray?  I selected the options I want in the bar of tasks and Start Menu Properties dialog box

  • Y at - it a utility to monitor the speed, temperature and cpu/gpu for desektop m9200T fan?

    My desktop running Win7 Home Premium m9200T computer crashes often.  It seems to be associated with temperature. I tried SpeedFan, but my computer crashed whenever I ran it.  The SpeedFan 20 window scroll a few lines of text that the computer crashed

  • Microsoft set the Solution Center still available?

    Hello I clicked on my shortcut on the desktop of Microsoft Fix Solution Center and discovered that this software Center is no longer available. It seems that something has changed in what concerns the Solution Center. The center of covered troublesho

  • New card mother = new license?

    I recently added a new motherboard, processor and RAM to my office.  After force-feeding of new drivers chipset via my installation disk, the computer started normally, as he did before the upgrade.  It now behaves very well except for this: I have t