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



Excellent question. However, assuming the real question is concerning differences between static and dynamic (prepared) SQL, I use static, both in individual statements and cursors whenever possible because the prepare step then happens once at compile time vs. every time the statement is prepared during run time. That said, sometimes it is harder, or even impossible to use static SQL. For example, when you do not know what the when clause will be because you are creating a search filter with many possible permutations. Or if you have a variable term that can not be supplied by a host variable like table name, though you must be careful when concatenating SQL commands together so that you do not create a vector for SQL injection. There is actually a third option as well. That would be CLI. Haven't ever used it, but there are some comparisons in the knowledge center if you care to go hunting for them.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----darren@xxxxxxxxx wrote: -----
To: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l@xxxxxxxxxxxx>
From: darren@xxxxxxxxx
Date: 02/16/2016 03:52PM
Subject: Re: RPG SQL: Prepared Statement v. Cursor


I am involved in a discussion of the pros & cons of Prepared Statements
and Cursors. Clearly I am over my head.

What are the strengths/weaknesses of these two solutions? Which do you
prefer?

You can prepare a statement with a cursor, so the two aren't mutually
exclusive. Are you asking about prepared vs static statements, or cursor
vs. one record selects?


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