Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting lengthy char data

Status
Not open for further replies.

madhes

Programmer
Apr 16, 2001
18
US
Hi,

I need to insert a lengthy text into the columns of a table.

The format of the table is
int, char(2000), char(2000).

When i insert using the following statement,
&quot;insert into t1 values (1, <2000 characters>, <2000 characters>)&quot;,
it gives the following error:
&quot;SP2-0027: Input is too long (> 2499 characters) - line ignored&quot;

But, when i insert using preparedStatement from JDBC it works.
pst = con.prepareStatement(&quot;insert into chainTest values (2, ?, ?)&quot;);
pst.setString(1, longText); // longText is a String with 2000 chars
pst.setString(2, longText);
pst.executeQuery();

Is there a way to reduce the size of the query, using something similar to replicate('#', 80), which produces 80 #s.

tia,
madhes
 
Try to use bind varables:

var p1 varchar2(2000)
var p2 varchar2(2000)
exec :p1:='...'
exec :p2:='...'

insert into t1 values (1, :p1, :p2)


 
Oh! thanks a lot Sem! It works fine.

but, still i need to type 2000 characters. In case if want to insert some junk value, is there way to tell
&quot;put '#' 2000 times&quot; ?

thanks,
madhes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top