Re: Opinions on approach, please...



On Thu, 29 May 2008 22:39:51 +1200, "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

"Frederico Fonseca" <real-email-in-msg-spam@xxxxxxxxx> wrote in message
news:7bos345far6d9sglmuc59ga9mfdlu1qe4n@xxxxxxxxxx
On Wed, 28 May 2008 11:55:01 +1200, "Pete Dashwood"
<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

When using dynamic SQL you almost always need to PREPARE.
You also need to use DESCRIBE in some situations, but NOT in all of
them.
small example below. Take in consideration that dependign on how you
go on the dynamic sql route, you will not be able to do it exactly as
follows.
move "SELECT TABNAME FROM SYSCAT.TABLES
- " ORDER BY 1

"ORDER BY 1" ? I don't understand this.

It's a Cobol continuation line. You're not yet at the end of SELECT.

- " WHERE TABNAME <> ?" to st.
EXEC SQL PREPARE s1 FROM :st END-EXEC.
EXEC SQL DECLARE c1 CURSOR FOR s1 END-EXEC.

Yes, this is pretty close to what I'm looking at. I used the examples in the
Fujitsu docs and it is the same as this, except that it makes the declare of
the cursor part of the statement to be prepared. It is interesting to see
that it it possible to prepare part of a statement. Thanks.

No, it is NOT possible to prepare part of a statement.

.



Relevant Pages

  • Re: Opinions on approach, please...
    ... EXEC SQL DECLARE c1 CURSOR FOR s1 END-EXEC. ...
    (comp.lang.cobol)
  • COBOL stored procedure for DB2
    ... exec sql begin declare section end-exec. ... display "calling spprog" ... This used to be a little longer and had embedded SQL commands in it ...
    (comp.lang.cobol)
  • Re: Opinions on approach, please...
    ... to update more than 32k records without a commit in-between. ... Translating the above to SQL it would be as follows. ... I advise you to do cursor definitions on working storage). ... exec sql open file-a end-exec. ...
    (comp.lang.cobol)
  • Re: esql/c Batch Updates
    ... EXEC SQL OPEN updater USING ....; ... cursor row directly without having to search for it again. ... cursor switch which makes a big difference in load times. ...
    (comp.databases.informix)
  • Re: Opinions on approach, please...
    ... It means the first column in the result set. ... EXEC SQL DECLARE c1 CURSOR FOR s1 END-EXEC. ...
    (comp.lang.cobol)