Creating the table with time stamp

I need to create the table with the data inside buffer

Can you help me pls

If it works today,

create the table test_04NOV2010 in select * from product where product_code = '101'

If executed tmrw,

create the table test_05NOV2010 in select * from product where product_code = '101'
declare

v_date varchar2(25);
v_sql  varchar2(20);

begin

select to_char(sysdate,'DDMONYYYY') into v_date from dual;

 v_sql := ' create table ' ||TEST||'_'||'v_date'|| 
             ' as '
             ' select * from Product where product_code = '101'
          
 EXECUTE IMMEDIATE v_sql;

end;
can is it you pls let me know how to use it in PL SQL

Can you help me pls

Thank you very much
declare

v_date varchar2(25);
v_sql  varchar2(2000); --Noted this. this was also small.

begin

select to_char(sysdate,'DDMONYYYY') into v_date from dual;

 v_sql := ' create table TEST_'||v_date||
             ' as select * from Product where product_code = ''101''';

 EXECUTE IMMEDIATE v_sql;

end;

You can use the Q operator also.

DECLARE

v_date varchar2(25);
v_sql  varchar2(2000);

BEGIN

select to_char(sysdate,'DDMONYYYY') into v_date from dual;

 v_sql := ' create table TEST_'||v_date||
            Q'[ as select * from Product where product_code = '101']';

 EXECUTE IMMEDIATE v_sql;

END;

Published by: mohamed on November 4, 2010 05:32

Tags: Database

