Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    1

    Question Unanswered: Reusing Parameter Marker Values in a SQL Query

    The following query prompts twice - once for each parameter marker:

    SELECT *
    FROM ITEMS
    WHERE UNITWEIGHT < ? AND NETWEIGHT < ? * 10

    How can I get make the second parameter marker take on the value of the first one so the user is only prompted once? Can I name parameters in DB2 SQL?

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    How about this?

    SELECT *
    FROM ITEMS
    , (VALUES CAST(? AS INTEGER) ) AS p(p_wt)
    WHERE UNITWEIGHT < p_wt AND NETWEIGHT < p_wt * 10

Posting Permissions

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