我要实现的功能是判断1个字符串中有几对括号? 用每个括号内的值,作为一个查询条件,返回一个结果。并把这些结果集合并后返回。
比如:“sum(abc)+avg(bcd)+sqrt(cde)”这个字符串里的()也许没有,也许1个或2个,但是最多2个。
然后分别得到下面3个或2个或1个查询的结果,并返回(select * from table where code ='abc')(select * from table where code ='bcd')(select * from table where code ='cde')
比如:“sum(abc)+avg(bcd)+sqrt(cde)”这个字符串里的()也许没有,也许1个或2个,但是最多2个。
然后分别得到下面3个或2个或1个查询的结果,并返回(select * from table where code ='abc')(select * from table where code ='bcd')(select * from table where code ='cde')
解决方案 »
- WIN7 64位 + Toad for oracle 11.6 64b + oracle client 11.2 64b 配置成功
- Oracle创建一个表 如果不指定表空间 是不是就是用默认的system表空间
- 关于ORACLE数据库权限问题
- 这个Triger怎么写???
- 急急急急!!!谁遇到到过ORA-00917 missing comma的错误!
- Oracle中能创建全文索引吗?
- 在开发工具中调用ORACLE存储过程返回记录集的问题,谁能给出完整的例子,有一个给100分
- 那位有在linux下运行的oracle啊,要是免费的
- 用vb远程连接oracle数据库,一定要安装客户端软件吗?
- 数据导入时遇到问题
- oracle汉字转拼音
- 执行存储过程为什么只输出anonymous block completed
v_num1 number:=0;
v_num2 number:=0;
v_length number:=0;
v_str varchar2(100):='sum(abc)+avg(bcd)+sqrt(cde)';
v_str2 varchar2(100);
v_start number:=1;
begin
v_length :=length(v_str);
for i in v_start.. v_length
loop
if i =v_start then
v_num1 :=instr(v_str,'(',i,1);
v_num2 :=instr(v_str,')',i,1);
v_str2 :=substr(v_str,v_num1+1,v_num2-v_num1-1);--最终结果,后续需要怎么处理再怎么处理
v_start:=v_num2+1;
dbms_output.put_line(v_str2);
else null;
end if;
end loop ;
end;