Skip to content
Advertisement

Define a CLOB input parameter for Oracle function (OR Define a function with CLOB input parameter)

I am going to run a code block like below:

In which its purpose is to create a function that one of its input argument is CLOB data type. But by executing my code, I get following error:

ORA-01704: string literal too long

I searched on the internet and also among stackoverflow questions but it didn’t get any consequence.

Could you anyone help me with this issue?

Advertisement

Answer

I believe I understand what you are trying to achieve. As per comments your use of IN is wrong. IN expects list of literals or list of values from select, but your CLOB value is neither, it is just a long string that needs to be processed first before you can use it in SELECT like you mentioned in comments.

To process your CLOB with list of names delimited with , you can find first comma in CLOB and extract value from the beginning of CLOB until this first delimiter and found value is put into collection (delimiter is removed ofc and value is trimmed, this might be optional as I am not sure how your input looks like exactly). Next you remove found value from the beginning of the CLOB and repeat until there are nothing to process in this CLOB. Once you have list of values in collection you can use it as SELECT in your original SELECT.

Try this example:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement