We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


SELECT INTO with WITH CLAUSE — Vertica Forum

SELECT INTO with WITH CLAUSE

Is it possible use the WITH clause with SELECT INTO? The following syntax doesn't work:

WITH my_query1 AS (
 SELECT * FROM users
)

SELECT
  *
INTO
  my_new_table
FROM
   my_query1;



Comments

  • You are not going to able to this in Vertica. No insert,updates or delete statements are allowed. 
  • Hi Tibor,

     

    Im wondering if you found out a workaround for this issue. I use SELECT INTO  a lot and its quite useful with the WITH Clause.

     

    Cheers.

     

     

  • Hi 

    As say before by other members , seems like WITH syntax  it’s not supported syntax  for SELECT INTO .

    However  , WITH is a very good syntax  with regard to performances if it can materialized its content  ,  Vertica by default do not materialized  WITH part .

     

    Simple workaround can  be , by  simply write your query  using inline view as below :

     

    SELECT

      *

    INTO

      my_new_table

    FROM

       (SELECT * FROM users) as aa ;

     

    I hope this is answering the question

     

    Thanks  

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file