Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2014
    Posts
    7

    Unanswered: How does dynamic SQL work in terms of building a query based on an external variable?

    Can someone explain how dynamic SQL works in terms of how an environment variable will tell it what query to build and execute at runtime? Or maybe even a variable from java. I have very little understanding
    of exactly how dynamic SQL works and its different use cases.

    How is dynamic SQL scalable compared to static SQL?

    Say for example I have a bunch of different queries stored in a table. Each query will be executed on a specific table, but it doesn't know which query to pick up and execute until runtime.

    Sorry if this question is poorly worded, if it is worthless then I will attempt to re-explain the best I can.

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I am no Java expert. I do mostly M$ stuff, but I have dabbled. Java has a set of classes called JDBC and that stands for Java Database Connectivity. Those classes allow for variables to be passed and dynamic sql strings to concatenated and submitted to the database engine. How you read in your environment variable is going to be vendor and environment specific but it could done also in Java or anything you use for your application layer. Both are scalable when done and used correctly. You always want the right tool for the job or problem at hand.

    School must be back in session.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •