Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    18

    Unanswered: Dynamic Cursor Question

    I am trying to build an dynamic cursor based on parameters based into my stored procedure.

    Here is my Variable:

    SET V_SQL = 'SELECT MAWHS, MAPLNR, MAADTE, MAPROD, MAMBAL, MAMREQ, MACOMP, IDESC
    FROM TESTF.DMA DMA, TESTF.IIM IIM
    WHERE DMA.MAPROD = IIM.IPROD AND (MAPROD >= ' || FROM_ITEM || ' AND MAPROD <= ' || TO_ITEM || ')
    AND (MAPLNR >= ' || FROM_PLANNER || ' AND MAPLNR <= ' || TO_PLANNER || ')
    AND MAADTE <= ' || ACTION_DATE
    || ' AND MAWHS = ' || WAREHOUSE
    || ' AND MAMBAL = ' || MIN_BALANCE
    || ' AND MAMREQ = ' || MATERIAL_REQ;

    I am setting my where clause with variables based in I have one problem all my variables are char except ACTION_DATE it is a DECIMAL(8,0) how to I concatentate this decimal parameter to my V_SQL which is defined as varchar(500)?

    Thanks in advance.

  2. #2
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    To convert a decimal column to CHAR, you can use the function DIGITS.

  3. #3
    Join Date
    Jun 2003
    Location
    Shanghai, China
    Posts
    8

    Answer!

    Originally posted by Walter Janissen
    To convert a decimal column to CHAR, you can use the function DIGITS.
    CHAR() function, it can cover te numberic to char!

Posting Permissions

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