Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2013
    Posts
    11

    Unanswered: Getting Problem to convert MS SQL Function to DB2 Function

    // i am trying to cenvert this sql code into DB2 code but i am getting error to to conversion this function code into DB2, please give me suggesion as soon possible.



    Create Function CastInt(Array Vrachar(2000))
    Returns IntTable Table(IntValue Integer)
    Language SQL
    Contains SQL
    Begin
    if Array '' Begin
    Declare separator char(1);
    Set separator=',';
    Declare separator_position Integer;
    Declare array_value Varchar(2002);
    Set Array=Array_ ',';
    While patindex('%,%' , Array)<> 0 Begin
    Select separator_position= patindex('%,%', Array);
    Select Array_value=LEFT(Array, separator_position -1);
    Insert IntTable Values (CAST(Array_value Integer));
    Select array=stuff(array, 1, separator_position, '');
    End;
    End;
    Return;
    End

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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