我使用perl和sybase。我尝试在perl中创建视图:
if(condition)
create view name_view
as select col1,col2,col3
from table1,table2
where key1=key2
else (condition)
create view name_view
as select col1,col2,col2
from table1,table3
where key1=key2
当我运行它时,我总是收到一个错误,该视图已经存在。连我都提出了if - exists
条件。
drop view name_view
它总是相同的错误。
请注意:我无法在单独的查询中创建视图,因为当我从视图中选择时,它的工作速度非常慢。
我建议使用prepare
和execute
调用。请阅读这篇来自 PerlMonks.org 的优秀帖子