Toad World® Forums

How to create a View using SQL only?

I’m having some trouble programmatically creating a View. While I can create the view object, assigning the SQL string property isn’t causing the SQL to be properly emitted when generating the final script (it’s essentially empty), though it’s visible in the SQL tab when I inspect the View. I can manually enter the SQL text in the view (with the Body template selected - I’m suspecting the templates have something to do with this) and have it generate as expected. So, a pointer on how to do this would be appreciated.

Hi,

if you work with SQL code, make sure the property SelectInViewsAsText is true.
To check the current state visually, edit the newly created View and on tab General see checkbox Select in View as Text.

Regards,

Vaclav