EXECUTE IMMEDIATE self-determines metadata

Answered

Comments

5 comments

  • Comment actions Permalink
    Official comment
    Avatar
    Matthias Korn

    Dear Chris,

    unfortunately this request would be very hard to implement.

    You are correct, in the end EXECUTE IMMEDIATE is also just executing SQL. But the difference to our views is that the query can be built up dynamically, so the metadata will only be available during runtime. However, like most relational database systems we actually need to know this metadata at parse time.  This is why we can not build up the dependency and metadata for this kind of query without explicitly specifying the structure so that it is available at parse time.

    Having said this, we do have request for introducing variables of type "table" to our procedural language. This would allow to use such variable as output for the INTO clause without the explicit structure specification. However, this feature is not scheduled yet due to relatively low interest from other customers. We will add +1 on this feature in our product management system based on your request.

    Best,
    Matthias

  • 0
    Comment actions Permalink
    Avatar
    Chris Shortt

    Hi Matthias,

    Every database system I know parses input SQL at runtime and determines the metadata then, then executes the query. I don't see the difference between dynamic sql and sql entered by hand into DV Studio. Both don't know the metadata until parse time. Also, Oracle manages to be able to do an EXECUTE IMMEDIATE without knowing the metadata ahead of time, so it can't really be that hard. However, I understand that it might be an not-oft-used edge-case for you and so would not warrant too much attention... 

    Thanks though, for looking into it for me. To be honest, it's kind of an once-in-a-blue-moon edge-case for me too. :)

    Regards,

    Chris

  • 0
    Comment actions Permalink
    Avatar
    Matthias Korn

    Hi Chris,

    Always happy to help :)

    Can you kindly provide an example e.g. in PL/SQL where the metadata does not need to be provided at runtime? Our tech team wants to get to the essence of this thing.

    Best,
    Matthias

  • 0
    Comment actions Permalink
    Avatar
    Chris Shortt

    Hello,

    I guess I'm getting old. I can't seem to find an example in Oracle... Never the less, what I ended up doing was creating a proc that creates a view based on dynamic sql and then calling the view... it would be better to have it all-in-one, but I guess I could live with it.

    Thanks a lot.

    Chris

     

  • 0
    Comment actions Permalink
    Avatar
    Matthias Korn

    Hi Chris,

    you are welcome!

    Best,
    Matthias

Please sign in to leave a comment.

Powered by Zendesk