ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQL0312 error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL0312 error

    The code worked fine this way...
    DSavobjcnt S 20P 0

    C/EXEC SQL
    C+ SELECT SUM(BSHSAV)
    C+ INTO :Savobjcnt
    C+ FROM QGPL.REPORT
    C/END-EXEC

    Any obvious mistake I made? Bueller? Bueller??




    **FREE

    Dcl-s Savobjcnt Packed(20:0);
    Dcl-s Saverrcnt Packed(20:0);


    Exec SQL SET OPTION
    naming = *SYS,
    commit = *none;

    Exec SQL Select SUM(BSHSAV) INTO :Savobjcnt
    FROM QGPL.REPORT;

    Exec SQL SELECT SUM(BSHERR) INTO :Saverrcnt
    FROM QGPL.REPORT;


    MSG ID SEV RECORD TEXT
    SQL5066 0 30 Precompile option NAMING changed by SET OPTION statement.
    SQL5066 0 30 Precompile option COMMIT changed by SET OPTION statement.
    SQL0312 30 34 Position 42 Variable SAVOBJCNT not defined or not usable.
    Reason: No declaration for the variable exists, the
    declaration is not within the current scope, or the
    variable does not have an equivalent SQL data type.
    SQL0312 30 44 Position 42 Variable SAVERRCNT not defined or not usable.
    Reason: No declaration for the variable exists, the
    declaration is not within the current scope, or the
    variable does not have an equivalent SQL data type.

  • #2
    I could not find the issue, so I was forced to go back to D and C specs with a /free and /end-free...hate having combo code..

    Comment


    • #3
      Show us the code that worked - i.e. the D specs etc. and we'll see if we can see the problem. There is zero reason why it shouldn't work.

      P.S. What release are you on and are your PTFs up to date?

      Comment


      • JonBoy
        JonBoy commented
        Editing a comment
        P.P.S. You never need to use /free any more - not since V7.1
    Working...
    X