ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Sql7919

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

  • Sql7919

    Trying to SQL data from file QSYS2/USER_INFO, and I get this error message. SQL7919. Help text for the message says the following. So how do I define this as a variable length field in my RPG program, if that is what I need to do? Thanks!

    Cause . . . . . : Host variable AUTHORIZATION_NAME requires conversion. The
    data retrieved for the FETCH or embedded SELECT statement can not be
    directly moved to the host variables. The statement ran correctly.
    The host variable requires conversion for reason 5.

    -- Reason 5 - host variable AUTHORIZATION_NAME is not a variable length
    string and the value being retrieved is.

  • #2
    Well, I simply added varying to the field definition and that seems to have corrected the problem. But, I have also discovered another warning message concerning security.

    Comment


    • #3
      ... or if you are using Free-Format-D-Specs, use the data type VARCHAR().

      But in either way SQL7919 is only an information/warning. Your SQL statement should work correctly (even with fixed format host variables).
      Never check SQLCODE <> *Zeros, because sometimes warnings are sent.
      If you want to check for errors explictly use SQLCODE < *Zeros.

      Birgitta

      Comment


      • #4
        Thanks Birgitta. I always do SQLCODE <> *zeros. I will have to change my habit.

        Comment


        • #5
          Here is another odd thing about the QSYS2/USER_INFO file that I am having an issue with. The PREVIOUS_SIGNON field, a timestamp type Z field, displays as a dash for what I assume are users that have never signed onto the system, when I SQL interactively. I can display that without any issues, but if I try to select users that have never signed on, I use this statement - Where PREVIOUS_SIGNON = '0001-01-01-00.00.00.000000'. But that does not work. It does work with the opposite. That is, Where PREVIOUS_SIGNON <> '0001-01-01-00.00.00.000000' if I want to filter out those users who have never signed on. What am I missing?

          Comment


          • #6
            The dash replaces a NULL Value. A NULL value is a value out of the valid range and has nothing to do with any high or low values.
            If you want to get all users never signed on, i.e. with a NULL value, you have to Specify: WHERE PREVIOUS_SIGNON is NULL.

            Birgitta

            Comment


            • #7
              Thanks again!

              Comment

              Working...
              X