Results 1 to 6 of 6

Thread: concatenation

  1. #1
    Join Date
    Jul 2003
    Location
    porto - Portugal
    Posts
    74

    Unanswered: concatenation

    Hi people,

    Someone could help me with the concatenation?..
    I want select sku_name and colour:desc...to create desc_prod...but
    i don't know why, it doesn't work:

    DECLARE c1 CURSOR FOR
    SELECT
    t.id_1,
    t.sku_name CONCAT t.colour_desc,
    t.style_id,
    t.colour_id
    FROM RMLEITE.TESTE t
    FOR READ ONLY;
    .
    .
    .
    .
    fetch c1 into ...,desc_prod,...,...,...;
    Insert into(..., desc_prod,....

    Thanks,
    Rui

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: concatenation

    When you say it does not work, please can you post the errror message you get .

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jul 2003
    Location
    porto - Portugal
    Posts
    74

    concatenation

    error message:

    SQL0206N "T.COLOUR_DESC" is not valid in the context where it is used. SQLSTATE=42703

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5

    Re: concatenation

    That is because CONCAT is a function. you would have to write it like this:
    CONCAT(t.sku_name,t.colour_desc).

    You can also use the concatenation operator like this:
    t.sku_name || t.colour_desc,

    HTH

    Andy

    Originally posted by rmleite
    Hi people,

    Someone could help me with the concatenation?..
    I want select sku_name and colour:desc...to create desc_prod...but
    i don't know why, it doesn't work:

    DECLARE c1 CURSOR FOR
    SELECT
    t.id_1,
    t.sku_name CONCAT t.colour_desc,
    t.style_id,
    t.colour_id
    FROM RMLEITE.TESTE t
    FOR READ ONLY;
    .
    .
    .
    .
    fetch c1 into ...,desc_prod,...,...,...;
    Insert into(..., desc_prod,....

    Thanks,
    Rui

  5. #5
    Join Date
    Jan 2003
    Posts
    1,605

    Re: concatenation

    Hi,

    I don't agree with ARWinner - the sintax is correct!
    Look for this:
    - is column colour_desc in RMLEITE.TESTE table? Did you mistype the column name?
    - is column colour_desc character data type (if not then convert in to character with CHAR function).

    Hope this helps,
    Grofaty

    Originally posted by ARWinner
    That is because CONCAT is a function. you would have to write it like this:
    CONCAT(t.sku_name,t.colour_desc).

    You can also use the concatenation operator like this:
    t.sku_name || t.colour_desc,

    HTH

    Andy

  6. #6
    Join Date
    Jul 2003
    Location
    porto - Portugal
    Posts
    74

    Re: concatenation

    Thanks Grofaty...you are right..the syntax is correct.
    The problem was the name of the column colour_desc...but it's ok.
    Thanks.
    Originally posted by grofaty
    Hi,

    I don't agree with ARWinner - the sintax is correct!
    Look for this:
    - is column colour_desc in RMLEITE.TESTE table? Did you mistype the column name?
    - is column colour_desc character data type (if not then convert in to character with CHAR function).

    Hope this helps,
    Grofaty

Posting Permissions

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