SQL errors on IBM i usually have an SQL code (the variable SQLCOD in RPG). This number is part of an error message, so if the code is 100, you can see more by putting the error code after SQL to build a message ID.

To see more about SQL code 100 you would do this -

DSPMSGD SQL0100 QSQLMSG

The manual on SQL messages and codes has this instruction -

"Take the absolute value of the SQLCODE, then append it to the letters ″SQL″ (for SQLCODEs less than 10 000) or the letters ″SQ″ (for SQLCODEs greater than or equal to 10 000) to determine the message identifier."

HTH
Vern

On 10/30/2014 10:01 AM, Gary Thompson wrote:
Greg,

I often find myself at that frustrating point, looking at an SQL error and not getting it.
Happened yesterday when someone asked for help debugging an SQL statement.
Took way too much time to get the answer, even though the error identified an "invalid" component.
I like your 'upstream or downstream' comment . . .

Error handling, to me, is the toughest game in town, and don't remember ever having a good idea of
how to make any SQL error message 'better'.
Frankly, I think the issue is more in my attitude, focus and experience.

I would not try comparing SQL error handling with a high level language because HLL errors are, to me,
easier to trap because they mainly relate to 'one' operation.
For example, I don't recall being stumped by SQL errors in the FROM clause, which is one
part of an SQL statement that I can relate to an HLL program.
To me, an SQL statement is more like an HLL routine.


-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Greg Wilburn
Sent: Thursday, October 30, 2014 8:11 AM
To: 'Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries'
Subject: Re: [WDSCI-L] Running SQL scripts

Ken,

Thanks... this is my first crack at SQL and while I like what it can do, I really despise the lack of "real information" when an error occurs. Most of the time the error message (even in Navigator) is useless... missing a comma here or there, indicating that something is "invalid" when there's an issue upstream or downstream.

Would be nice if there was better syntax checking like in a high level programming language.

Greg

-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Ken Killian
Sent: Thursday, October 30, 2014 8:14 AM
To: Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries
Subject: Re: [WDSCI-L] Running SQL scripts

Greg,

Sadly no...

RDI Script is an Addition/Complementary to running SQL Scripts, not a "REPLACEMENT"...
<Big Frown>

I love the ability to test stored procedures from within RDi with the ability to debug! <smile>

But, at least it gives error feedback, although no highlighting. It has forced me to learn SQL Better. And when I get stuck, I OFTEN have to resort back to good old "Run SQL Scripts" inside of Navigator...

Except for testing stored procedures, I often use SquirrelSQL.org. Because it has bookmarks for commonly run SQL Statements that I run every day/Week. And it also remembers my last 100 SQL Statements. Which is very handy at times.

I really want to use Data Studio more... But, I guess it's navigation drive me personally nuts. Writing and running SQL Scripts should be a SIMPLE, not complicated. I guess I need to use it more myself...

In the Script Writer, you can press F5=Run Sql Script! Very nice! And you can highlight statement to run that single statement! Also very nice!

But, when I try to use the "SQL Query Builder" for a single SQL Statement. I cannot use F5 to run... <frown> Very frustrating. But, it has awesome Code Assist for Fields & Tables! And I can build sql statement visually, sort of...

Data Studio also does NOT have the Visual Explain or the Index Advisor. Once again you have to go back Navigator. Since IBM does NOT know how to use "Code Reuse" across their tool platform. <Big Frown>

So, sadly I only use Data-Studio for testing stored-Procedures. Any SQL I use SquirrelSQL.org or Navigator or good old Green Screen SQL... <disappointment>

RDi cannot NOT be beat for RPGLE development however!!! <Joy Joy>

-Ken Killian-

-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Greg Wilburn
Sent: Wednesday, October 29, 2014 3:56 PM
To: 'WDSCI-L@xxxxxxxxxxxx'
Subject: [WDSCI-L] Running SQL scripts

I've installed the Developer Studio and have been creating/editing SQL scripts (mostly creating views). I like this a bit better than simply running them through Navigator, but when a script fails it doesn't highlight the problem area like Navigator does.

Is there any way to change this?
--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.
--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.
--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.