Options

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

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

    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.

     

     

  • Options

    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