|
DB2 UDB for i doesn't allow to use variable names for tables and other
objects, but dynamic SQL can always be used.
Example:
Declare DynCursor Cursor For DynSQL;
MyString = 'SELECT * From ' + MyTable;
Prepare DynSQL from MyString;
Open DynCursor;
Not sure if it is an SQL issue or if other database only provide someIn other words, this is not a "DB2" thing, but an SQL issue.
special features.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
lgoodbar@xxxxxxxxxxxxxx
Gesendet: Tuesday, 22. December 2009 14:05
An: midrange-l@xxxxxxxxxxxx
Betreff: RE: SQL statements in a SQL Stored Procedure.
I thought DDL and DML could not use variable names for objects (tables,
columns, etc.). At least, that's been my experience with i5/OS and SQL
Server. (I.e., cannot perform "select * from :tablename")
In other words, this is not a "DB2" thing, but an SQL issue.
HTH,
Loyd
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Monday, December 21, 2009 3:58 PM
To: Midrange Systems Technical Discussion
Subject: SQL statements in a SQL Stored Procedure.
<snip>
IBM is saying I must execute the DROP statement dynamically. That
doesn't
make much sense to me that I would have to do that.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
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.