Home > database >  Oracle function how to use the stitching SQL string pipe
Oracle function how to use the stitching SQL string pipe

Time:10-03

I have a pipeline function is like this:

The create or replace function fun1 return table_type1 pipelined as
V row_type1;
The begin
For myrow in ( select KEYID, HOS_CODE HOS_NAME from tableTest ) loop
V:=row_type1 (myrow. HOS_CODE, myrow HOS_NAME);
Pipe row (v);
End loop;
return;
end;

I want to change the query statements to SQL patchwork string, should how to write?
For myrow in can put inside a string? Or how to do?

CodePudding user response:

Direct use of regexp_substr and regexp_count two functions;

The building Lord baidu first, there is a problem to ask;

CodePudding user response:

reference 1st floor wmxcn2000 response:
use regexp_substr directly and regexp_count two functions;

The building Lord baidu first, there is a problem to ask;



Thank you for your reply, could you tell me how is the application?

CodePudding user response:

 - the original poster first search, there are specific questions to ask, this time to write you 

SQL> The begin
2 for x in (select regexp_substr (' AAA, BB, FF, DDDD ', '[^,] +, 1, level) item
3 the from dual
4 connect by rownum & lt;=regexp_count (' AAA, BB, FF, DDDD ', ', ') + 1
5) loop
6
7 dbms_output. Put_line x.i (tem);
8 the end loop;
9 the end;
10/
AAA
BB
FF
DDDD
PL/SQL procedure successfully completed

SQL>

CodePudding user response:

reference wmxcn2000 reply: 3/f
 - the original poster first search, there are specific questions to ask, this time to write you 

SQL> The begin
2 for x in (select regexp_substr (' AAA, BB, FF, DDDD ', '[^,] +, 1, level) item
3 the from dual
4 connect by rownum & lt;=regexp_count (' AAA, BB, FF, DDDD ', ', ') + 1
5) loop
6
7 dbms_output. Put_line x.i (tem);
8 the end loop;
9 the end;
10/
AAA
BB
FF
DDDD
PL/SQL procedure successfully completed

SQL>




Sorry, it seems that you didn't understand what I mean,
I want to SQL query is to use the string concatenation, like the following address, and then is the way of using pipeline function,
http://k11hao.iteye.com/blog/1101988
  • Related