CREATE OR REPLACE VIEW

Trying to update table view using:

CREATE OR REPLACE VIEW [vtable] AS SELECT * FROM Files_Table ORDER BY File 

The table returns the old view, not the updated one.

Statement Verified in Sqlite Database Browser:

 Error message from database engine: near "OR": syntax error 

but didn't get it in the program?

Any idea why it is not being updated?

+7
sql database sqlite database-design
source share
2 answers

SQLite does not support the CREATE OR REPLACE syntax. The only database that I know that supports this syntax is Oracle, but I assume there are others.

Drop the view and create it using the new definition:

 DROP VIEW IF EXISTS [vtable]; -- "OR REPLACE" CREATE VIEW [vtable] AS SELECT * FROM Files_Table ORDER BY File; 
+18
source share

MySQL also supports it. Additional information here: http://dev.mysql.com/doc/refman/5.0/en/create-view.html (I would like to add this as a comment to the above answer, but cannot ...)

0
source share

All Articles