Solved

Passing an array of values in a string from Crystal Reports 2011 to ORACLE 11G INTO A CLOB data type in a store procedure

Posted on 2013-01-23
13
1,158 Views
Last Modified: 2013-02-27
I would like to pass an array of value  for exampe '1203030','1S0303030','2002022' from Crystal reports to a CLOB and then parse the values to insert into a table.

The string will exceed 4000 characters so I am unable to store in VARCHAR2 data type.
Can this be done?  If so, could you give me an example?
0
Comment
Question by:cookiejar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 38812943
Crystal Reports is a reporting tool.  It isn't intended to be used to change/update a database.

Is Crystal just the source of the values or is your intent to use Crystal to populate the database?

mlmcc
0
 
LVL 23

Expert Comment

by:paquicuba
ID: 38812953
Same here. Crystal runs in a READ ONLY transaction, so you need to find another interface that can write to the database.
0
 

Author Comment

by:cookiejar
ID: 38815023
My source of values are being sent to Crystal multi-select parameter via JAVA.  From Crystal the values will be sent to an ORACLE stored procedure to write to a table.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cookiejar
ID: 38815030
Oops this question should have been submitted to ORACLE experts.
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 38815040
>>Oops this question should have been submitted to ORACLE experts.

It was.  Since Crystal Reports was in the title, I never posted since I'm not a Crystal person and figured mlmcc would handle it.

>>From Crystal the values will be sent to an ORACLE stored procedure to write to a table.

So is the question really how to pass a CSV list into an Oracle procedure, parse it and insert the values into a table?
0
 

Author Comment

by:cookiejar
ID: 38815042
How do I remove it from your queue and  send to ORACLE queue?
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38815053
>>How do I remove it from your queue and  send to ORACLE queue?

It is posted in the Oracle Zone.  Many Experts are also Experts in other areas.  It was the 'Crystal Reports' aspect of the title of the question that confused us.
0
 

Author Comment

by:cookiejar
ID: 38815442
> So is the question really how to pass a CSV list into an Oracle procedure, parse it and insert the values into a table?

Yes,  pass a CSV list to ORACLE stored procedure that  will exceed 4000 characters.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38815527
Make the input to the procedure a CLOB.  Then you need to change the Java program to use a compatible object type.

Now for the format of the CSV, 'a','b','c' will likely not work.  You will either need to change it to: 'a,b,c' or double up on the single quotes so Oracle can handle it(all single quotes, no double quotes used): '''a'',''b'',''c'''

To parse it in the procedure once you get it, there are many examples out there on how to do this.

If you search this site (or the web) for str2tbl, there is a function you can use or you can write your own.

Let us know what pieces you need help with.  I can help with any of the Oracle pieces but I'm not a Crystal or Java person.
0
 

Author Comment

by:cookiejar
ID: 38815687
Here's a snippet of code that was sent to me by one of your experts sometime of ago.  This is what is being using for a VARCHAR2 data type.  Will this work with a CLOB?

CURSOR parse_org_list IS
   SELECT replace(txt, '''', NULL) org_id
FROM (SELECT REGEXP_SUBSTR (p_orglist, '[^,]+', 1, LEVEL) txt FROM DUAL
      CONNECT BY LEVEL <= LENGTH (p_orglist) - LENGTH (REPLACE (p_orglist, ',')) + 1);
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38816051
It should work fine with 10g and above.

There were some restictions on some functions like REPLACE with CLOBs but I think most of those have been resolved in newer releases.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 38817044
The questio is only in the Oracle database zone.  many of have filters set to look at the title and the body for key words in case a question is asked in the wrong zone.

You can export a Crystal report and update a database through an ODBC connection but that isn't what you want.

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question