Table name should be concatenated with month & year eg.product_may09

hello all,
I have to take a backup of table on monthly basis. for this table name should be concatenated with previous month and year eg., product_may09.. I tried with Create table stmnt its not working anyone please help.

It would be very generous from you if you would provide us with versions, what you did and what's not working (maybe an error message?)...
Anyway; If I got you right you want to create a backup table with the same structure and data as in your base table?
maybe this:
forms_ddl('create table product_'||to_char(sysdate, 'monyy')||' as select * from product');fits your requirement. This creates you a table with the same structure and data as your basetable (except the primary/foreign keys, indices and trigger you have on the basetable).
But if you have to do this every month by hand I'd go for a database job which runs once a month with the above statement. In database procedures you have to use execute immediate instead of forms_ddl; usage is the same (except execute immediate raises intelligent exceptions in contrary to forms_ddl). take a look at http://tahiti.oracle.com and search after dbms_job or dbms_scheduler (depending the database version you use which you also didn't mention)
regards

Similar Messages

  • Change of Month names as per selection of Month / Year

    We have the following requirements:
    1. Change of Month names as per selection of Month / Year e.g. If the user select April 08 then the column name should be April 08, at the same time the next column should be April 07.
    2. Next there are two in -line totals as per different logic as recurring rows. e.g Row header is Total and it totals the items in the column, next row header is Comparable total and it is based on checking the adjacent column values for doing the total.
    Please let us know if this is feasible and can be done using BI Publisher. If you have any alternate way of doing it using OBIEE also , please share.

    Hi,
    The parameter / prompt used is for month which can have values from JAN , feb, MAR, APR,....... DEC. and the other PROMPT being YEAR e.g. 2006, 2007, 2008.
    The Column Name of the Report SHould get changed as April 08 if selected as month APril and year 2008.The subsequent column of the report should be April 2007. The same applicable for selecting any month/ year
    Layout of Report as below
    SALES
    || April 08 || April 07
    Shop1 100 200
    Shop2 300 100
    Thanks
    NJ

  • I own CS6 from DVD and have just upgraded (by paying) for Creative Cloud. Is there an upgrade price or do I just start with monthly/yearly subscriptions to CC2014?

    I own CS6 from DVD and have just upgraded (by paying) for Creative Cloud. Is there an upgrade price or do I just start with monthly/yearly subscriptions to CC2014?

    You get a discounted first year on your subscription if you own a previous product, which you should have been asked for when signing up.
    Mylenium

  • Table name should have sysdate

    Is there a way I can create a table and table name has sysdate attached to it?
    something like create table mysample_yyyymmdd
    So my create table statement would be like
    create table mysample_yyyymmdd as select * from emp;
    Everytime I give the above, it should substitute yyyymmdd with sysdate

    But aside from all the answers telling you how to do it, the main thing should be a question asking why on Earth you would want to do that?
    Table names should be known, not dynamic.
    If there is a need to mark data in some sort of group or set, then this information should be stored inside the table as data.
    In terms of data warehouses we would use dimensions and partitioned tables. In terms of regular relational tables we would probably just store a datestamp against each record and again perhaps use partitioned tables.
    Really you should be looking at what you are trying to achieve overall.
    Dynamic tables names are generally considered a Bad Idea ^tm^

  • Table name for Invoice created with PO ref

    hi,
    I required Table name for Invoice created with PO ref.
    Regards,
    Ali

    HI,
    Check the table RSEG: Document Item: Incoming Invoice
    Look for the fields BELNR and EBELN
    Regards
    KK

  • Table name for sales order with Customer info

    Hi Gurus,
    Could you please provide me table name for  sales order with customer no and customer name.
    I have list of sales order number (more than 1000 no's ) i need to identify customer number and customer name (ship to party and sold to party information). I am running this report every week. so i plan to create sqvi for this report.
    Thanks and regards,
    B.Deethya.

    Hello,
    Access Tables VBAK & VBAP.
    From the above tables you will get Solt to Party & Ship to Party Codes.
    For Customer names you have to pass the Customer Codes to Table - KNA1
    Hope this clarifies.
    Thanks,
    Jignesh Mehta

  • Finding column,table names in a schema with search data

    Hi All,
    I want to list all the columns,tables in a schema with any search value.
    Ex: Take an example of EMP table, if I search with 'MARTIN', result should be ename (column name) , emp(table name).
    Can you please help me on this regard to write a query.
    Regards,
    Rajasekhar

    SQL> set line 1000
    SQL> VAR val VARCHAR2(30)
    SQL> execute :val:='SMITH';
    PL/SQL procedure successfully completed.
    SQL> SELECT   DISTINCT
      2               SUBSTR(:val, 1, 11) "Searchword",
      3               SUBSTR(table_name, 1, 14) "Table",
      4               SUBSTR(t.COLUMN_VALUE.getstringval(), 1, 50) "Column/Value"
      5  FROM     cols,
      6               table(XMLSEQUENCE(DBMS_XMLGEN.getxmltype(   'select '
      7                                                        || column_name
      8                                                        || ' from '
      9                                                        || table_name
    10                                                       || ' where (UPPER('''
    11                                                       || :val
    12                                                       || ''')=UPPER('
    13                                                       || column_name
    14                                                       || '))').EXTRACT('ROWSET/ROW/*'))) t
    15  WHERE    table_name IN ('EMP', 'DEPT','EMPLOYEES') --limiting the table names, you can omit this.
    16  ORDER BY "Table";
    Searchword                                   Table                                                    Column/Value
    SMITH                                        EMP                                                      <ENAME>SMITH</ENAME>
    SMITH                                        EMPLOYEES                                                <LAST_NAME>Smith</LAST_NAME>

  • Table name for background job with report, variant and step user id list.

    Hello All,
    I need to generate the list of scheduled backgroung job with the list of Report Name, Variant, Step User Id called. Please any one tell the SAP Table name from which I can get these data.
    Thanks in Advance,
    Amit

    Hi Rohit,
    Thanks for your reply. But from TBTCO, i can't find program/report name and variant. Just the list of background job i can see.
    Regards,
    Amit

  • *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

  • A name should not start with any special characters

    I need to put a condition in iF statement such that a name that is given by the user should not start with any special charecters.A dialog box should display indicating this conditon.Can u plz give sample code for this.My code is as below.
    //text box for giving the name
    JTextFeild ReportNameText;
    //the name is stored in String
    String name=ReportNameText.getText();
    //Here tell me how the if condition should be written
    //condition to be mentioned

    Already asked, and answered, here: http://forum.java.sun.com/thread.jspa?threadID=727919
    See reply 4 in that thread, and scsi-boy's suggestion of writing another
    method to check for "special" characters. And the links to the String
    and Character API documentation given.

  • Table name for work centers with production or planned orders

    dear gurus,
    can you please help me on what table names have the work centers with planned or production order

    For production Order
    1.AUFNR ---> AFKO ---> AFKO-PLAF
    2.AFKO-PLAF --> AFVC -
    >  for respective VORNR get AFVC-ARBID
    3.AFVC-ARBID --> pass as  OBJID into ---> CRHD --->ARBPL (Work Center)
    For planned orders
    1.PLNUM ---> PLAF ---> PLAF-BEDID
    2.PLAF-BEDID -
    > KBKO ---> PLAF-PLNNR, PLAF-PLNAL
    3.PLAF-PLNNR, PLAF-PLNAL -
    > PLPO -
    > for corresponding VORNR (Operation number) get ARBID pass as OBJID ---> CRHD --> ARBPL (Work Center).
    Regards
    soundar
    Edited by: Soundar on May 29, 2008 9:18 AM

  • Is it possible to get the containing table name of a UDT with ToCustomObj?

    Hi,
    I got several UDTs that I use in various different tables, in order to update them I need to know which table they came from (I handle updates manually). I'm looking for a way to store the table name the UDT came from in the ToCustomObject method during mapping. Is it possible to do that?

    Acutally, i wanna make clear about the concept of a "Thread"
    Is it true that ..
    the main() method is a thread , once I create another thread in the program , both of (or all of them) will contains it owns stack exception information ?
    My english is poor, please try to understand it. Thx

  • Pass table name as parameter in prepared Statement

    Can I pass table name as parameter in prepared Statement
    for example
    select * from ? where name =?
    when i use setString method for passing parameters this method append single colon before and after of this parameter but table name should be send with out colon as SQL Spec.
    I have another way to make sql query in programing but i have a case where i have limitation of that thing so please tell me is it possible with prepared Statment SetXXx methods or not ?
    Thanks
    Haroon Idrees.

    haroonob wrote:
    I know ? is use for data only my question is this way to pass table name as parameterI assume you mean "how can I do it?" As I have already answered "is this the way?" with no.
    Well, I would say (ugly as it is) String concatenation, or stored procedures.

  • Import table with a different table name!

    Dear All,
    I have backup all users in my database using exp command.
    Now i want to import 2 tables from this backup, as tables already exists i want to import table with different table name.
    Is it possible with exp command? If not what else is the solution.
    Thanks, Imran

    Hi..
    Now i want to import 2 tables from this backup, as tables already exists i want to import table with different table name.Is it possible with exp command? If not what else is the solution.
    >
    Well, its not possible.You can import those two tables in some test database, rename them and then take the export and import in the database you want.
    Or,
    You can import those 2 tables in some other schema in your database, rename them again take the export and them import it.
    Anand

  • How to retrive table names with Java?

    Hello!
    If I connect to my Oracle Database 10g Express Edition Instance with some Java code and I run the following code:
                   ResultSet resultSet = databaseMetaData.getTables(null, null, "%", types);
                   while( resultSet.next() )
                        String tableName = resultSet.getString(3);
                        System.out.println(tableName);
    I get loads of different names of tables beside those that belongs to my user like:
    DR$NUMBER_SEQUENCE
    DR$OBJECT_ATTRIBUTE
    DR$POLICY_TAB
    ARTICLES
    BIN$tQZXQ0iGufbgQAB/AQELFg==$0
    BIN$tQZXQ0iLufbgQAB/AQELFg==$0
    But when I log in to http://127.0.0.1:9090/apex I get a perfect list of the tables belonging to the user:
    ARTICLES
    CUSTOMERS
    DATATYPES
    ORDERROWS
    ORDERS
    REQUESTROWS
    REQUESTS
    SUPPLIERROWS
    SUPPLIERS
    Does any one understand how to access just these table names that is created with my user?
    Best regards
    Fredrik

    Hello Adrian!
    Yes you are right I now understand that this is the wrong forum.
    So I posted the "same question" at:
    How to retrive table names belonging only to a user?
    How ever I seems to have problem with the schema name parameter any way.
    Best regards
    Fredrik

Maybe you are looking for

  • My HP F4180 not working with my Mac Mini

    My HP F4180 will not work with my Mac mini. I doesn't even like my set up disc. Please advise. Thank You.

  • Why won't Creative release a 60 GB Vision:m alrea

    it's to my utter surprise that creative is still stalling their release of higher capacity vision:m's. With mention of Toshiba's 30 AND 60 GB mp3 player/PMC coming out before the end of march and apple's tremendous success with the 60 GB 5G ipods whi

  • Problem with multiple file download

    Good day. I have a code that downloads multiple files from the database and then saves it to a specified directory. I work fine but when I check the contents of the file, some of them are not complete. Lets, say I have downloaded 16 files and only fi

  • Update Pricing is not picking the latest price!.

    We have a pricing type ""X" Copy manual pricing,frieght,upcharge and Redetermine Others.User is expected to get the latest price using this option ?. when tried to use this X , system does not get the latest price but it is picking from the sale orde

  • Is 15 second for log archiving acceptable ?

    Version : 11.2.0.3 Platform : RHEL 5.4 3-Node RAC DB in ARCHIVELOG mode Question1 ============ As you can see below sometimes it takes upto 15 seconds for the archiving of Redo logs. Online redo log switching is happening fast though . It takes less