Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2017
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NULL value and CONCAT

    I know CONCAT returns NULL if a value is NULL. However, I have a case where I need to do a call to SP with NULL.

    The SP is as follows:

    Code:
    SET @s = CONCAT('UPDATE MEALS.OPENHAND SET ', _COL, ' = ', _VAL , ' WHERE DATE = ','''' ,_DTE , '''',' AND MEAL_TYPE = ', _TYPE);
    
    PREPARE stmt1 FROM @s;
    EXECUTE stmt1;
    commit;
    DEALLOCATE PREPARE stmt1;
    I need the following call to create the proper sql string:

    Code:
    call UPDATEORDERS('2018-08-06','13','CHIC', NULL)
    I've spent several hours with no answer so far. I tries CONCAT_WS but could not make that work either.

    Looking for help. Thanks.

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    7,820
    Thanks
    36
    Thanked 1,046 Times in 1,042 Posts
    You can not change how CONCAT() works. Either remove the null, maybe by adding a false value, or find a different way of doing what you want to do.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.


 

Tags for this Thread

Posting Permissions

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