Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2012
    Posts
    15

    Unanswered: Unable to create table using AS (Full Select)

    Hi

    I am not sure why the below Query runs into an error. Could you please help.

    I am trying to create a table and insert data at the same time but a work around with creating the table using WITH NO DATA and then inserting in another query works but not sure why the error when trying to do the same at one go.

    CREATE TABLE PMFG.PS_FMG_FM_DLY_F_Z1 AS (SELECT TGT_FMG_SKEY from PS_FMG_TSITEM)

    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0104N An unexpected token "END-OF-STATEMENT" was found following "rom
    PS_FMG_TSITEM)". Expected tokens may include: "<definition_only>".
    SQLSTATE=42601

    Please help.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    looking at the syntax diagram with AS : with no data MUST be specified


    |--+-----------------------+--AS--(--fullselect--)-------------->
    | .-,-----------. |
    | V | |
    '-(----column-name-+--)-'

    >--WITH NO DATA-------------------------------------------------|

    I tried and get the same message - added with no data - ok.
    use load from cursor to populate table
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •