× 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.



Michael - I don't know anyone here that can answer that - maybe it is in the ANSI SQL specification - if so, you might need to go find that - it is on the 'Net somewhere.

I don't see why you think the second statement should not be OK - '001' is just a literal, that is a completely valid sql statement in interactive SQL, also.

I do see where one might think the first should be OK - it is only a subselect, after all. But I don't really know why.

You CAN prepare it with parameter markers, I believe - have you tried that? Put a question mark in place of the host variable - then in the EXEC SQL EXECUTE statement (I think), use the USING clause. Not sure if it has the same restrictions.

HTH
Vern

Michael_Schutte@xxxxxxxxxxxx wrote:
Is this suppose to answer my question? Because I'm not following you. I
understand that host variables are used in prepared statements but why are
they not permitted in this prepared statement?

Exec SQL
Create table qtemp/tmptable as (
select * from myfile
where company = :hostcpy) with data;

I'm wanting this run multiple times in the program, so reuse and
performance is needed.

What I don't get is that this is okay.

Exec SQL
Create table qtemp/tmptable as (
select * from myfile
where company = '001') with data;




--

Michael Schutte
Admin Professional



Try Bob Evans GRILLING SAUSAGE! This summerâs hottest destination is your
own backyard with Bob Evans Brats and Italian Sausage! For tasty recipes
using Bob Evans grilling sausage, visit http://www.BobEvans.com/Recipes



rpg400-l-bounces@xxxxxxxxxxxx wrote on 05/07/2009 06:47:29 PM:

Host variables are used in 'Prepared' statements. The reason for that is
as
the name suggests, they are prepared. ie they are created before they are
run, and when run, the host variables are passed to the already prepared
statement as input values.
This is basically for performance reasons, as the prepared statement can
then be reused multiple times efficiently


2009/5/7 <Michael_Schutte@xxxxxxxxxxxx>

Okay, I've found where is says that it's not allowed.

The select-statement must not refer to variables or include
parameter
markers.


But why, I dont see the explaination why? I'm not seeing why the
compiler
would care if I use a hard coded value or a host variable to select
records.



--

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.