If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Dynamic Cursor Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-19-03, 15:03
tmacksam tmacksam is offline
Registered User
 
Join Date: Nov 2003
Posts: 18
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.
Reply With Quote
  #2 (permalink)  
Old 11-20-03, 03:37
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
To convert a decimal column to CHAR, you can use the function DIGITS.
Reply With Quote
  #3 (permalink)  
Old 11-20-03, 07:45
Jark Jark is offline
Registered User
 
Join Date: Jun 2003
Location: Shanghai, China
Posts: 8
Answer!

Quote:
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!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On