Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2015
    Posts
    10

    Lightbulb Unanswered: INSERT new records when table is EMPTY

    Hi,

    I am trying to insert new records when table is empty.
    The following insert statement doesn't work. Please advise.

    insert into tbl.work values ('DEPTA',0,0,0.00,1)
    where (select count(*) from tbl.work) = 0;

    Thanks,
    Zach

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,
    Code:
    values ('DEPTA',0,0,0.00,1)
    where (select count(*) from tbl.work) = 0
    This is not a valid select statement.
    Try this:
    Code:
    insert into tbl.work 
    select  'DEPTA',0,0,0.00,1 from sysibm.sysdummy1
    where (select count(*) from tbl.work) = 0;
    Regards,
    Mark.

  3. #3
    Join Date
    Dec 2015
    Posts
    10
    Thank you so much, Mark! Appreciate your help : )

Posting Permissions

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