Announcement

Collapse
No announcement yet.

Stored Procedure Arguments

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

  • Stored Procedure Arguments

    Hi,

    Is it possible to pass VoltTable[] as a IN stored procedure parameter (to run())?
    Is it possible to return VoltTable[] as a OUT parameter?

    Thanks,
    Swapnil

  • #2
    RE: Stored Procedure Arguments

    Hi Swapnil,

    Yes and yes. A scalar value returned by a procedure will always be wrapped in an array of volt tables. You can also create an array of volt tables and return that.

    See 3.2.1.5 in "Using VoltDB" from http://community.voltdb.com/sites/de...1-docs_pdf.zip

    Ariel Weisberg
    VoltDB Engineer

    Comment


    • #3
      RE: Stored Procedure Arguments

      Originally posted by aweisberg View Post
      Hi Swapnil,

      Yes and yes. A scalar value returned by a procedure will always be wrapped in an array of volt tables. You can also create an array of volt tables and return that...
      Ariel Weisberg
      VoltDB Engineer
      Hi Ariel,

      Hmmm... Section 3.2.1.5 describes how to get VoltTable[] as return value of run() but I couldn't find any mention of passing or returning VoltTable[] as parameters to run().

      Just to confirm, let me give an example of what I am thinking about.
      Lets say, given a personId as input, we need to get three outputs: 1) count of his friends 2) list of friends and 3) all past addresses. To do so we write a SP where the count is returned through the return value of run(). The rest through the parameter list:

      public long run(long personId, VoltTable[] friendsList, VoltTable[] pastAddresses)

      Is this a valid run() signature?
      If yes, I will then have a follow-up question.

      Thanks,
      Swapnil
      ==========
      PS: why is message subject field not auto-populated everytime I reply to the same thread?

      Comment


      • #4
        It doesn't work like that.

        Originally posted by skashikar View Post
        Hi Ariel,

        Hmmm... Section 3.2.1.5 describes how to get VoltTable[] as return value of run() but I couldn't find any mention of passing or returning VoltTable[] as parameters to run()...

        Thanks,
        Swapnil
        ==========
        PS: why is message subject field not auto-populated everytime I reply to the same thread?
        Hi Swapnil,

        From memory, we accept numbers, strings, dates and tables as input to procedures, and we also support arrays of any of those things.

        So yes, that's a valid signature. HOWEVER, our parameters are input only and don't support IN/OUT/INOUT modes. The way you would probably do this kind of thing in VoltDB is to return an array of 3 tables. The first table would simply contain a single column and single row with a long value representing the count.

        -John

        Comment


        • #5
          understood

          Originally posted by jhugg View Post
          Hi Swapnil,

          From memory, we accept numbers, strings, dates and tables as input to procedures, and we also support arrays of any of those things.

          So yes, that's a valid signature. HOWEVER, our parameters are input only and don't support IN/OUT/INOUT modes. The way you would probably do this kind of thing in VoltDB is to return an array of 3 tables. The first table would simply contain a single column and single row with a long value representing the count.

          -John
          Hi John,

          Thanks. that clarifies what I was suspecting. thanks a lot.

          Swapnil

          Comment

          Working...
          X