Обсуждение: Needs Function

Поиск
Список
Период
Сортировка

Needs Function

От
"Penchalaiah P."
Дата:

 

I need a user defined function for the following purpose….

If I pass a string with comma ( , ) separated chars/values…. It should be appear in next line…

Ex: select get_sep_str (‘SK, rp, h, j, 6, 9, kl’) from dual;

Output :

SK

rp

h

j

6

9

kl

 

(Or)

 

I have one table like this…..

 

Temp Table:

 

Deptno number(10)

Empno  varchar2(200);

 

Data in temp table:

 

Deptno                       Empno

-----------                      ------------

10                                      B3091,B3092,B3093,B3085

11                                      3651,6521

12                                      H3062

 

Now, I want to display the data like this…..

 

Deptno                       Empno

---------                        ---------

10                   B3091

10                   B3092

10                   B3093

10                   B3094

11                   3651

11                   6521

12                   H3062

Now, how can I achieve this….

 

Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info.in@infics.com and delete this email from your records.

Re: Needs Function

От
"Rodrigo De León"
Дата:
On 5/2/07, Penchalaiah P. <penchalaiahp@infics.com> wrote:
> I need a user defined function for the following purpose….
>
> If I pass a string with comma ( , ) separated chars/values…. It should be appear in next line…
>
> Ex: select get_sep_str ('SK, rp, h, j, 6, 9, kl') from dual;
>
> Output :
>
> SK
>
> rp
>
> h
>
> j
>
> 6
>
> 9
>
> kl
>
>
>
> (Or)
>
>
>
> I have one table like this…..
>
>
>
> Temp Table:
>
>
>
> Deptno number(10)
>
> Empno  varchar2(200);
>
>
>
> Data in temp table:
>
>
>
> Deptno                       Empno
>
> -----------                      ------------
>
> 10                                      B3091,B3092,B3093,B3085
>
> 11                                      3651,6521
>
> 12                                      H3062
>
>
>
> Now, I want to display the data like this…..
>
>
>
> Deptno                       Empno
>
> ---------                        ---------
>
> 10                   B3091
>
> 10                   B3092
>
> 10                   B3093
>
> 10                   B3094
>
> 11                   3651
>
> 11                   6521
>
> 12                   H3062
>
> Now, how can I achieve this….

See:

http://archives.postgresql.org/pgsql-general/2005-12/msg00080.php


Re: Needs Function

От
"Aaron Bono"
Дата:
On 5/3/07, Rodrigo De León <rdeleonp@gmail.com> wrote:
Man, where was this last week when I needed it.  I will have to keep this for future reference.

Thanks!

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================

Re: Needs Function

От
"Bart Degryse"
Дата:
Well, actually it was there last week too :)

>>> "Aaron Bono" <postgresql@aranya.com> 2007-05-03 16:14 >>>
On 5/3/07, Rodrigo De León <rdeleonp@gmail.com> wrote:
Man, where was this last week when I needed it.  I will have to keep this for future reference.

Thanks!

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================