3 Replies Latest reply on Oct 15, 2014 4:50 PM by rp0428

    INSERT QUERY

    2755267

      Hi All,

       

          Could any one tell me how to insert data in table like::

       

      INSERT INTO dim_period (col_name) values (another_query)

       

       

      Want another query like

       

      select extract(month from calendar_date) from dim_period


      here table is same, but i want dayName, day, month, week in month, week in year from date column



      so that i want insert query for above task.




        • 1. Re: INSERT QUERY
          cpe

          In case I get you right, you should have alook at to_char(date_column,'Mon')

           

          And this seems to be the wrong forum for the question.

          • 2. Re: INSERT QUERY
            BeGin

            Hello,

             

            Not sure to understand what you need to do,

             

            If you want to insert new lines in your table the syntax will be something like

             

            INSERT INTO DIM_PERIOD ( col1, col2, ... )

            SELECT extract(month from calendar_date), extract(dayfrom calendar_date) , ... from DIM_PERIOD

             

             

            If you need to add new values in the same record this will be an update with

            UPDATE DIM_PERIOD

            SET COL1 = extract(month from calendar_date) ,

            COL2 = extract(dayfrom calendar_date) ...


             

            Regards,

             

            --

            Bertrand

            • 3. Re: INSERT QUERY

              Wrong forum!

               

              This forum, as the title says, is for Sql Developer questions only, not for Sql or PL/SQL questions.

               

              Mark your thread ANSWERED and repost it in the SQL and PL/SQL forum

              SQL & PL/SQL

              insert into dim_period (col_name) select new_col_name from other_table

              For the EXTRACT issue just use an EXTRACT function for each value that you want. See the examples in the SQL Language doc

              EXTRACT (datetime)