Ok, I know it should be possible to update LONGs (probably shouldn't have said the docs say I can't update longs but should've said I can't do it through a literal UPDATE sql query)
 
Maybe I should make my scenario a bit clearer.  I'm writing Java programs using the JDBC driver.  I need to update my LONG field while coding in Java.  The reason I said I used SQL studio was to show that the problem was SAP related, and not my code, nor the JDBC driver I downloaded.
 
When I create the tables I just say 'LONG' in the create table query.  So I'm not sure which of the two LONG types I'm using?  (Although I will need over 8000 characters - I see varchar can go up to 8000 characters to I don't know why one would use the "short-LONG" you referred to)
 
> You will not write such a if..then..else in SQLStudio, I assume.
No, I won't use the if statement in SQL studio, I was talking about my Java programs.  I would like to have generic Java code so that I don't have to state:
 
if (I'M USING A SAP DB)
{ run some thing to get longs to work }
else
{ run normal update queries }
 
To keep my code relatively database independant.  But at worst case, I can do the if statement throughout my code.  I just need to get updates working otherwise I'm going to have to try a complete hack of deleting and re-inserting every time!!!  Of course that could be a real problem if the row is foreign keyed becase I'll have to cascade delete and re-insert all the deleted rows again
 
I'm afraid I didn't full understand the bit about hostvariables/parameters and passing it to the kernal.  Is this procedure in the docs?  And if so do you think I could do this from a program through the JDBC driver?
 
Kind Regards, Thanks for the help
 
Bruce
 
----- Original Message -----
Sent: Tuesday, October 23, 2001 1:58 PM
Subject: RE: LONG update problem

Bruce Lowe  wrote:
 
I've designed some fields in my db using LONGs to store text.   
> This works fine with inserts however the documentation says I can't update LONGs!!!   
 
this is the sentence out of the refence manual:
 

The  ... statement can only be used to assign a value to columns with the data type LONG if it contains a parameter or NULL specification. The assignment of values to LONG columns is therefore only possible with some database tools. 

Noone says, that updating of long-columns is impossible.

But for updating you need tools where you can use parameter / hostvariables where the new value is in

and which will be used to transfer the new value from application to kernel.

Only for short LONG-column-values with INSERT it is possible to say

INSERT mytab (mylongcol) values ('this is a short LONG-column-value')

 > Is there some way around this. 

see above 

 
>  I've tried the simplest of queries in the SAP Sql Studio
    > UPDATE news_item
    > SET body = 'b2'
    > WHERE news_item_number = 363
>
 >  How can one fix this problem, preferably in a generic way
 > ( so I don't have to start putting in too many:
 > if (SAPDB) then {do this update} else {normal update}
 > ).   
 
You will not write such a if..then..else in SQLStudio, I assume.
You will use some kind of program and then using hostvariables
(even necessary for INSERT of LONG-column-values > around 8000 bytes)
there no problem will exist any more.
 
Elke
SAP Labs Berlin
 

Reply via email to