Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CREATE OR REPLACE VIEW sql error

Trying to update a table view using:

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

The table is returning the old view, not the updated.

Statement tested in the Sqlite database browser:

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

but didn't get this in the program?

Any idea why it's not updating?

like image 768
T.T.T. Avatar asked Aug 05 '09 21:08

T.T.T.


1 Answers

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

Drop the view and create it with the new definition:

DROP VIEW IF EXISTS [vtable]; -- "OR REPLACE"
CREATE VIEW [vtable] AS SELECT * FROM Files_Table ORDER BY File;
like image 101
bogertron Avatar answered Oct 18 '22 12:10

bogertron