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



I guess that's not too terribly different than what I'm doing, but I'd sure like to know whether embedded SQL is *supposed* to be different than STRSQL in this case.  I'm not getting an intuitive understanding of how it works.

On 8/20/2019 3:29 PM, dlclark@xxxxxxxxxxxxxxxx wrote:
"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 08/20/2019
04:25:24 PM:
Okay, this one has me scratching my head.

I've always used a prepared statement to create tables, but I wanted to
try using the current schema this time. Basically I'm creating a
summary table for extract, and I wanted to it like this:

SET SCHEMA = :newSchema;
CREATE TABLE NEWTABLE AS (SELECT ...) WITH DATA;
SET SCHEMA = DEFAULT;

This seems pretty straightforward. When I do it in STRSQL and hardcode
the library name, everything works fine. But when I do this in an
embedded SQL program the file is always created in QGPL.

I went so far as to do this:

SET SCHEMA = :newSchema;
SET :curSchema = CURRENT_SCHEMA;
CREATE TABLE NEWTABLE AS (SELECT ...) WITH DATA;
SET SCHEMA = DEFAULT;

I thought maybe the current schema was getting reset somehow, but the
variable curSchema ends up with the same value as newSchema. But the new
table still ends up in QGPL.

Any idea what I'm missing?

Not precisely. But, if you call QCMDEXC from your stored
procedure or program and CHGCURLIB to your desired library then it will
work.


Sincerely,

Dave Clark



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.