2 1 create or replace function fn_tbl(tname varchar2)
2 return int
3 is
4 num int;
5 begin
6 select count(*) into num from user_tables where table_name=tname;
7 if num=0
8 then
9 return 0;
10 else
11 return 1;
12 end if;
13* end;
SQL> /函数已创建。SQL> select fn_tbl('EMP') FROM DUAL;FN_TBL('EMP')
-------------
1
2 return int
3 is
4 num int;
5 begin
6 select count(*) into num from user_tables where table_name=tname;
7 if num=0
8 then
9 return 0;
10 else
11 return 1;
12 end if;
13* end;
SQL> /函数已创建。SQL> select fn_tbl('EMP') FROM DUAL;FN_TBL('EMP')
-------------
1
2 is
3 begin
4 execute immediate 'delete from '||tname;
5 end;
6 /
oracleserver由实例和数据库组成
return number
as
num number;
begin
execute immediate 'select count(1) from '||p_tabname into num;
if num>0 then
return 1;
else
return 0;
end if;
end;
/
是从结构来说还是从组成元素来说没有说清楚。
第2.3个问题楼上已解。
/ ,标准的sql应该没有吧
在/etc/rc.d/init.d下添加什么? 其他方法呢?