Similar Questions

  • record in the table with time stamp

    Hello
    I use Forms6i and db 10g
    I have a datablock in my form, which is based on a table hlp_user_master.
    The table has fields crt_on, upd_on. who is date type.
    Now I'm set sysdate to these areas, before saving it to the database.
    He is now in the database, just.
    But I want it to be like date with the time.
    My Manager said to set the data type of the fields in the form.
    I did the DateTime data type, in the form
    but still in the database, just when saving

    Help, please

    Hello
    If you have changed in the form of the datetime data type and the mask format as I said in my previous post. Then, the database will have time also after saving it. I guess that you are checking in via SQL * more. If so, try the following query.

    SELECT TO_CHAR(DATE_COLUMN,'DD-MON-YY HH24:MI:SS');
    FROM TABLE_NAME;
    

    If the form is stalling as it will display then with time.

    -Clément

  • Create the table with the environment variables

    Hi all
    When an event occurs, I would create a table by a planning procedure.
    I can create a table with these last or similar syntax:

    create table % s_ %t in select acme_ * from a;

    I would use this syntax because this event could be spend more time per day and so I can check.
    is this possible?

    Thank you very much
    Ciao
    Alberto

    Albertofro wrote:
    Hi all
    When an event occurs, I would create a table by a planning procedure.
    I can create a table with these last or similar syntax:

    create table % s_ %t in select acme_ * from a;

    I would use this syntax because this event could be spend more time per day and so I can check.
    is this possible?

    Thank you very much
    Ciao
    Alberto

    To dynamically create a table, you must use EXECUTE IMMEDIATE. If you want your table to be padded with timestamp name you can do it with the function TO_CHAR and SYSDATE.

    An example

    execute immediate 'create table acme_' || to_char(sysdate, 'DDMMYYYYHH24MISS') || ' as select * from a';
    
  • How to create the table with the description of the table

    Hello

    I would like to create the array with the description of the table (such as the creation of package or procedure with comments).

    Is it possible to achieve thanks to the oracle, if possible please help me achieve this goal.

    Thank you and best regards,

    Ibrahim Sayyed.

    > create table test (col1 number);

    > comment table test is "about a comment ';

    > select comments from user_tab_comments where table_name = 'TEST ';

    COMMENTS
    ____________________________________________________________________
    This is a comment

  • Syntex to create the table with the long data type

    I'm looking to create a table based on another table that having the column long data type. Throw the error ORA-00997: illegal use of the LONG data type


    I tired it

    create table abc_long (ag bgd long number);

    create table abc_long_dummy as ( ) Select *of abc_long); - ORA-00997 error: illegal use of the LONG data type

    How to get there?

    I'm looking to create a table based on another table that having the column long data type.

    You really don't want to do that.

    LONG data type has been deprecated for some time now, use CLOB.

    The TO_LOB() function will do the conversion on the fly:

    create table abc_long_dummy
    as
    select ag
         , to_lob(bgd) as bgd
    from abc_long ;
    
  • How to create the table with value list/map binding

    I need to display some values in a tabular format. It is possible to create a table adf without having value binds to a VO object. I can make a table with a combination of list/map.

    I want to change the format of display with minimum change in the application. I therefore seeks a change to a list/map and map with the table.

    Here is the structure in that I need to post.

    _______________________
    |     | Header1. Tete2 |
    |_______|_______|_______|
    | Txt R1 | value 1. Value 2.
    |_______|_______|_______|
    | Txt R2 | Value 3. value 4.
    |_______|_______|_______|

    All views is completely irrelevant. So I should not create a VO and add the VO object lines.

    Published by: yannick June 10, 2011 11:34

    Yes, you can do it. Create a pojo with properties (column) that you want to display in the table and create a list of instances of the POJO and then you can fill your table using the list.

    Sample:

    //POJO
    public class SamplePojo {
    
    private String col1;
    private String col2;
    
    public SamplePojo(String col1, String col2){
      this.col1 = col1;
      this.col2 = col2;
    }
    
    //add setter and getter methods
    }
    
    //Inside bean, prepare a list with pojo instances (Assume a getter exists for pojoList)
    pojoList = new ArrayList();
    pojoList .add(new SamplePojo("Value1", "Value2");
    pojoList .add(new SamplePojo("Value3", "Value4");
    etc.
    
    //Inside jspx
    
       
         
       
       
         
       
    
    

    HTH
    Jean Lou

  • How to create the table with the rows and columns using the layout?

    One of my friends advised me to put my site on the mode of provision as it is better than the standard as he said
    but I couldnot make an ordinary table with the rows and columns in mode available th
    y at - there someone who can tell me how to?
    Thank you very much

    Wednesday, April 18, 2007 21:01:38 + 0000 (UTC), "Mr.Ghost".
    wrote:

    > A friend of mine advised me to put my whole site on the mode of disposal as its
    > better than standard, as he says

    Your friend won't. Don't listen to him any more. Mode of disposal creates
    very fragile and rigid code pauses at the first opportunity.

    Gary

  • create the table with the parameters of storage in a locally managed tablespace

    Hello
    Can we create object with the parameters of storage in a locally managed tablespace.

    CREATE TABLE my_hash_table_6)
    name VARCHAR2 (30),
    value VARCHAR2 (4000))
    STORAGE)
    INITIAL 1 M
    NEXT 512K
    PCTINCREASE 0
    MINEXTENTS 2
    MAXEXTENTS UNLIMITED)


    default tablespace users is successful locallly.
    Then extended this table management will be managed according to the tablespace or storage settings which
    has been specified when the table was created.

    Hello

    This means that we don't have to define NEXT, PCTINCREASE, MAXEXTENTS at the object level.
    Then, these settings are applicable to Dictionary managed tablespace or what?

    Yes that's right, understand you is correct

    Can we define NEXT, PCTINCREASE, MAXEXTENTS at the level of the object in the dictionary managed tablespace;

    Yes, you can, but go for DMT, is not very good, because you advantages compared to LMT, just think about it before going to the DMT, than I suggest.

    -Pavan Kumar N
    Oracle 9i / 10g - OCP
    http://oracleinternals.blogspot.com/

  • Create the table with aliases for columns

    Hello

    I don't know if its possible, but how do I define aliases for columns when I create a table (in fact, a global temporary Table - TWG)? The idea is to select the column using its name or its alias, like this:

    SELECT nom_de_colonne FROM mytable

    or

    SELECT alias_de_colonne FROM MaTable

    I work with Oracle9i Enterprise Edition Release 9.2.0.1.0


    Thanks in advance.

    You do not define aliases when you create a table, when you choose him.

    I have to say... When you use it in a SQL statement (not just select).

    Published by: SomeoneElse 18 Sep, 2008 15:10

  • Could not commit: ORA-00928: lack of creating the table SELECT keyword

    Hello guys.
    I tried to create the table with web interface on oracle 11g.

    I just follow this path on interface: schema-> table-> create-> standard (lot organized)-> SQl select on (set using the)->
    and I just use these scripts to create the table:

    CREATE TABLE suppliers
    (the number (10) of supplier_id not null,)
    supplier_name varchar2 (50) not null,
    Contact_Name varchar2 (50)
    );

    but this error occurred: failed to commit: ORA-00928: lack of SELECT key word!
    Please lock on this picture for more information: http://s17.postimg.org/kgoumzmvz/attachment.jpg

    could you help me please?
    and I could not find any manual for working with the web interface in oracle 11g.
    Please give me somesources to start.
    Thank you.

    1003778 wrote:
    Thank you sybrand_b
    but I already read this document.
    Unfortunately, there is nothing on the creation of table with sql scripts in this document!

    and I really don't understand how to create table with SQL commands! My question has not yet been answered.
    you please give me little details about it?
    for example, how can create table using this sql command:

    CREATE TABLE suppliers
    (the number (10) of supplier_id not null,)
    supplier_name varchar2 (50) not null,
    Contact_Name varchar2 (50)
    );

    Thank you.

    Edited by: 1003778 may 3, 2013 11:43

    When you got to the CREATE TABLE screen, you have selected "set using the--> SQL.
    Did you notice in the window that appears, just above this entry field is this text: "enter a SQL * select * statement below.» ' + This query results will be used to fill the table with Canada.* + "(underlining)
    And hip, just to the left of this field is this text: «CREATE TABLE AS»

    He tries to build a ' CREATE TABLE AS SELECT... ». Creates a table with the same structure as the table in which you SELECT and fills with the results of this SELECT '. With your entry, you create a CREATE TABLE AS CREATE TABLE to read statement...

    If you want to create your tables with a simple CREATE TABLE command, go to sqlplus and do it. You want to have a graphical interface to help build a simple CREATE table, when you get to the CREATE TABLE page, just to stay there with the default "use Define-> column specification." If you want, after completing "build" your table specification here, you will have a "Show sql" option to show you the actual sql statement that will be executed to create your table.

  • overloading a DATE with time STAMP function to avoid the "too many declarations.

    CREATE OR REPLACE PACKAGE util
    AS
      FUNCTION yn (bool IN BOOLEAN)
        RETURN CHAR;
    
      FUNCTION is_same(a varchar2, b varchar2)
        RETURN BOOLEAN;
    
      FUNCTION is_same(a date, b date)
        RETURN BOOLEAN;
    
      /* Oracle's documentation says that you cannot overload subprograms
       * that have the same type family for the arguments.  But, 
       * apparently timestamp and date are in different type families,
       * even though Oracle's documentation says they are in the same one.
       * If we don't create a specific overloaded function for timestamp,
       * and for timestamp with time zone, we get "too many declarations 
       * of is_same match" when we try to call is_same for timestamps.
       */
      FUNCTION is_same(a timestamp, b timestamp)
        RETURN BOOLEAN;
    
      FUNCTION is_same(a timestamp with time zone, b timestamp with time zone)
        RETURN BOOLEAN;
    
      /* These two do indeed cause problems, although there are no errors when we compile the package.  Why no errors here? */
      FUNCTION is_same(a integer, b integer) return boolean;
    
      FUNCTION is_same(a real, b real) return boolean;
    
    END util;
    /
    
    CREATE OR REPLACE PACKAGE BODY util
    AS
      /********************************************************************************
         NAME: yn
         PURPOSE: pass in a boolean, get back a Y or N
      ********************************************************************************/
      FUNCTION yn (bool IN BOOLEAN)
        RETURN CHAR
      IS
      BEGIN
        IF bool
        THEN
          RETURN 'Y';
        END IF;
    
        RETURN 'N';
      END yn;
    
      /********************************************************************************
         NAME: is_same
         PURPOSE: pass in two values, get back a boolean indicating whether they are
                  the same.  Two nulls = true with this function.
      ********************************************************************************/
      FUNCTION is_same(a in varchar2, b in varchar2)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
    
      FUNCTION is_same(a in date, b in date)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
      
      FUNCTION is_same(a in timestamp, b in timestamp)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
    
      FUNCTION is_same(a in timestamp with time zone, b in timestamp with time zone)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
    
      /* Don't bother to fully implement these two, as they'll just cause errors at run time anyway */
      FUNCTION is_same(a integer, b integer) return boolean is begin return false; end;
      FUNCTION is_same(a real, b real) return boolean is begin return false; end;
      
    END util;
    /
    
    declare
     d1 date := timestamp '2011-02-15 13:14:15';
     d2 date;
     t timestamp := timestamp '2011-02-15 13:14:15';
     t2 timestamp;
     a varchar2(10);
     n real := 1;
     n2 real;
    begin
     dbms_output.put_line('dates');
     dbms_output.put_line(util.yn(util.is_same(d2,d2) ));
     dbms_output.put_line(util.yn(util.is_same(d1,d2) ));
     dbms_output.put_line('timestamps'); -- why don't these throw exception?
     dbms_output.put_line(util.yn(util.is_same(t2,t2) ));
     dbms_output.put_line(util.yn(util.is_same(t,t2) ));
     dbms_output.put_line('varchars');
     dbms_output.put_line(util.yn(util.is_same(a,a)));
     dbms_output.put_line(util.yn(util.is_same(a,'a')));
     dbms_output.put_line('numbers');
     -- dbms_output.put_line(util.yn(util.is_same(n,n2))); -- this would throw an exception
    end;
    /
    Originally, I had just the a function with the arguments of VARCHAR2. It worked not correctly because when the dates were gone, the automatic conversion into VARCHAR2 lowered the timestamp. So, I added a 2nd function with the arguments to DATE. Then I started to get "too many declarations of is_same exist" error during the passage of time stamps. This made no sense to me, so, although documentation Oracle says you can't do this, I created a 3rd version of the function, to manage the TIMESTAMPS explicitly. Surprisingly, it works fine. But then I noticed that he did not work with TIMESTAMP with time zones. Therefore, the fourth version of the function. Docs of the Oracle say that if your arguments are of the same family, you can't create an overloaded function, but in the example above shows, it's very bad.

    Finally, just for grins, I created the functions of number two, one number, the other with REAL and even these are allowed - they are compiled. But then, at runtime, it fails. I'm really confused.

    Here's the apparently erroneous Oracle documentation on this subject: http://docs.oracle.com/cd/B12037_01/appdev.101/b10807/08_subs.htm (see overload subprogram names) and here are the different types and their families: http://docs.oracle.com/cd/E11882_01/appdev.112/e17126/predefined.htm.

    Published by: hot water on 9 January 2013 15:38

    Published by: hot water on 9 January 2013 15:46

    >
    So, I added a 2nd function with the arguments to DATE. Then I started to get "too many declarations of is_same exist" error during the passage of time stamps. It makes no sense for me
    >
    This is because when you pass a TIMESTAMP Oracle cannot determine whether to implicitly convert to VARCHAR2 and use your first function or implicitly convert to DATE and use your second function. Where the "too many declarations" error exist.
    >
    , even if said Oracle documentation you can not do, so I created a 3rd version of the function to manage the TIMESTAMPS explicitly. Surprisingly, it works fine. But then I noticed that he did not work with TIMESTAMP with time zones.
    >
    Perhaps due to another error "too many declarations? Because now, there will be THREE possible implicit conversions that might be made.
    >
    Therefore, the fourth version of the function. Docs of the Oracle say that if your arguments are of the same family, you can't create an overloaded function, but in the example above shows, it's very bad.
    >
    I think that the documentation, of the family of 'date', is wrong as you suggest. For WHOLE and REAL, the problem is that those are the ANSI data types and are really the same Oracle data type; they are more like "alias" that different data types.

    See the doc of SQL language
    >
    ANSI SQL/DS and DB2 data types

    The SQL statements that create tables and clusters allows also ANSI data types and products IBM SQL/DS and DB2 data types. Oracle recognizes the ANSI or IBM data type name that differs from the Oracle database data type name. It converts the data type for the equivalent Oracle data type, stores the Oracle data type under the name of the column data type and stores the data in the column in the data type Oracle based on the conversions listed in the following tables.

    INTEGER NUMBER

    INT

    SMALLINT
    NUMBER (38)

    FLOAT (Note b)

    DOUBLE-PRECISION (Note c)

    REAL (Note d)
    FLOAT (126)

    FLOAT (126)

    FLOAT (63)

  • Check out when a last accessed table (select, insert, update) with time stamp. Auditing enabled

    Hello world

    IM pretty new to audit the database. Auditing is enabled in the database. I would like to retrieve the news all of the objects belonged to a certain pattern when it was last accessed (select, insert, update) with time stamp. Is there any script for this? Your time and your reply is greatly appreciated. Thank you.

    Database version: 11.2.0.4

    Enable audit is not quite enough to get the details when the table is updated/inserted/selected.

    You must activate audting on the object level, then you may only be able to see your report of your choice.

    SELECT OBJ_NAME, ACTION_NAME, to_char (timestamp, ' dd/mm/yyyy, hh') of sys.dba_audit_object.

  • Rough terrain when the data is plotted with time stamp of AM / PM or to the right!

    Hi to all programmers.

    I'm attached Datafile. Can someone tell me how to draw this line! I need all of the data plotted on the right and the x - axis with the date and time stamp.

    I understand that the chart cannot understand that after the time: 12:59:59.999, it's 01:00:00.000 afternoon.

    Thanks to Labview 7.1

    Concerning

    HFZ

    Apart from a code that can be simplified by the use of other functions, what I see, it's that the file you provided does not match the format that expects the VI.

    Other comments:

    • I don't understand why you're going to all the trouble of the evolution of the time string when all what you need to do is:

    • All the way at the beginning, use the function of path of the band to get the file name rather than the gymnastics that you're doing.
    • Your time loop must be indexed for auto-loop.
    • I can't quite understand what you're trying to do with all these sliders.
  • How to create a table with no lines to the left or to the right?

    If I create a table with say 5 columns and 15 lines, how not to do a vertical line (border) to the left and to the right of the table while keeping the boundary up and down? Is that possible or I just put a white box on the left and the right?

    IDCS3

    There are a few methods that work. Here is one.

    (1) select your table cells

    (2) open the race Panel

    3) click the blue lines of the proxy image in the Panel of stoke to deselect the lines inside and high and low lines

    (4) 0 the value of the weight of the race (or change the color of the None swatch)

    Oh and for the love of your fellow designers or the person that allows you to edit your work in the future... do NOT use a white box to hide the traits of lines and columns in the table.

    HTH

    -mt

  • Trying to create the table using Clause any Union with Select multiple stmts

    The motion seeks to get the substring of the value to for example.
    If the value is * ASA 2 * then so do ASA
    where as if the value is * 1.5 TST * it sholud come as TST as wise for others too.
    I am trying to execute stmt SQL written but in error as below:

    * ' ORA-00998 must appoint this expression with the alias column 00998.00000 - must appoint this expression with the column alias. "

    CREATE TABLE TEST_CARE AS
    (
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 5
    UNION ALL
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 7
    UNION ALL
    SELECT row_id, old_care_lvl, SUBSTR(old_care_lvl,3), len test_care_lvl FROM
    WHERE LENGTH (old_care_lvl) = 14
    UNION ALL
    Row_id SELECT, old_care_lvl, SUBSTR (old_care_lvl, 3), LEN test_care_lvl
    WHERE LENGTH = 7 AND old_care_lvl (old_care_lvl) = "Regular."
    );

    I want to create the table using the above given the multiple selection by using the Union ALL clause, but trying to create run query error like "ORA-00998 must appoint this expression with the alias column 00998.00000 - must appoint this expression with the column alias.

    Please guide me how to approach to solve this problem.
    Thanks in advance.

    Try this->

    CREATE TABLE TEST_CARE
    AS
      select *
      from (
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =5
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =7
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =14
              UNION ALL
              SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3),LEN FROM test_care_lvl
              WHERE LENGTH(old_care_lvl) =7 AND old_care_lvl ='Regular'
          );
    

    N.B.: Not tested...

    Kind regards.

    LOULOU.

Maybe you are looking for

  • How can I maintain my Macbook Pro?

    Hello I've been a Mac user for years, but I'm forced to use my windows wow. (not). because of my Macbook Pro running very slow. with my Mac Mini, btw, my name is Jack.I can't upgrade to newer models,because of my troubles to unemployment.So what is t

  • Can I use another laptop with Satellite L550-129 adaptor?

    Hello My Satellite L550-129 card is broken. (dc 19 V ~4.7 (A). Can I use an adapter of a mini laptop Toshiba NB500-135? (dc 19 V ~ 1.58 A) It is therefore the same Volt but a lower amp, can I damage something? Greetings, Bart

  • I asked a question yesterday. How can I find

    I asked a question yesterday. How can I find it and the response, if any.

  • Satellite L830 - horizontal line across the screen

    All new Satellite L830 has a horizontal line across the screen. What can be the cause and how can be fixed?

  • cRIO 9076 HAVE sampling problem

    Hello I have a question about the NI 9223 samping rate in our 9076 cRIO system. Given that hopefully samping at a rate up to 500 K or 1 M, we are now using the user controlled sampling I/O. Right now, we are sampling 500 k (2). But I got a number of