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!

Pass CLOB from Perl to PL/SQL function

2810868Feb 2 2020 — edited Feb 4 2020

Hi gurus.

Kindly ask you advice on the following problem.

I'm developing function that processes input string. Client that calls function -- Perl client. Client sends a string up to 2 MB in size. Because of this CLOB is used for input variable in PL/SQL function:

create function aaa (Str in clob) return ...

The issue we faced is that nothing is actually passed from Perl to Oracle. Tracing of the data exchange shown that empty parameter is transferred to function.

On the same time we are able to insert that CLOB value from Perl into the table without any problems.

We investigated this but unfortunately found nothing relevant on this.

I will greatly appreciate help or advice on this issue.

Thank you in advance.

Comments

DrClap
Sure, that will work as long as the type in question has an accessible zero-argument constructor. So yes, in your example you could return a new ArrayList or a new HashSet. Not a new ArrayList<Thing>, though, because generics are a compile-time concept only and mean nothing at run time.

By the way it's more traditional to just pass a Class object directly, instead of a wasted object of that class:
public Class<?> method(Class<?> arg) {    
    Class<?> copy = arg.newInstance();
    return copy;
}
And to call that:
ArrayList result = method(ArrayList.class);
843793
@DrClap: shouldn't your method be:
public Object method(Class<?> arg) {    
    Object copy = arg.newInstance();
    return copy;
}
DrClap
Robert.Bossy wrote:
@DrClap: shouldn't your method be:
public Object method(Class<?> arg) {    
Object copy = arg.newInstance();
return copy;
}
Yes, you're right. Or perhaps something like
public T method(Class<? extends T> arg) {    
    T copy = arg.newInstance();
    return copy;
}
Although I have to say, this method doesn't look as useful to me as it apparently did to the OP.
1 - 3

Post Details

Added on Feb 2 2020
11 comments
998 views