如何查看oracle里面试图 view1 存不存在,如果存在就删除
如何查看oracle里面试图 view1 存不存在,如果存在就删除。该怎么写
[解决办法]
CREATE OR REPLACE
PROCEDURE p_test(
in_view_name IN VARCHAR2)
AS
flg NUMBER;
sqlstr VARCHAR2(100);
BEGIN
SELECT 1 INTO flg FROM all_views WHERE view_name = in_view_name;
IF SQL%FOUND THEN
sqlstr:='drop view '
[解决办法]
in_view_name;
EXECUTE immediate sqlstr;
END IF ;
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('The view does not exist');
END ;