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