Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ora-00902 invalid data type

247890Jan 4 2009 — edited Jan 5 2009
Hello all -

I have a function that returns a ref cursor.

When I test this function using PL/SQL developer, it works just fine and returns ref cursor with a set of price values for a set of products.

However, when I test the same function from SQL*Plus, it errors out.

select get_price('0123','p1,p2,p3') from dual;

Error at line 1:
ORA-00902: invalid datatype

Could you please help me out. Thanks in advance.

Comments

cormaco
Answer

Here is one way:

with input_string(ins) as (
    select 'Chesterton, Mark;#789;#Erbach, Magnus;#786' from dual union all
    select 'Phillips, Edward;#744;#Bubba, Matthew;#782;#Mahony, Chloe;#779' from dual union all
    select 'Corbett, Paul;#784;#Johnson, Ben;#392;#Smith, Adam;#775' from dual
)
select regexp_substr(ins,',\ *([^;]+)',1,1,null,1) regex from input_string

REGEX               
--------------------
Mark                
Edward              
Paul
                
Marked as Answer by User_AS6XD · Oct 14 2021
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 2 2009
Added on Jan 4 2009
30 comments
8,048 views