• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Global Temporary Tables And Host Variables, Take 2

    May 31, 2016 Ted Holt

    In Global Temporary Tables and Host Variables, I complained that DECLARE GLOBAL TEMPORARY TABLE does not permit me to use host variables. I presented two ways to circumvent the problem. Today I revisit the topic to show another way that was not available six years ago.

    First, create some global variables.

       create variable somelib.gv_Company   dec(3);
       create variable somelib.gv_Customer  dec(5);
    

    Then use those global variables in your program.

    exec sql
       set gv_Company  = :inCompany;
    exec sql
       set gv_Customer = :inCustomer;
    exec sql
       declare global temporary table Temp1 as
           (select *
              from sales
             where companyno  = gv_Company
               and customerno = gv_Customer)
         with data with replace;
    

    DECLARE GLOBAL TEMPORARY TABLE has no qualms with the use of global variables.

    Global variables are still new to me. I suspect I have not even begun to understand the many ways to use them effectively.

    Ted Holt welcomes your comments and questions. Email him through the IT Jungle Contacts page.

    RELATED STORIES

    New in DB2 for i 7.1: Use Global Variables to Track Environment Settings

    Global Temporary Tables and Host Variables

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    New Generation Software

    Free NGS-IQ Webinar: A Better Way to Connect IBM i Data and Microsoft 365 Users.

    Business users rely on Excel, SharePoint, Access, and other Microsoft tools to view, analyze, and share data. But what if your data is too sensitive and complex to simply open up to non-technical users via ODBC and Microsoft 365’s query functions?

    Attend our webinar on June 22, 2022, and see how you can make the people you support smile even as you centrally manage and secure IBM i data access.

    www.ngsi.com– 800-824-1220

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    System i Developer:  RPG & DB2 Summit - October 4-6 2016 in Chicago. Register now!
    NGS:  Webinar: Answering Business Qs with Reporting & Analytics. June 16. RSVP!
    Profound Logic Software:  'i on the Enterprise' Worldwide Virtual Event. June 8. Register Now!

    ProData Gets Graphic, Releases DBU for RDi Fresche Brings the Heat(map) to Legacy Modernization

    Leave a Reply Cancel reply

Volume 16, Number 13 -- May 31, 2016
THIS ISSUE SPONSORED BY:

T.L. Ashford
Valence Framework for IBM i
WorksRight Software

Table of Contents

  • Watch Your Data While Stepping Out With RDi Debug
  • Global Temporary Tables And Host Variables, Take 2
  • LAG And LEAD Functions In DB2 for i 7.3

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • POWERUp Brings IBM i Base Back Together in the Big Easy
  • New Nav for i Brings New Stuff to You
  • Why Infor’s IDF Is Important for Customer Innovation
  • Four Hundred Monitor, May 25
  • IBM i PTF Guide, Volume 24, Number 21
  • How Committed Is Big Blue To The IBM Cloud?
  • Immutable Copies Are Only As Good As Your Validation
  • Guru: IBM i *USRPRF Security
  • ERP Transitions Loom for SAP on IBM i Customers
  • Inflation Pumps Up Global IT Spending, Supply Chain Deflates It

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2022 IT Jungle

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.