ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Why no host variable with Create Table With Data?

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

  • Why no host variable with Create Table With Data?

    how come a host variable is not allowed in the following statement.

    Used in an SQLRPGLE pgm...


    CREATE TABLE qtemp.worktable AS
    (SELECT * FROM qsys2.systables WHERE table_schema = :g_schema)
    with data

  • #2
    nevermind - the answer is clearly in the error text - host variables cannot be used with a Create Table command

    Comment


    • #3
      Here are a couple of articles that may give you some ideas, Jay.

      Global Temporary Tables and Host Variables

      Global Temporary Tables And Host Variables, Take 2

      Comment


      • #4
        haha good stuff Ted - thanks! I ended up doing exactly what the first link demonstrated (before you even sent the link - it came somewhat naturally) - create a temp hostvar/parm table - it worked great.

        Comment


        • #5
          However, the second links method is not allowed in embedded SQLRPGLE

          Comment


          • #6
            Originally posted by jayvaughn View Post
            However, the second links method is not allowed in embedded SQLRPGLE
            Really? What error did you get?

            Comment


            • #7
              i am wrong - i tried it and it works fine. I should have stated that so matter of fact'ily - however I think the first link is the better option if you have a list of values to check against... if you just have one or two individual host variables, the second link is best - thanks for sharing!

              Comment


              • #8
                Thanks for this. Just exactly what I was looking for.

                Comment

                Working...
                X