This question may be specific to the toad. I have no idea how Oracle stores views, so I will explain what happens when I use Toad. If I get an Oracle-specific answer, all the better.
I created a rather complex view. To make it clearer, I formatted the code well and introduced some comments where necessary. When I need to make changes to a view, I use the "Describe Objects" window, where I can find a script to recreate the view. The only problem is that all my formatting has disappeared. Comments before the select keyword (but after "create view xxx as") will also disappear.
If I enter this script to create a view:
create or replace view TestViewFormatting as
Toad will display this when I describe it later:
DROP VIEW XXX.TESTVIEWFORMATTING; CREATE OR REPLACE FORCE VIEW XXX.TESTVIEWFORMATTING ( NAME, ACCOUNTNUMBER ) AS select name,
Please note that the first comment has disappeared and the format is completely different.
I suspect that Oracle does not store the view code, but only some collapsible version, and when Toad calls the script, it changes that collapsible version and generates the script on the fly.
What do I need to do to get Toad / Oracle to keep the original formatting?
(PS: I know that I can change the formatting settings of the toad code, but this is not what I want to do. Due to some dubious choices in my past, this particular view has several levels of inline views, and I need very specific formatting to make it clear what is happening)
source share