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



Does anyone know of a way to use a variable in a stored procedure as the table 
name? When I run the procedure, it always tries to use lib not the contents of 
the variable.

I am tying to update a specific table in every library that it exists.  Here is 
a sample of the code:

DECLARE lib VARCHAR(128);
DECLARE c1 Cursor FOR
        SELECT table_schema 
                FROM SYSIBM.TABLES 
                WHERE table_name = 'TABLE123';
                    
FETCH c1 INTO lib;
WHILE at_end = 0 DO
        INSERT INto lib.TABLE123 VALUES('A','B','C');
        FETCH c1 INTO lib;
END WHILE;


Thanks, 

Chris Beck
-------------------------------------------------

This email transmission and any documents, files or previous

email messages attached to it may contain information that is

confidential or legally privileged. If you are not the intended

recipient, you are hereby notified that any disclosure, copying,

printing, distributing or use of this transmission is strictly

prohibited. If you have received this transmission in error,

please immediately notify the sender by telephone or return

email and delete the original transmission and its attachments

without reading or saving in any manner.



The Evangelical Lutheran Good Samaritan Society.

---------------------------------------------------------

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.