Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi ADO sql statement for inserting a CLOB into Oracle 8/9

Posted on 2004-10-22
3
Medium Priority
?
1,569 Views
Last Modified: 2012-06-22
I have an application that needs to insert a record into a table which includes a CLOB field.  I've seen comments about dbms_log and about empty_clob(), but would really appreciate someone who's done this to put together a couple of sql statements that I can execute to get the job done.

I have a TMemo control on screen (not data bound) and I need to pass the text over and get it inserted into the table.  What I've tried so far is

ADOCmd.SQL := 'Insert into Memos (Recno, Notes) values (1234, ' + moDescrip.Text + ')';
ADOCmd.Execute;

For someone who's done this before, this should be quick and easy points.  :-)
Thanks.
0
Comment
Question by:bjones8888
[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
3 Comments
 

Author Comment

by:bjones8888
ID: 12385384
Oops.  Forgot to mention.  It seems to work ok with small amounts of text (< 254 characters).  As soon as I go to larger amounts of text, I get an access violation.  It's wrapped pretty deeply so I'm not sure what the actual error message is that it generates.
0
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 500 total points
ID: 12385581
Would it help if you use parameters instead?

with ADOCmd do
begin
  CommandText := 'INSERT INTO Memos (RecNo, Notes) VALUES (:RecNo, :Notes)';
  Parameters.ParamValues['RecNo'] := 1234;
  Parameters.ParamValues['Notes'] := moDescript.Text;
  Execute;
end;
0
 
LVL 1

Expert Comment

by:vacerose
ID: 12385630
When dealing with large data I have had success using a parameterized query and streams.

ms:=TMemoryStream.Create;
moDescrip.Lines.SaveToStream(ms);
ms.Position:=0;
ADOCmd.SQL := 'Insert into Memos (Recno, Notes) values (1234, :pNotes)';
ADOCmd.Prepared:=true;
ADOCmd.Parameters.ParamByName('pNotes').LoadFromStream(ms);
ADOCmd.Execute;
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

618 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