Note that there are some explanatory texts on larger screens.

plurals
  1. POstored procedure to create a view
    text
    copied!<p>Ok, So i know this questions has been asked. and everything i read has been "well.. you can do it using dynamic DSL, but dont do it" my question is why. I'm still new at this so I'm learning so bear with me but here is what i'm doing. I want to use a stored procedure to create a dynamic view (but not a temporary table) the view has two dates that it uses to establish a beginning and ending date. it looks something like this:</p> <pre><code>create or replace view MyView as SELECT A.COLUMN_A FUNCTION1(to_date('2/10/2011','MM/DD/YYYY') TOTAL1, FUNCTION2(to_date('2/15/2011','MM/DD/YYYY') TOTAL2 FROM TABLE_A A; </code></pre> <p>This view is then used to generate the data needed for a report in crystal. The problem is that we are about to start using these same sql statements in another language. (we are currently using delphi but to about working on another language (but i dont know what the other language is)) the reason I want to create the view in a stored procedure is, because a) the view is dynamic, and based off the date range selected by the user and b) instead of having to put in some rather large views in multiple languages (that have to be created on the fly due to the changing date range selection) onlt the single line for the function and the parameters would need to be passed. Alot of what i read has said that using Dynamic SQL to create a view is bad, but knowing that its already a dynamic view created specifically for the user on the fly, does anyone see an issue with that? I'm asking because I dont want to get myself into something down the road that I wouldnt be able to get myself out of with out wanting to yank all my hair out. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload