× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Microsoft guy here...bear with me.

I am writing a DB2 proc that will utlize dynamic SQL to build the SQL String
based on parameters recieved at call time.  So far I've found 2 ways to
include a portion of my params within the query:

1)  SET SQL_STMT='SELECT * FROM books WHERE bookid=?'
or
2)  SET SQL_STMT='SELECT * FROM books WHERE bookid=' || CAST(parm1 as
varchar(x))

My issues are that with option 1 the lining up of paramter markers (?) seem
to be based on the order they are defined in the procedure.  (i.e. the first
? get the first defined parameter, the second get the second and so on).
This will not work for me in this particular proc.

My other issue is simply an academic one.  On the DBMS I am accustomed to,
not actually paramterizing your queries is a last resort type of thing.  So,
I have been trying to avoid it on the AS400 as well (maybe without reason
though...).

Anyway, is there a way to pass named variables/parameters to my D-SQL?

Thanks in advance.

Ryan




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.