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


  • Subject: Embedded SQL does not work
  • From: Silvio Santos <Silvio.Santos@xxxxxxxxx>
  • Date: Wed, 13 Jan 1999 12:49:51 -0000

Hello!
I am trying to do an update in a table B with data from table A, for that I use 
a cursor. Here is the code:

     IDSA         DS
     I                                        1  10 FCTNA
     I                                       11  11 CASSA
     I                                       12  15 POSNA
     I                                       16  65 FCDS
     I                                       66  90 FCSD
     C*
     C/EXEC SQL
     C+         DECLARE CA CURSOR FOR
     C+         SELECT A.FCTN0O, A.CASS0O, A.POSN0O, A.FCDS0O, A.FCSD0O
     C+           FROM PFA A, PFB B
     C+           WHERE A.FCTN0O = B.FCTN0O  AND
     C+                 A.CASS0O = B.CASS0O  AND
     C+                 A.POSN0O = B.POSN0O
     C+         FOR READ ONLY
     C/END-EXEC
     C*
     C/EXEC SQL
     C+         OPEN CA
     C/END-EXEC
     C*
     C/EXEC SQL
     C+         WHENEVER NOT FOUND
     C+         GO TO CLOSEA
     C/END-EXEC
     C*
     C           CICLO     TAG
     C/EXEC SQL
     C+         FETCH CA
     C+           INTO  :FCTNA, :CASSA, :POSNA, :FCDS, :FCSD
     C/END-EXEC
     C*
     C           SQLCOD    IFNE 0
     C                     GOTO CLOSEA
     C                     ENDIF
     C*
     C/EXEC SQL
     C+         UPDATE TESTLIB/PFB
     C+           SET FCDS0O = :FCDS,
     C+               FCSD0O = :FCSD
     C+           WHERE FCTN0O = :FCTNA  AND
     C+                 CASS0O = :CASSA  AND
     C+                 POSN0O = :POSNA
     C/END-EXEC
     C                     GOTO CICLO
     C           CLOSEA    TAG
     C/EXEC SQL
     C+         CLOSE CA
     C/END-EXEC
     C*
     C                     SETON                     LR
     C*

But the update is not working. I also tried to run the debug an I saw that the 
sqlcod is with the value = 0 before the update, but after it contains -7008,
I also tried to see the sqlerm but it appears strange things. 
I tested an equivalent update in the command line of the STRSQL and it works, 
so what can be wrong ?

Silvio.

  
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.