create or replace function F_name
(n1 table.bb%type
)
return Integer as
n1 table.bb%type;
begin
SELECT bb into n1 FROM TABLE
WHERE AA=1
AND BB=n1
AND CC=3
commit;
EXCEPTION
when others then
RAISE_APPLICATION_ERROR(-20000, '录入了非法数据!保存失败!
请核对后重新录入...');
end;
(n1 table.bb%type
)
return Integer as
n1 table.bb%type;
begin
SELECT bb into n1 FROM TABLE
WHERE AA=1
AND BB=n1
AND CC=3
commit;
EXCEPTION
when others then
RAISE_APPLICATION_ERROR(-20000, '录入了非法数据!保存失败!
请核对后重新录入...');
end;
GOOD LUCKY!
as
num number;
begin
select count(1) into num from tabname where aa=1 and nvl2(p_bb,bb,1)=nvl(p_bb,1) and cc=3;
end;
/
create or replace pro(num in number)
is
va table%rowtype;
vb table.b%type;
bgein
if vb=2 then
select * into va from table where a=1 and b=2 and c=3;
else
select * into va from table where a=1 and c=3;
end if;
dbms_output.put_line(table.col1||table.col2||.......||table.coln);
end pro;
不知道这样行吗?
where aa = 1
and nvl((select column_name from dba_col_comments where column_name = 'BB' and table_name = 'TABLENAME'),1) = nvl((select 2 from dba_col_comments where column_name = 'BB' and table_name = 'TABLENAME'),1)
and CC=3
试试这个应该没有问题
where aa = 1
and nvl((select column_name from dba_tab_columns
where column_name = 'BB' and table_name = 'TABLENAME'),1)
= nvl((select 2 from dba_tab_columns
where column_name = 'BB' and table_name = 'TABLENAME'),1)
and cc = 3