fhg
Volume 8, Number 31 -- September 10, 2008

SQL Assist: Powerful Interactive SQL

Published: September 10, 2008

by Skip Marchesani

The Run SQL Scripts function, a.k.a. the SQL Script Center or Script Center, is System i Navigator's counterpart to Interactive SQL on the green screen side of the System i. The SQL Script Center allows the user to execute all or a subset of a script that contains one or more SQL statements and/or batch CL commands. It is part of the Navigator Database function and is an extremely powerful and flexible tool with lots of function that can have a very positive impact on application developer productivity.

Interactive SQL has a very good multilevel SQL prompter that supports a subset of the SQL statements available in DB2. While the SQL Script Center does not have this type of SQL prompting, it does provide SQL Assist, which is an easy-to-use, graphical approach to creating a SELECT, INSERT, UPDATE, or DELETE statement. These four SQL statements are used a very large percentage of the time. Prior to using SQL Assist, there are a couple of things you need to be aware of.

The libraries available for SQL Assist are those defined under Schemas on the left pane of the Navigator panel. Note that for purposes of this discussion, an SQL Schema can be considered the same as a native library. To add or remove libraries, right click on Schemas on the Navigator panel and click Select Schemas to Display to invoke the Select Schemas dialog.

SQL Assist will create the SELECT, INSERT, UPDATE, or DELETE statement using the SQL naming convention (library.object) as opposed to system naming convention (library/object) and will qualify all references in the SQL statement with library and file name. This means that you must choose SQL Naming in Run SQL Scripts in order for the statement created by SQL Assist to execute correctly. To do this, click on Connection in the toolbar of the Run SQL Scripts panel and then JDBC in the resulting drop-down menu to invoke the JDBC setup dialog. Next click on the Format tab, and then select SQL(*SQL) under naming convention at the top of the dialog display.

To invoke SQL Assist, press F4 with the cursor placed anywhere on the Run SQL Scripts Input panel, or click on Edit in the toolbar and select SQL Assist from the drop-down menu. Either option takes you to the primary SQL Assist dialog panel, which is divided into three parts.



The upper-left portion contains the Outline view, which shows a high level representation of the clauses that comprise SQL statement. Clicking on any clause or node in the outline view causes the detailed information for the clause or node to be displayed in the Details area in the upper-right portion of the panel.



Initially the Details area shows the SELECT, INSERT, UPDATE, and DELETE statements that can be generated, along with the connection information. The SELECT statement is the default selection. The Details area is used to graphically add elements to the SQL statement, and changes based on the clause or node you select in the Outline view in the upper left.



When you select a node in the Outline view and make changes in the Details area, SQL Assist generates code in the SQL Code View area in the lower portion of the panel. The code is syntax-highlighted. In some environments, you can edit the SQL code in the SQL code view.



Once the SQL statement is to your liking, click OK and the generated SQL statement will be inserted in the Run SQL Scripts window, and the SQL Assist dialog will close. The generated SQL statement can then be executed.




Skip Marchesani retired from IBM after 30 years and is now a consultant with Custom Systems Corporation. He is also a founding partner of System i Developer and the RPG & DB2 Summit. Skip spent much of his IBM career working with the Rochester Development Lab on projects for S/38 and AS/400 and was involved with the development of the AS/400. He was part of the team that taught early AS/400 education to customers and IBM lab sites worldwide. Skip is recognized as an industry expert on DB2 for i and the author of the book DB2/400: The New AS/400 Database. He specializes in providing customized education for any area of the System i, iSeries, and AS/400; does database design and design reviews; and performs general System i, iSeries, and AS/400 consulting for interested clients. He has been a speaker for user groups, technical conferences, and System i, iSeries, and AS/400 audiences around the world. He is an award-winning COMMON speaker and has received its Distinguished Service Award. Send your questions or comments for Skip to Ted Holt via the IT Jungle Contact page.




                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
PRODATA COMPUTER SERVICES

Learn how to access remote databases
from your RPG programs!

RDB Connect is a stand alone product that
offers APIs for using SQL queries to access
remote data. It gives you easy access to
current and accurate data from remote systems.
RDB Connect allows full SQL access to
MySQL, Microsoft SQL Server, Oracle,
Postgre and DB2 and more...

Attend our Webinar
Wednesday, September 17, 2008
2:00 pm CDT (-06:00 GMT)

sales@prodatacomputer.com
www.prodatacomputer.com


Senior Technical Editor: Ted Holt
Technical Editor: Joe Hertvik
Contributing Technical Editors: Edwin Earley, Brian Kelly, Michael Sansoterra
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

ProData Computer Services:  Access remote databases from RPG, Webinar, Sept. 17, 2 p.m. CDT
MoshiMoshi:  Episode Three now showing! Watch and Win!
COMMON:  Join us at the Focus 2008 workshop conference, October 5 - 8, in San Francisco, California


 

IT Jungle Store Top Book Picks

Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
Getting Started with PHP for i5/OS: List Price, $59.95
The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95


 
The Four Hundred
Expanded Power Systems i Boxes on the Horizon?

Entry Power System i Boxes Compete Well with Windows Boxes

X64 Servers See Pricing Pressure in Q2, Big Box Sales Grow

The Law of Attraction

Arrow Says Midrange Shops More Worried About Security than Money

The Linux Beacon
Why Blade Servers Still Don't Cut It, and How They Might

Intel Keeps Both Arms Swinging with Xeons, Jabs with Itanium

Microsoft Ponies Up Another $100 Million for Novell Linux

Mad Dog 21/21: Newtonian Economics

Two More Xeon-Based Galaxy Servers from Sun

Four Hundred Stuff
SafeData Launches First Fully Managed Service for i5/OS HA

Aldon Brings PHP Closer Into Change Management Fold

HiT's DBMoto Gains Enterprise Replication Features

AmeriVault Debuts DR Service for i OS Servers

BMC Aims to Bring Virtual Servers Under Control

Big Iron
For Some Customers, the Mainframe Is Green

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
August 23, 2008: Volume 10, Number 34

August 16, 2008: Volume 10, Number 33

August 9, 2008: Volume 10, Number 32

August 2, 2008: Volume 10, Number 31

July 26, 2008: Volume 10, Number 30

July 19, 2008: Volume 10, Number 29

The Windows Observer
Citrix Addresses Performance with XenApp 5

Server Buyers Shop Like It's 1999 in the Second Quarter

Intel Keeps Both Arms Swinging with Xeons, Jabs with Itanium

Mad Dog 21/21: Newtonian Economics

Microsoft Does Something About Those SQL Injection Attacks

The Unix Guardian
What the Heck Is the Midrange, Anyway?

Overseas and Notebook Sales Offset Printer Declines for HP in Q3

Two More Xeon-Based Galaxy Servers from Sun

Mad Dog 21/21: Newtonian Economics

Intel's Nehalems to Star at IDF, AMD Pitches Shanghai

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

Help/Systems
ProData Computer Services
System i Developer


Printer Friendly Version


TABLE OF CONTENTS
The Efficiency of Varying Length Character Variables

SQL Assist: Powerful Interactive SQL

Admin Alert: Getting into a i5/OS Restricted State

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
MQ Help Desired

Printing TCP/IP Details into a Spoolfile

IFF ACTIVE Equivalent in CL

Capture Sort File and Copy to Database File

SNMP Traps on i5OS

Java Messages





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement